Commit graph

124988 commits

Author SHA1 Message Date
Matt Arsenault
3c3a18e239
clang: Store vendor GPU kinds in OffloadArch instead of re-listing GPUs (#213362)
OffloadArch was a flat enum that hand-duplicated every AMDGPU and NVPTX
target, plus a few edge cases. This was yet another place that needed
updating every time a new target is added, which should now be avoided.
Replace with a tagged union-like scheme.

Co-authored-by: Claude (Claude-Opus-4.8) <noreply@anthropic.com>
2026-08-01 06:14:04 +00:00
eoineoineoin
e89830da7f
Add option to format a whole file using git-clang-format (#204336)
Today, git-clang-format will only format lines which have been modified.
However, in some cases, that's not sufficient to get a "clean" file
which would be unmodified by running `clang-format` manually.

I've got a minimal repro using the default clang-format rules. Setup a
new git repository and create a commit with an empty file:

```
mkdir /tmp/bla
cd /tmp/bla
git init
touch t.cpp
git add t.cpp
git commit -m "V1"
```

Add a line to that file containing a comment:
```
echo "int x = 0; // Comment describing x" > t.cpp
git add t.cpp
git clang-format --staged # Reports "clang-format did not modify any files"
git commit -m "V2"
```

There's nothing wrong with this file yet, and it's working as expected.
Problem arises when we add a new line with a comment which is not
aligned with the comment we've already added:

```
echo "int longerThanX = 0; // Should cause above to become aligned" >> t.cpp
git add t.cpp
git clang-format --staged # Reports "clang-format did not modify any files"
```

git-clang-format didn't change the staged file here as it's only
inspecting the modified lines, but according to the default formatting
rules, this new line actually has an effect on the preceding line. i.e.,
if you run `clang-format t.cpp`, you'll see that whitespace is added
before the "Comment describing x" to align with the "Should cause..."

It's not limited to _just_ the preceding line (e.g. in the case where we
have multiple lines like the first with comments which become
unaligned,) so can't just add more lines of context to the diff. This PR
just adds an option to format the whole file, instead of just the
modified sections.
2026-07-31 22:22:14 -07:00
Zeyi Xu
037a0f40a8
[RISCV][MC] Add experimental Smcsps and Sscsps support (#211712)
Add experimental v0.19 support for the `Smcsps` and `Sscsps` conditional
stack pointer swap extensions.
2026-08-01 11:05:22 +08:00
Ayokunle Amodu
b0511699c3
[CIR][AMDGPU] Add support for AMDGCN ldexp builtins (#198087)
Adds support for the following AMDGCN ldexp builtins:

- __builtin_amdgcn_ldexp (double)
- __builtin_amdgcn_ldexpf (float)
- __builtin_amdgcn_ldexph (half)

These are lowered to the `llvm.ldexp` intrinsic.
2026-07-31 19:18:49 -04:00
Joseph Huber
a10e70b5d7
[NVPTX] Pass -Xcuda-ptxas to the nvlink wrapper for LTO (#213351)
Summary:
This allows `-foffload-lto -fgpu-rdc -Xcuda-ptxas` to work properly by
forwarding it.
2026-07-31 16:24:50 -05:00
Adam Smith
ec2bf56676
[Clang][Sema] Synthesize a memcpy body for defaulted union assignment (#206579)
A defaulted copy or move assignment operator for a union is synthesized
with an empty body. `DefineImplicitCopyAssignment` /
`DefineImplicitMoveAssignment` skip union members in the memberwise
loop, and the implied copy of the object representation has no AST
representation, a FIXME that has sat at that skip for a long time. The
operator ends up copying nothing.

Classic CodeGen hides this at ordinary call sites by lowering a trivial
assignment to a memcpy at the call site, so `u1 = u2` works even though
the operator body is a no-op. But when the operator is genuinely called,
through a pointer-to-member for instance, it silently copies nothing.
ClangIR calls the assignment operator at the call site rather than
eliding it, so it hits the empty body directly and drops every union
assignment. The no-op is then deleted at `-O3`. That is the MultiSource
`kc` miscompile, where a `YYSTYPE` union assignment (`*++yyvsp =
yylval`) becomes a no-op.

This implements the FIXME by mirroring the defaulted union copy
constructor (`CGClass.cpp`: "union copy constructor, we must emit a
memcpy") in the AST: when the class is a union,
`DefineImplicit{Copy,Move}Assignment` emits a single whole-object copy
through `buildMemcpyForAssignmentOp`, the helper already used for
trivially-copyable array members, instead of the skipped per-member
assignments. The operator stays trivial (triviality is fixed at
declaration time, before the body is synthesized), so constant
evaluation, which copies trivial unions through its own semantic path
and never executes the body, is unchanged.

Copying the object representation is correct even when a union member is
not trivially copyable, but the synthesized memcpy would then trip
`-Wnontrivial-memcall`. A `void*` cast would drop pointee qualifiers
such as the address space and inject an explicit cast node the source
never wrote. Instead the call keeps its typed union-pointer arguments,
and the union branch in `DefineImplicit{Copy,Move}Assignment` wraps the
build in `IgnoreAllWarningDiagRAII`, a save-and-restore around the
engine's existing ignore-all-warnings state. `CheckMemaccessArguments`
defers the warning and its note through `DiagRuntimeBehavior`, and that
queue flushes after the RAII has restored the previous ignore state, so
`DiagIfReachable` samples that state as it enqueues and drops what is
not error-class. Under `-w` the same queue is discarded before it
flushes, so nothing outside the scoped region changes.

Classic CodeGen now emits the copy when the operator is odr-used, and
ClangIR's union assignment lowers to a real memcpy. On the Sema side,
tests cover the synthesized AST for the implicit-`this` and C++23
explicit-object spellings, the `-Wnontrivial-memcall` suppression, the
preserved address space, the clean `-ast-print` output, and constexpr
active-member copy. The classic and ClangIR lowering is checked across
named, anonymous, and tail-padded unions.

#198918 added a defaulted-union `errorNYI` in ClangIR and deferred this
AST fix to a separate change. This PR makes that fix and drops the
guard, so the now-non-empty body lowers to a `cir.call @memcpy` instead
of erroring. Its own `union-copy-move-assignment.cpp` CIR test, which
expects that call, is the regression check.
2026-07-31 15:49:40 -05:00
Marlus Cadanus da Costa
68b7feaa62
[clang] Follow-up fixes for offsetof unsigned index change (#207808)
- Rename CastNoOverflow to CastAPToOffsetIndex for clarity
- Add parentheses in overflow guard condition in InterpBuiltin.cpp
- Improve comment explaining why 0x8000000000000000 is rejected

AI Tool Use: GitHub Copilot (Claude Sonnet 4.6) was used to assist in
identifying and drafting the fix. The fix was reviewed, tested, and
validated manually.

---------

Co-authored-by: Cadanus da Costa <maccosta@beenox.com>
2026-08-01 04:18:42 +08:00
Paulius Velesko
7ef0ca2b13
Reland "[HIPSPV] Add in-tree SPIR-V backend support for chipStar" (#213052)
Relands #206910 (reverted in #213088) with the fix for the breakage.

IsIntegratedBackendDefault() was tied to whether the SPIR-V backend is
registered, but it also controls whether clang collapses the compile and
backend
jobs, so builds without the SPIR-V target split every HIPSPV RDC device
compile
and failed hipspv-toolchain-rdc.hip. The default is back to the base
class value
and the translator fallback is decided in
constructLinkAndEmitSpirvCommand.
Third commit adds a test not guarded by spirv-registered-target.

Validated in X86;SPIRV and X86 only builds: driver tests pass in both,
and
non-RDC plus RDC (new driver) flows run for real emit spirv-val clean
modules
via the backend and via llvm-spirv respectively.
2026-07-31 15:23:48 -04:00
Ayokunle Amodu
00e7c3564c
[CIR][AMDGPU] Add support for AMDGCN tanh builtins (#197852)
Adds codegen for the following AMDGCN tanh builtins:

- __builtin_amdgcn_tanhf (float)
- __builtin_amdgcn_tanhh (half)
- __builtin_amdgcn_tanh_bf16 (bfloat16)

These are lowered to the corresponding `llvm.amdgcn.tanh` intrinsic.
2026-07-31 14:57:40 -04:00
Ayokunle Amodu
3ece94d8f3
[CIR][AMDGPU] Add support for AMDGCN trig_preop builtins (#197399)
Adds codegen for the following AMDGCN trigonometric pre-operation
builtins:

- __builtin_amdgcn_trig_preop (double)
- __builtin_amdgcn_trig_preopf (float)

These are lowered to the corresponding `llvm.amdgcn.trig.preop`
intrinsic.
2026-07-31 14:55:38 -04:00
Daniil Kovalev
2f8eb5b4be
[clang][llvm][AArch64] Set hardening fn attrs on synthetic functions (#211013)
Compiler-synthesized functions such as `__llvm_gcov_writeout`,
`__llvm_gcov_reset` and `__llvm_gcov_init` were previously never
receiving the AArch64 hardening function attributes (ptrauth-returns,
ptrauth-auth-traps, ptrauth-indirect-gotos and
aarch64-jump-table-hardening) since the attributes were only emitted by
Clang and gated by `PointerAuthOptions` structure's corresponding
fields. See `setPointerAuthFnAttributes` and
`initPointerAuthFnAttributes` member functions of `TargetCodeGenInfo`.

This patch resolves this in the same manner as #83153 does for several
other attributes. Particularly, Clang now emits corresponding 4 module
flags (conditionally on whether the related feature is enabled) with Max
behavior, and LLVM's `Function::createWithDefaultAttr` derives the
matching function attributes from them. Max behavior with conditional
emission is safe because none of these features affect ABI, so promoting
an absent flag on module merge cannot break compatibility.
2026-07-31 18:22:44 +00:00
Andy Kaylor
998ba43d74
[CIR] Implement fenv lowering to constrained intrinsic calls (#213105)
This change adds support for lowering floating-point operations with the
fenv attribute set to a call to the corresponding constrained intrinsic
when the operation is lowered to the LLVM dialect.

Generation of operations with the Fenv attribute set will be implemented
in a later change. This only adds support for lowering.

Assisted-by: Cursor / claude-opus-4.8
2026-07-31 11:21:35 -07:00
Tim
8225c81dbf
[flang][debug] Add compressed DWARF support in Flang (#212584)
Re-use most of the clang implementation for compressed DWARF support in
flang.

AI attribution: Co-developed with Claude Opus 4.6
2026-07-31 13:10:14 -05:00
Matt Arsenault
0aa3c9e671
AMDGPU: Add missing smem-prefetch-insts to gfx12.5/gfx13 feature map (#213297)
fillAMDGCNFeatureMap omitted smem-prefetch-insts for gfx125x and gfx13,
so clang wrongly rejected __builtin_amdgcn_s_prefetch_data / _inst /
s_buffer_prefetch_data.

Co-authored-by: Claude (Claude-Opus-4.8)
2026-07-31 17:29:31 +00:00
Vicky Nguyen
93da16b5ed
[CIR][AArch64] Upstream store (vstrq_p128) NEON builtins (#212677)
Related to https://github.com/llvm/llvm-project/issues/185382

CIR lowering for store intrinsics (`vstrq_p128`)
(https://arm-software.github.io/acle/neon_intrinsics/advsimd.html#store)

Port test from `clang/test/CodeGen/AArch64/poly128.c` to
`clang/test/CodeGen/AArch64/neon/store.c`
2026-07-31 10:27:34 -07:00
Matt Arsenault
bbbc3e4cc9
clang: Emit "float-abi" module flag (#212985)
Emit the new module flag if it differs from the triple's
default.

Co-authored-by: Claude (Claude-Opus-4.8) <noreply@anthropic.com>
2026-07-31 19:07:04 +02:00
Adam Smith
1fe55891a7
[CIR] Accept _BitInt up to 128 bits in x86_64 callconv lowering (#212668)
The x86_64 bridge in `CallConvLoweringPass.cpp` rejected every
`_BitInt`, so a function taking or returning one reported NYI even
though the ABI library already classifies these types. The classifier
has to be told the integer is bit-precise, and `mapCIRType` was dropping
that flag, which its two-eightbyte handling keys on. With the flag
forwarded, accepting widths up to 128 is mostly a matter of letting the
classifier's answer through. Wider widths stay rejected, for the reason
on the accept check.

Relaxing that check alone was not enough. `convertABIArgInfo` discarded
the classifier's coerce for every non-aggregate, which would have left a
`_BitInt(33)` as i33 where classic CodeGen passes i64. It now takes the
coercion path for a multi-register tuple coerce and for one wider than
the natural type. A narrower or equal coerce still means unchanged,
which is what preserves a `_BitInt(128)`'s 8-byte alignment.

Two `noundef` gaps against classic CodeGen remain. Neither mechanism is
new, but this change is what makes both reachable for `_BitInt`. CIRGen
omits the attribute for a width that is not a multiple of 8, and the
rewriter attaches none to the arguments it creates when flattening, so a
`_BitInt(72)` that CIRGen did mark loses it once the pair is split.
2026-07-31 11:20:43 -05:00
Matt Arsenault
d702abc258
AMDGPU: Add missing mqsad-insts to gfx13 frontend feature map (#213292)
fillAMDGCNFeatureMap omitted mqsad-insts for gfx1310/gfx13-generic, so
clang wrongly rejected __builtin_amdgcn_mqsad_u32_u8 on those targets
even though the backend enables the feature. Add it to the gfx13 case.

Co-authored-by: Claude (Claude-Opus-4.8)
2026-07-31 16:19:01 +00:00
Qiongsi Wu
6109006676
[clang][DependencyScanning] Relocate CompilerInstanceWithContext to DependencyScanningWorker.cpp (#211407)
This PR relocates all `CompilerInstanceWithContext` code to
`DependencyScanningWorker.cpp` and hides them as implementation details,
since no public APIs should use `CompilerInstanceWithContext` directly.

---

<sub>Stack created with <a
href="https://github.com/github/gh-stack">GitHub Stacks CLI</a> • <a
href="https://gh.io/stacks-feedback">Give Feedback 💬</a></sub>
2026-07-31 08:54:14 -07:00
Qiongsi Wu
5f4d725bca
[clang][DependencyScanning] Implement the Streaming Style By-name Scanning API (#211406)
This PR implements a streaming stype by-name scanning API. The new API
takes a `DependencyConsumer`, a `DiagnosticsConsumer` and a
`getNextName` lambda. Any diagnositcs flow to the `DependencyConsumer`,
and the results flows to to `DependencyConsumer`. The `getNextName`
lambda is allows the client to stream names into the API, and the API
keeps scanning dependencies for input names until `getNextName` does not
return more names.

rdar://178088113

---

<sub>Stack created with <a
href="https://github.com/github/gh-stack">GitHub Stacks CLI</a> • <a
href="https://gh.io/stacks-feedback">Give Feedback 💬</a></sub>
2026-07-31 08:54:13 -07:00
Rashmi Mudduluru
cb1642b6f9
[Webkit Checkers][SaferCpp] Detect implicit id-to-specific-type casts in MemoryUnsafeCastChecker (#213113)
Flag arguments of type `id` implicitly converted to a specific
Objective-C pointer type at a call, message send, or constructor call
(e.g. passing `id` where an `NSString *` parameter is expected). These
conversions compile without a visible cast but throw at runtime if the
object is not actually of that type.

rdar://148708396
2026-07-31 08:36:16 -07:00
Matt Arsenault
61b16cb275
AMDGPU: Do not give gfx12.5 bvh-ray-tracing-insts (#213246)
bvh-ray-tracing-insts was listed in the FeatureGFX12 generation, so
gfx1250/gfx1251/gfx12-5-generic inherited it even though they have no
BVH. Move the feature out of the common base and into FeatureISAVersion12.
This stops clang from wrongly accepting __builtin_amdgcn_image_bvh_intersect_ray*
on gfx1250.

Co-authored-by: Claude (Claude-Opus-4.8)
2026-07-31 17:23:42 +02:00
Balázs Benics
55923bf5df
[analyzer] Don't fold wide string literals in CStringChecker (#213281)
`getStringRefAtRegion()` read literal contents via
`StringLiteral::getBytes()`, which returns the literal's raw trailing
storage. For wide literals (`u""`, `U""`, `L""`) that storage holds the
code units in *host* byte order: `LiteralSupport` writes them through
`reinterpret_cast<UTF16*>/<UTF32*>`, and `StringLiteral::getCodeUnit()`
reads them back the same way. Interpreting those bytes as a target byte
string made the strchr-family constant folding depend on the endianness
of the machine running the analyzer.

Bail out on `getCharByteWidth() != 1`, matching the contract the rest of
the checker already relies on -- `evalStrcmpCommon()` uses
`getString()`, which asserts it. Wide literals now fall back to the
symbolic-offset path and keep both branches.

Fixes up #212124
Inspired from:
https://github.com/llvm/llvm-project/pull/212124#issuecomment-5143598098

Supersedes #213279
2026-07-31 15:01:14 +00:00
Nick Sarnie
3e65a09adc
[ClangLinkerWrapper][SPIRV] Fix embed bitcode option (#213137)
We need to pass the right linker option and not try to containerize it.

Fixes two OpenMP offload JIT tests, the other has some front end assert
I will look at.

Signed-off-by: Nick Sarnie <nick.sarnie@intel.com>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-31 14:49:09 +00:00
Matt Arsenault
b4efecb037
AMDGPU: Add missing msad-insts to gfx13 frontend feature map (#213122)
fillAMDGCNFeatureMap omitted msad-insts for gfx1310/gfx13-generic, so
clang wrongly rejected __builtin_amdgcn_msad_u8 on those targets even
though the backend enables the feature (FeatureGFX9 generation,
inherited through FeatureGFX13). Add it to the gfx13 case.

Co-authored-by: Claude (Claude-Opus-4.8)
2026-07-31 14:30:44 +02:00
PushkarSingh
0a1f0aafed
[clang][Analysis] Add argument accessors to clang::AnyCall (#212934)
Add APIs to `clang::AnyCall` for accessing expression-backed call
arguments.

`AnyCall` already exposes formal parameters through `parameters()`,
`param_begin()`, `param_end()`, `param_size()`, and `param_empty()`.
This adds the corresponding argument-side helpers:

- `arguments()`
- `arg_begin()`
- `arg_end()`
- `arg_size()`
- `arg_empty()`
- `getArg()`

This lets clients reuse `AnyCall` for callee/argument inspection instead
of
open-coding argument extraction.

Prequel PR to #206337
2026-07-31 13:06:52 +01:00
Matt Arsenault
dcce9de575
AMDGPU: Give v_cvt_sr_pk_bf16_f32 its own subtarget feature (#213150)
v_cvt_sr_pk_bf16_f32 was gated on bf16-cvt-insts, but that feature is
also present on gfx950 where the (non-sr) v_cvt_pk_bf16_f32 was first
added. The stochastic-rounding v_cvt_sr_pk_bf16_f32 was only added
for gfx1250 and has no gfx950 encoding, so it would mis-select and
later hit the "Invalid opcode" assert. Introduce
cvt-sr-pk-bf16-f32-inst, currently added to gfx13 and 125*

Co-authored-by: Claude (Claude-Opus-4.8)
2026-07-31 09:55:40 +00:00
Matt Arsenault
2b4f6c42a7
AMDGPU: Add missing mqsad-pk-insts to gfx13 frontend feature map (#213124)
fillAMDGCNFeatureMap omitted mqsad-pk-insts for gfx1310/gfx13-generic,
so clang wrongly rejected __builtin_amdgcn_mqsad_pk_u16_u8 on those 
targets even though the backend enables the feature. Add it to the gfx13 case.

Co-authored-by: Claude (Claude-Opus-4.8)
2026-07-31 08:26:34 +00:00
Benedek Kaibas
5eb876fcaf
[analyzer][NFC] Match the parameters order of getEndPath and finalizeVisitor with VisitNode (#212883)
Currently the ordering of the parameters in `getEndPath` and
`finalizeVisitor` functions does not match the declaration of the
`VisitNode` function. This PR resolves it by reordering the parameters
among these functions to be consistent.
2026-07-31 10:24:39 +02:00
Benedek Kaibas
28896ffcde
[analyzer][NFC] Add test cases for the lifetime test suite (#212254)
During the development of the lifetime checkers I had many important
test cases saved locally and were never imported to the test files of
the checkers. This PR adds those missing test cases to the test files.
By adding these test cases it helps tracking the state of the lifetime
checkers and what improvements they need in order to have better
coverage and reduce the false positive rate.

*AI policy*: During the development I have consulted with claude sonnet
5 to list me test case scenarios it thinks are useful and then reviewed
its feedback and implemented/wrote those test cases by myself. Since
some of the test cases are edge cases I wanted to make sure the
implementation is on the right track.
2026-07-31 10:15:28 +02:00
Timm Baeder
21b0fc84c2
[clang][bytecode][NFC] Remove redundant casts (#213210) 2026-07-31 09:45:37 +02:00
Timm Baeder
a3ae1e0a8d
[clang][bytecode][NFC] Enforce internal linkage (#213208)
For a struct and a function.
2026-07-31 09:43:16 +02:00
Timm Baeder
88fb1a93f4
[clang][bytecode][NFC] Use auto* if we can (#213209)
Instead of just auto.
2026-07-31 08:47:05 +02:00
Mariya Podchishchaeva
0312615e54
[clang][doc] Use my private email for now (#213058)
I'm in the middle of changing employers and will loose access to the
current email soon for a while.
2026-07-31 06:24:07 +00:00
Peter Rong
14192adddc
[clang][Sema] Fix ObjC file-scope literal diagnostic (#209688)
A non-constant ObjC collection literal used as a file-scope initializer
should get the targeted err_objc_literal_nonconstant_at_file_scope
pointing at the offending element. CheckForConstantInitializer instead
inspected the wrapped Init/Culprit, so under -fobjc-arc, for id-typed
variables, or with parentheses it skipped the per-element loop and fell
back to the generic "initializer element is not a compile-time constant"
on the whole @{...}/@[...] -- or blamed the wrong element (e.g. a valid
string key rather than the non-constant value).

Unwrap the culprit with IgnoreParenImpCasts and drive classification and
per-element reporting off it, mirroring BuildObjC{Array,Dictionary}Literal
(unwrap before each isa<>; keys must be string literals, values/elements
constant object literals). Also treat CK_ARCReclaimReturnedObject as
transparent in Expr::isConstantInitializer so ARC-wrapped literals are
recognized and the reported culprit is the literal itself.

Add objc-constant-literal-dict-key-restrictions.m (macOS no-ARC, iOS ARC,
ObjC++), with each culprit on its own line so -verify checks the caret.

[Assisted-by](https://t.ly/Dkjjk): Opus 4.8
2026-07-30 23:01:34 -07:00
Matt Arsenault
a7fa385ffa
AMDGPU: Add missing atomic-fmin-fmax-global to gfx13 feature map (#213119)
fillAMDGCNFeatureMap omitted atomic-fmin-fmax-global-f32 and
atomic-fmin-fmax-global-f64 for gfx1310/gfx13-generic, so clang wrongly
rejected the raw_ptr_buffer_atomic_f{min,max}_f{32,64} builtins on those
targets even though the backend enables the features. Add them to the
gfx13 case.

Co-authored-by: Claude (Claude-Opus-4.8)
2026-07-31 05:46:45 +00:00
Matt Arsenault
7fc8376323
AMDGPU: Add missing flat-global-insts to gfx13 frontend feature map (#213121) 2026-07-31 06:41:27 +02:00
Krisitan Erik Olsen
1ddfb94fa6
[Sema] Fix crash in __builtin_dump_struct with -Werror -Wformat-pedantic (#212377)
`DiagnosticErrorTrap::hasErrorOccurred()` treats warnings promoted to
errors by `-Werror` as real errors, causing `BuiltinDumpStructGenerator`
to bail out before building the `PseudoObjectExpr` wrapper. CodeGen then
encounters the untransformed `CallExpr` with a placeholder builtin type
and hits `llvm_unreachable` in `CodeGenTypes::ConvertType`.
Use `hasUnrecoverableErrorOccurred()` instead, which ignores `-Werror`
promoted warnings and only bails on genuine compilation errors.

Fixes #211943
2026-07-30 21:19:01 -07:00
Henry Jiang
08bfd2e3fd
[clang] perf_helper.py ignore clang warning/note when parsing cc1 command (#212401)
Parsing cc1 command fails in `perf_helper` when `clang: note:` or
`clang: warning:` due to driver warnings. As an example, harmless macOS
sdk mismatch and `-Wunused-command-line-argument`.
2026-07-30 20:41:19 -07:00
Yusuke MINATO
0142992aea
Reapply "[NFC][clang][Driver] Add tests for --driver-mode=flang" (#211724)
This reapplies #207658.

Some targets do not support flang_rt or clang_rt.
It seems difficult to create a blocklist, so the tests are now
configured to explicitly specify the known-working targets.
The specified targets are extracted from tests in flang/test/Driver.

-----
The original commit message:
This patch intends to clarify the current behaviors, not to state the
expected/desirable behaviors.
2026-07-31 09:56:12 +09:00
Akshay K
53e16d7708
[CIR] Pointer and vptr width from a CIR-native data-layout entry (#204185)
PointerType and VPtrType have hard-coded sizes and alignments of 64/8
bits. On targets with 32-bit pointers (e.g., nvptx, spirv32), this trips
the record layout builder. Any record containing a pointer hit the
insertPadding assertion (offset >= size)
because the pointer was sized at 8 bytes while the following field was
placed at the AST-mandated 4-byte offset.

 ### Changes:
- CIRGenerator: attaches a CIR-native cir.ptr data-layout entry at
module setup, storing {size-in-bits, abi-align-in-bits} read
  from the target DataLayout (only for the default address space).
- CIRTypes: PointerType reads its size/alignment from that entry
(falling back to 64/8 when absent); VPtrType routes through a cir.ptr so
it picks up the same width.
- LowerToLLVM: strips the cir.ptr entry during CIR→LLVM lowering, since
cir.ptr has no meaning in LLVM IR.
- Unit test: checking 4-byte pointer/vptr layout on nvptx, verified
across CIR, CIR→LLVM.
2026-07-30 16:50:13 -07:00
Erich Keane
06361fb2ef
[CIR] Implement most of 'musttail' statement attr (#213154)
This implements the basics, and leaves NYI in a few places (particularly
those that require cleanup calculations). There IS some additional work
that needs to be done when the ABI work is put in place as well, and the
thunk 'tail' hint isn't implemented either, and is left as a
missing-feature.

This is necessary for compiling the bytecode interpreter in Clang in a
few places during self-build.
2026-07-30 16:18:06 -07:00
johnnyb2543
2d0b45bc0a
[clang-format] Prevent re-assigning type on finalized tokens (#210763)
Prevents a finalized token inside modifyContext from being reassigned
through the setType member function by checking if the token is
finalized.

This ensures ill-defined code like does not trigger an assertion failure
during reformatting.
Fixes #210509
2026-07-30 21:28:08 +00:00
Qiongsi Wu
100e8df6fc
[clang][DependencyScanning] Extracting a Driver-free CompilerInstaneWithContext Initializer (#211405)
This PR extracts out an initializer of `CompilerInstanceWithContext`
that does not depend on any driver code in preperation of moving the
`CompilerInstanceWithContext` into `DependencyScanningWorker.cpp` as an
implementation detail that is not exposed by any APIs.

---

<sub>Stack created with <a
href="https://github.com/github/gh-stack">GitHub Stacks CLI</a> • <a
href="https://gh.io/stacks-feedback">Give Feedback 💬</a></sub>
2026-07-30 14:00:26 -07:00
Frank
cc0f33be52
[clang-format] Add SpacesInComments option for block comments (#204727)
Adds a new `SpacesInBlockComments` clang-format option to control
spacing after `/*` and before `*/` in ordinary block comments.

Supported values:

* Always: formats `/*comment*/` as `/* comment */`
* Never: formats `/* comment */` as `/*comment*/`
* Leave: preserves existing spacing

Documentation comments such as `/** ... */` and `/*! ... */`, and
parameter comments such as `/*Arg=*/`, are left unchanged.

Tests added for all option values, multiline block comments, and
excluded parameter/doc comments.

Addresses #160682
2026-07-30 22:49:21 +02:00
Zahira Ammarguellat
f0da3dd928
Revert "[OpenMP] Restore loop variable values after loop-transformation constructs. (#212853)" (#213127)
Revert "[OpenMP] Restore loop variable values after loop-transformation
constructs. (#212853)"

This reverts commit 2d697f8562.
 Reverting this PR. Bot is failing with:
    Failed Tests (2):
      libomptarget :: spirv64-intel :: offloading/target-tile.c
libomptarget :: x86_64-unknown-linux-gnu :: offloading/target-tile.c
2026-07-30 20:49:00 +00:00
Matt Arsenault
ff95a766e3
clang: Use proper error for unified shared memory openmp error (#212750)
Co-authored-by: Claude (Claude-Opus-4.8) <noreply@anthropic.com>
2026-07-30 19:53:25 +00:00
Matt Arsenault
1562871d41
clang: Use NVPTX TargetParser for OpenMP unified-addressing check (#212746)
processRequiresDirective enumerated every OffloadArch value in a switch
only to error on nvptx architectures older than sm_60. Replace it with
NVPTX::supportsUnifiedAddressing() applied to the parsed target CPU so
we don't need to keep adding cases here every time a new target is
added.

Co-authored-by: Claude (Claude-Opus-4.8) <noreply@anthropic.com>
2026-07-30 20:59:47 +02:00
Matt Arsenault
0e42c871c2
NVPTX: Add target names in TargetParser (#212734)
Track the canonical sm name and other target information.
This will eventually be used to reduce the pain of maintaining
OffloadArch in clang; all of the disjoint targets share an
enum which makes target specific covered switches annoying.

Co-authored-by: Claude (Claude-Opus-4.8) <noreply@anthropic.com>
2026-07-30 20:57:36 +02:00
Prabhu Rajasekaran
6162922a8d
Revert "[HIPSPV] Add in-tree SPIR-V backend support for chipStar" (#213088)
Reverts llvm/llvm-project#206910 
which broke buildbot:
https://lab.llvm.org/buildbot/#/builders/144/builds/60707
2026-07-30 18:37:52 +00:00