2282 Commits

Author SHA1 Message Date
Prabhu Rajasekaran
60669c1cfe
Fix callee type generation (#186272)
The callee_type metadata is expected to be a list of generalized type
metadata by the IR verifier. But for indirect calls with internal
linkage the type metadata is just an integer. Avoid including them in
callee_type metadata.

This will reduce the precision of the generated call graph as the edges to internal linkage functions whose address were taken will not be present anymore. We need to handle this in the future.
2026-03-13 16:24:22 -07:00
Joseph Huber
5a88dffc40
[Clang] Only define wchar_size module flag if non-standard (#184668)
Summary:
This PR simply changes the behavior of the `wchar_size` flag. Currently,
we emit this in all cases for all targets. This causes problems during
LLVM-IR linking, specifically because this would vary between Linux and
Windows in unintuitive ways. Now we have an llvm::Triple helper to
determine the size from the known values. The module flag will only be
emitted if these do not match (indicating a non-standard environment).

In addition to fixing AMDGCN bitcode linking, this also means we don't
need to bloat *every* IR module compiled by clang with this flag. The
changed tests reflects this, one less unnecessary piece of metadata.
2026-03-04 16:13:48 -06:00
Peter Collingbourne
4a7bffc2c4
CodeGen, Driver: Introduce -fpreferred-function-alignment option.
This option may be used to specify a function's preferred alignment.
The -falign-functions option and the aligned attribute now control
both the minimum alignment and the preferred alignment for consistency
with gcc. In contrast to the previous approach implemented in #149444
the preferred alignment is retained for member functions.

Part of this RFC:
https://discourse.llvm.org/t/rfc-enhancing-function-alignment-attributes/88019

Reviewers: vitalybuka, MaskRay, AaronBallman, jansvoboda11

Pull Request: https://github.com/llvm/llvm-project/pull/155528
2026-02-24 14:15:15 -08:00
Joseph Huber
9f2351c27e
[HIP] Do not apply 'externally_initialized' to constant device variables (#182157)
Summary:
From the Language reference:
> By default, global initializers are optimized by assuming that global
variables defined within the module are not modified from their initial
values before the start of the global initializer. This is true even for
variables potentially accessible from outside the module, including
those with external linkage or appearing in @llvm.used or dllexported
variables. This assumption may be suppressed by marking the variable
with externally_initialized.

This is intended because device programs can be modified beyond the
normal lifetime expected by the optimization pipeline. However, for
constant variables we should be able to safely assume that these are
truly constant within the module. In the vast majority of cases these
will not get externally visible symbols, but even `extern const` uses we
should assert that the user should not be writing them if they are
marked const.
2026-02-24 09:11:31 -06:00
Peter Collingbourne
370d7ce580
[Clang] Add pointer field protection feature.
Pointer field protection is a use-after-free vulnerability
mitigation that works by changing how data structures' pointer
fields are stored in memory. For more information, see the RFC:
https://discourse.llvm.org/t/rfc-structure-protection-a-family-of-uaf-mitigation-techniques/85555

Reviewers: fmayer, ojhunt

Pull Request: https://github.com/llvm/llvm-project/pull/172119
2026-02-19 15:19:35 -08:00
Sam Elliott
df1eec77b5
[clang] Ensure -mno-outline adds attributes (#163692)
Before this change, `-mno-outline` and `-moutline` only controlled the
pass pipelines for the invoked compiler/linker.

The drawback of this implementation is that, when using LTO, only the
flag provided to the linker invocation is honoured (and any files which
individually use `-mno-outline` will have that flag ignored).

This change serialises the `-mno-outline` flag into each function's
IR/Bitcode, so that we can correctly disable outlining from functions in
files which disabled outlining, without affecting outlining choices for
functions from other files. This matches how other optimisation flags
are handled so the IR/Bitcode can be correctly merged during LTO.
2026-02-18 10:16:31 -08:00
Sam Elliott
d2be26a9f2
[clang] Add clang::no_outline Attribute (#163666)
This change:

- Adds a `[[clang::no_outline]]` function attribute for C and C++. There
is no equivalent GNU syntax for this attribute, so no `__attribute__`
syntax.
- Uses the presence of `[[clang::no_outline]]` to add the `nooutline`
attribute to IR function definitions.
- Adds test for the above.

The `nooutline` attribute disables both the Machine Outliner (enabled at
Oz for some targets), and the IR Outliner (disabled by default).

Fixes #144135
2026-02-13 18:29:22 -08:00
Jameson Nash
d040788af6
[clang] remove unused SrcAddr parameter from performAddrSpaceCast (#179330)
The conversion code always ended up just getting the type of Src from
the Src argument itself, with no virtual users of this, so there is no
point in also providing this API hook. Fix the documentation as well,
since it seems DestAddr must have been similarly removed at some point
in the past from the API but was still documented.

Also fixes CIR to actually return the casted value!
2026-02-05 14:03:19 -05:00
paperchalice
bbc4a21c9f
[ARM][clang] Add some build attributes support (#161106)
"unsafe-fp-math" and related function attribites will be removed in
future, let frontend generate some hints for ARM backend to generate ABI
tags.
2026-02-05 12:42:37 +00:00
Djordje Todorovic
84cdaa458a
Reland "[clang][RISCV] Add big-endian RISC-V target support" (#177939)
The problem was using the `--rtlib=platform` without
`--unwindlib=platform` conflicts the default unwindlib with the
Fuchsia's configuration, and that is why the test failed.

Orignal PR: https://github.com/llvm/llvm-project/pull/165599
The fail was reported at:
https://github.com/llvm/llvm-project/pull/165599#issuecomment-3751750804

Co-authored-by: Djordje Todorovic <djordje.todorovic@syrmia.com>
2026-02-05 10:53:54 +01:00
Djordje Todorovic
bdfe03bbce
[MIPS][ISel] Fix musttail (#161860)
Properly handle clang::musttail attribute on MIPS backend.

It fixes: https://github.com/llvm/llvm-project/issues/161193
2026-01-27 19:55:22 +01:00
cooperp
a63696edca
Allow the no_stack_protector attribute on local variables (#173311)
This attribute is currently only permitted on functions, but sometimes
it can be useful to opt out a specific local variable. That way the
function can still get a stack protector if other locals require it, but
locals which are opted out won't have the overhead of a stack protector
if not needed.

This is paired with an LLVM change which has already landed, which uses
the new metadata to opt specific alloca instructions out of requiring a
stack protector.
2026-01-27 07:28:17 -05:00
Shilei Tian
f3a674a2ef
[RFC][Clang][AMDGPU] Emit only delta target-features to reduce IR bloat (#176533)
Currently, AMDGPU functions have `target-features` attribute populated
with all default features for the target GPU. This is redundant because
the backend can derive these defaults from the `target-cpu` attribute
via `AMDGPUTargetMachine::getFeatureString()`.

In this PR, for AMDGPU targets only:

- Functions without explicit target attributes no longer emit
`target-features`
- Functions with `__attribute__((target(...)))` or `-target-feature`
emit only features that differ from the target's defaults (delta)

The backend already handles missing `target-features` correctly by
falling back to the TargetMachine's defaults.

A new cc1 flag `-famdgpu-emit-full-target-features` is added to emit
full features when needed.

Example:

Before:

```llvm
attributes #0 = { "target-cpu"="gfx90a" "target-features"="+16-bit-insts,+atomic-buffer-global-pk-add-f16-insts,+atomic-fadd-rtn-insts,+ci-insts,+dl-insts,+dot1-insts,+dot2-insts,..." }
```

After (default):

```llvm
attributes #0 = { "target-cpu"="gfx90a" }
```

After (with explicit `+wavefrontsize32` override):

```llvm
attributes #0 = { "target-cpu"="gfx90a" "target-features"="+wavefrontsize32" }
```
2026-01-20 14:49:35 -05:00
Daniel Paoliello
483c6834a2
[NFC][win] Use an enum for the cfguard module flag (#176461)
Currently the `cfguard` module flag can be set to 1 (emit tables only,
no checks) or 2 (emit tables and checks).

This change formalizes that definition by moving these values into an
enum, instead of just having them documented in comments.

Split out from #176276
2026-01-16 18:23:25 -08:00
Djordje Todorovic
dc133c9c21
Revert "[clang][RISCV] Add big-endian RISC-V target support" (#176039)
Reverts llvm/llvm-project#165599
2026-01-14 23:04:53 +01:00
Djordje Todorovic
2bce962db2
[clang][RISCV] Add big-endian RISC-V target support (#165599)
We proceeded with frontend/clang changes, until we figure out how ABI
for BE should look like. Once it is final, we will proceed with codegen
changes.

In this patch several things addressed:
  - Define riscv32be/riscv64be target triples
  - Set correct data layout for BE targets
  - Handle BE-specific ABI details
  - Emit warning for BE case since it is still experimental
2026-01-14 21:46:36 +01:00
Erich Keane
04c83c3498
[NFCI] Extract out the addVariableConstraints CGASM Function (#175261)
This function is needed in identical form for CIR codegen, and pulling
it out into AsmStmt is effectively trivial. The only thing that actually
needs the codegen in it is the ability to diagnose, so this patch adds
that as a callback. AsmStmt seems to be the most logical place for this
to happen, as it does other similar things. Howver, unlike the other
similar things, th is is the same between MS and GCC, so it doesn't need
separate implementations.
2026-01-14 06:31:13 -08:00
Alexandros Lamprineas
16b8eb5802
[clang][FMV][AArch64] Diagnose/ignore unreachable functions versions. (#171496)
The commit https://github.com/llvm/llvm-project/pull/150267 allows the
user to override version priority. As a result it is now possible to
define an unreachable function version if a higher priority version
contains a subset of its FMV features. For example:

target_clones("sve;priority=2", "sve2;priority=1")

the sve2 version is unreachable, since if you don't have sve we can't
have sve2 either.

The patch emits a warning about such cases and ignores those versions
when generating the resolver. Also removes their definitions.
2025-12-22 14:49:30 +02:00
Dave Bartolomeo
80887c7de9
[clang][NFC][diagnostics] Remove most usage of getCustomDiagID() from CodeGen (#172557) 2025-12-21 08:17:19 -05:00
Nathan Gauër
8cfda79105
[HLSL][SPIR-V] Implement vk::push_constant (#166793)
Implements initial support for vk::push_constant.
As is, this allows handling simple push constants, but has one
main issue: layout can be incorrect (See #168401). The layout
issue being not only push-constant related, it's ignored for this PR.

The frontend part of the implementation is straightforward:
 - adding a new attribute
 - when targeting vulkan/spirv, we process it
 - global variables with this attribute gets a new AS:
   hlsl_push_constant

The IR has nothing specific, only some RO globals in this new AS.

On the SPIR-V side, we not convert this AS into a PushConstant storage
class. But this creates some issues: the variables in this storage class
must have a specific set of decoration to define their layout.

Current infra to create the SPIR-V types lacks the context required to
make this decision: no indication on the AS or context around the type
being created. Refactoring this would be a heavy task as it would
require getting this information in every place using the GR for type
creation.

Instead, we do something similar to CBuffers:
 - find all globals with this address space, and change their type to
   a target-specific type.
 - insert a new intrinsic in place of every reference to this global
   variable.

This allow the backend to handle both layout variables loads and type
lowering independently.

Type lowering has nothing specific: when we encounter a target extension
type with spirv.PushConstant, we lower this to the correct SPIR-V type
with the proper offset & block decorations.

As for the intrinsic, it's mostly a no-op, but required since we have
this target-specific type.

Note: this implementation prevents the static declaration of multiple
push constants in a single shader module. The actual specification is
more relaxed: there can be only one **used** push constant block per
entrypoint. To correctly implement this, we'd require to keep some
additional state to determine the list of statically used resources per
entrypoint. This shall be addressed as a follow-up (see #170310)
2025-12-18 11:01:11 +01:00
Nikita Popov
b7c0452a9a
[PowerPC][AIX] Specify correct ABI alignment for double (#144673)
Add `f64:32:64` to the data layout for AIX, to indicate that doubles
have a 32-bit ABI alignment and 64-bit preferred alignment.

Clang was already taking this into account, but it was not reflected in
LLVM's data layout.

A notable effect of this change is that `double` loads/stores with 4
byte alignment are no longer considered "unaligned" and avoid the
corresponding unaligned access legalization. I assume that this is
correct/desired for AIX. (The codegen previously already relied on this
in some places related to the call ABI simply by dint of assuming
certain stack locations were 8 byte aligned, even though they were only
actually 4 byte aligned.)

Fixes https://github.com/llvm/llvm-project/issues/133599.
2025-12-11 08:57:26 +01:00
Kees Cook
421399d9d3
[CodeGen][KCFI] Fix asm comment style (#170739)
We can't use "#" in the middle of the asm output, so switch to a /* */
pair instead.
2025-12-04 15:22:22 -08:00
Kees Cook
6e479668ba
[CodeGen][KCFI] Allow setting type hash from xxHash64 to FNV-1a (#167254)
When emitting the assembly .set directive, KCFI needs to use
getZExtValue(). However, this means that FileCheck pattern matching can't
match between the .set directive and the IR when the high bit of a 32-bit
value is set. We had gotten lucky with the existing tests happening to
just not have had the high bit set. The coming hash change will expose
this, though.

LLVM IR's default printing behavior uses APInt::operator<<, which calls
APInt::print(OS, /*isSigned=*/true). This means KCFI operand bundles in
call instructions print as signed (e.g. [ "kcfi"(i32 -1208803271) ]),
and KCFI type metadata prints as signed (e.g. !3 = !{i32 -1208803271}).
Changing the IR to print unsigned i32 values would impact hundreds of
existing tests, so it is best to just leave it be.

Update the KCFI .set direct to use getSExtValue() in a comment so that
we can both build correctly and use FileCheck with pattern matching in
tests.

KCFI generates hashes in two places. Instead of exposing the hash
implementation in both places, introduce a helper that wraps the
specific hash implementation in a single place, llvm::getKCFITypeID.

In order to transition between KCFI hash, we need to be able to specify
them. Add the Clang option -fsanitize-kcfi-hash= and a IR module option
"kcfi-hash" that can choose between xxHash64 and FNV-1a. Default to
xxHash64 to stay backward compatible, as we'll need to also update rustc
to take a new option to change the hash to FNV-1a for interop with the
coming GCC KCFI.
2025-12-03 15:09:04 -08:00
Helena Kotas
434127b0c1
[HLSL] Static resources (#166880)
This change fixes couple of issues with static resources:
- Enables assignment to static resource or resource array variables (fixes #166458)
- Initializes static resources and resource arrays with default constructor that sets the handle to poison
2025-12-02 22:25:17 +00:00
Marco Elver
3c6864ab88
[Clang][CodeGen] Remove explicit insertion of AllocToken pass (#169360)
Remove explicit insertion of the AllocTokenPass, which is now handled by
the PassBuilder. Emit AllocToken configuration as LLVM module flags to
persist into the backend.

Specifically, this also means it will now be handled by LTO backend
phases; this avoids interference with other optimizations (e.g. PGHO)
and enable late heap-allocation optimizations with LTO enabled.
2025-12-02 16:13:45 +01:00
Jason-VanBeusekom
4394aa685c
[OpenMP][clang][HIP][CUDA] fix weak alias emit on device compilation (#164326)
This PR adds checks for when emitting weak aliases in: `void
CodeGenModule::EmitGlobal(GlobalDecl GD)`, before for device compilation
for OpenMP, HIP and Cuda, clang would look for the aliasee even if it
was never marked for device compilation.

For OpenMP the following case now works:

> Failed before when compiling with device, ie: `clang -fopenmp
-fopenmp-targets=amdgcn-amd-amdhsa`
>   ```
>   int __Two(void) { return 2; }
>   int Two(void) __attribute__ ((weak, alias("__Two")));
>   ```

For HIP / Cuda:

> 
> ```
> int __HostFunc(void) { return 42; }
> int HostFunc(void) __attribute__ ((weak, alias("__HostFunc")));
> ```

For HIP:

>Failed before on HIP, Cuda fails due to: `NVPTX aliasee must not be
'.weak'` error
> ``` 
> __device__ int __One(void) { return 2; }
> __device__ int One(void) __attribute__ ((weak, alias("__One")));
> ```

Included are Codegen LIT tests for the above cases, and also cases for
weak alias cases that currently work in clang.

Fixes https://github.com/llvm/llvm-project/issues/117369
2025-11-27 09:05:24 -05:00
Zequan Wu
54a4da9df6
Revert "Reland [MS][clang] Add support for vector deleting destructors" (#169116)
This reverts 4d10c1165442cbbbc0017b48fcdd7dae1ccf3678 and its two
dependent commits: e6b9805b574bb5c90263ec7fbcb94df76d2807a4 and
c243406a695ca056a07ef4064b0f9feee7685320, see discussion in
https://github.com/llvm/llvm-project/pull/165598#issuecomment-3563825509.
2025-11-21 17:14:34 -08:00
Jordan Rupprecht
3d3307ecd8
[clang][NFC] Inline Frontend/FrontendDiagnostic.h -> Basic/DiagnosticFrontend.h (#162883)
d076608d58d1ec55016eb747a995511e3a3f72aa moved some deps around to avoid
cycles and left clang/Frontend/FrontendDiagnostic.h as a shim that
simply includes clang/Basic/DiagnosticFrontend.h. This PR inlines it so
that nothing in tree still includes clang/Frontend/FrontendDiagnostic.h.

Doing this will help prevent future layering issues. See #162865.

Frontend already depends on Basic, so no new deps need to be added
anywhere except for places that do strict dep checking.
2025-11-21 03:39:49 +00:00
Mariya Podchishchaeva
4d10c11654
Reland [MS][clang] Add support for vector deleting destructors (#165598)
MSVC supports an extension allowing to delete an array of objects via
pointer whose static type doesn't match its dynamic type. This is done
via generation of special destructors - vector deleting destructors.
MSVC's virtual tables always contain a pointer to the vector deleting
destructor for classes with virtual destructors, so not having this
extension implemented causes clang to generate code that is not
compatible with the code generated by MSVC, because clang always puts a
pointer to a scalar deleting destructor to the vtable. As a bonus the
deletion of an array of polymorphic object will work just like it does
with MSVC - no memory leaks and correct destructors are called.

This patch will cause clang to emit code that is compatible with code
produced by MSVC but not compatible with code produced with clang of
older versions, so the new behavior can be disabled via passing
-fclang-abi-compat=21 (or lower).

This is yet another attempt to land vector deleting destructors support
originally implemented by
https://github.com/llvm/llvm-project/pull/133451.

This PR contains fixes for issues reported in the original PR as well as
fixes for issues related to operator delete[] search reported in several
issues like

https://github.com/llvm/llvm-project/pull/133950#issuecomment-2787510484
https://github.com/llvm/llvm-project/issues/134265

Fixes https://github.com/llvm/llvm-project/issues/19772
2025-11-13 10:32:03 +01:00
Benjamin Stott
0ff0892470
[Clang][CodeGen] Add disable_sanitizer_instrumentation attribute to multiversion resolvers (#167516)
- Fixes https://github.com/llvm/llvm-project/issues/163369
- Segmentation fault occurred because resolver was calling TSan
instrumentation functions (__tsan_func_entry, __tsan_func_exit) but as
the resolver is run by the dynamic linker at load time, TSan is not
initialized yet so the current thread pointer is null.
- This PR adds the DisableSanitizerInstrumentation attribute to the
multiversion function resolvers to avoid issues like this.
- Added regression test for TSan segfault.
2025-11-12 10:39:30 +00:00
Nabeel Omer
7a58b417bc
Add FramePointerKind::NonLeafNoReserve (#163775)
This patch adds a new `FramePointerKind::NonLeafNoReserve` and makes it
the default for `-momit-leaf-frame-pointer`.

It also adds a new commandline option `-m[no-]reserve-frame-pointer-reg`.

This should fix #154379, the main impact of this patch can be found in
`clang/lib/Driver/ToolChains/CommonArgs.cpp`.
2025-11-11 17:25:49 +00:00
Vitaly Buka
77a194cb09
[NFC][CodeGen] Replace loop with "if !empty()" (#166515)
The loop iterates once and returns the first element.
Replace it with "if !empty()" to make it more explicit.

Follow up to https://github.com/llvm/llvm-project/pull/158193.
2025-11-07 17:17:03 -08:00
Jacob Lambert
2c8781de64
Revert "[Clang] Make the AS of llvm.compiler.used & llvm.used elements addrspace(0)" (#166242)
Reverts llvm/llvm-project#164432

Breaks Comgr tests with the following:


[2025-11-03T19:18:20.564Z] + clang -x hip --offload-arch=amdgcnspirv
-nogpulib -nogpuinc --no-gpu-bundle-output --offload-device-only -O3
/jenkins/workspace/compiler-psdb-amd-staging/repos/llvm-project/amd/comgr/test-lit/spirv-tests/spirv-to-reloc.hip
-o
/jenkins/workspace/compiler-psdb-amd-staging/repos/out/ubuntu-22.04/22.04/build/amd_comgr/test-lit/spirv-tests/Output/spirv-to-reloc.hip.tmp.spv
-fvisibility=hidden -fno-autolink -fexceptions -fcolor-diagnostics

[2025-11-03T19:18:20.564Z] InvalidModule: Invalid SPIR-V module: Casts
from private/local/global address space are allowed only to generic

[2025-11-03T19:18:20.564Z] 

[2025-11-03T19:18:20.564Z] <badref> = addrspacecast ptr addrspace(1)
@__hip_cuid_94fb83be5559070 to ptr

[2025-11-03T19:18:20.564Z] clang: error: amdgcn-link command failed with
exit code 10 (use -v to see invocation)
2025-11-03 22:09:09 +00:00
Juan Manuel Martinez Caamaño
bf2f5773d9
[Clang] Make the AS of llvm.compiler.used & llvm.used elements addrspace(0) (#164432)
By convention the AS of the elements of `llvm.compiler.used` &
`llvm.used` is 0. However, the AS of `CGM.Int8PtrTy` is not always 0.

This leaves some LLVM helpers
(`appendToUsed/appendToCompilerUsed/removeFromUsedLists`) unusable.

This patch makes the AS of the elements of these variables to be 0.

This PR is related to https://github.com/llvm/llvm-project/pull/162660
2025-11-03 15:22:21 +01:00
Daniil Kovalev
d34ead1ce4
[PAC][clang] Handle pauthtest environment and ABI in Linux-specific code (#113151)
Since pauthtest is a Linux-specific ABI, it should not be handled in
common driver code.
2025-10-24 11:48:40 +00:00
Daniel Kiss
048070ba6f
[ARM][AArch64] BTI,GCS,PAC Module flag update. (#86212)
Module flag is used to indicate the feature to be propagated to the
function. As now the frontend emits all attributes accordingly let's
help the auto upgrade to only do work when old and new bitcodes are
merged.

Depends on #82819 and #86031
2025-10-22 09:29:06 +02:00
Prabhu Rajasekaran
550b62cbcb
[clang] callee_type metadata for indirect calls (#163233)
Create and add generalized type identifier metadata to indirect calls,
and to functions which are potential indirect call targets.

The functions carry the !type metadata. The indirect callsites carry a
list of !type metadata values under !callee_type metadata.

RFC:
https://discourse.llvm.org/t/rfc-call-graph-information-from-clang-llvm-for-c-c/88255
2025-10-21 08:02:52 -07:00
Antonio Frighetto
efcda54794
[clang][CodeGen] Emit llvm.tbaa.errno metadata during module creation
Let Clang emit `llvm.tbaa.errno` metadata in order to let LLVM
carry out optimizations around errno-writing libcalls to, as
long as it is proved the involved memory location does not alias
`errno`.

Previous discussion: https://discourse.llvm.org/t/rfc-modelling-errno-memory-effects/82972.
2025-10-21 11:38:45 +02:00
Matheus Izvekov
b516dcc998
[clang] NFC: rename TagType::getOriginalDecl back to getDecl (#163271)
This rename was made as part of
https://github.com/llvm/llvm-project/pull/147835 in order to ease
rebasing the PR, and give a nice window for other patches to get rebased
as well.

It has been a while already, so lets go ahead and rename it back.
2025-10-15 16:11:17 -03:00
Jan Svoboda
839b91c229
[clang] Move -fprofile-instrument-use-path= check to driver (#159667)
The frontend currently opens the path provided via
`-fprofile-instrument-use-path=` to learn the kind of the
instrumentation data and set the `CodeGenOptions::ProfileUse` value.
This happens during command-line parsing, where we don't have a
correctly configured VFS yet, so the behavior is quite different from
all other frontend inputs. We need to move this logic out of the
frontend command line parsing logic somewhere where we do have the
configured VFS.

The complication is that the `ProfileUse` flag is being used to set
preprocessor macros, and there isn't a great place between command line
parsing and preprocessor initialization to perform this logic.

This PR solves the issue by deducing the kind of instrumentation data
right in the driver and then passing it via a new flag to the frontend.
This shouldn't change observable behavior of Clang on the driver level,
and only affects the frontend command line interface, which is an
implementation detail anyway.
2025-10-06 10:41:46 -07:00
Jan Svoboda
7b3d28573c
[clang] Use the VFS to get the unique file ID (#160936)
This PR uses the VFS to get the unique file ID when printing
externalized decls in CUDA instead of going straight to the real file
system. This matches the behavior of other input files of the compiler.
2025-09-26 14:54:03 -07:00
Jan Svoboda
37282bcee1
[clang] Load -fembed-offload-object= through the VFS (#160906)
This PR loads the path from `-fembed-offload-object=<path>` through the
VFS rather than going straight to the real file system. This matches the
behavior of other input files of the compiler. This technically changes
behavior in that `-fembed-offload-object=-` no longer loads the file
from stdin, but I don't think that was the intention of the original
code anyways.
2025-09-26 10:35:22 -07:00
Jan Svoboda
bf9b3a51e4
[clang] Load -fms-secure-hotpatch-functions-file= through the VFS (#160146)
This PR uses the correctly-configured VFS to load the file specified via
`-fms-secure-hotpatch-functions-file=`, matching other input files of
the compiler.
2025-09-22 10:06:52 -07:00
DanilaZhebryakov
324511b8dc
[PowerPC] fix float ABI selection on ppcle (#154773)
soft float ABI selection was not taking effect on little-endian powerPC
with embedded vectors (e.g. e500v2) leading to errors.
(embedded vectors use "extended" GPRs to store floating-point values,
and this caused issues with variadic arguments assuming dedicated
floating-point registers with hard-float ABI)
2025-09-18 15:26:12 -07:00
Anatoly Trosinenko
6bbf734eca
[FMV] Set default attributes on the resolver functions (#141573)
There is a number of attributes that is expected to be set on functions
by default. This patch implements setting more such attributes on the
FMV resolver functions generated by Clang. On AArch64, this makes the
resolver functions use the default PAC and BTI hardening settings.
2025-09-17 20:23:09 +03:00
Vitaly Buka
004f209199
[CodeGen][CFI] Generalize transparent union parameters (#158193)
According GCC documentation transparent union
calling convention is the same as the type of the
first member of the union.

C++ ignores attribute.

Note, it does not generalize args of function pointer args.
It's unnecessary with pointer generalization.
It will be fixed in followup patch.

---------

Co-authored-by: lntue <lntue@google.com>
2025-09-13 02:18:58 +00:00
Vitaly Buka
a5bff94ffd
[NFC][CodeGen][CFI] Add GeneralizePointers parameter to GeneralizeFunctionType (#158191)
For #158193

---------

Co-authored-by: Alex Langford <alangford@apple.com>
2025-09-13 00:13:35 +00:00
Vitaly Buka
8ac67aa8a9
[NFC][CFI][CodeGen] Move GeneralizeFunctionType out of CreateMetadataIdentifierGeneralized (#158190)
For #158193
2025-09-12 23:38:21 +00:00
Vitaly Buka
bac9e463b1
[NFC][CodeGen][CFI] Extract CreateMetadataIdentifierForFnType (#158189)
For #158193
2025-09-12 16:15:31 -07:00
Jan Svoboda
d1c0b1b620
[clang] Use VFS for -fopenmp-host-ir-file-path (#156727)
This is a follow-up to #150124. This PR makes it so that the
`-fopenmp-host-ir-file-path` respects VFS overlays, like any other input
file.
2025-09-11 09:08:47 -07:00