LLVM/project 52ae463clang/lib/Basic/Targets RISCV.cpp, clang/test/Preprocessor riscv-cf-protection-return.c

[Clang][RISCV] Loose the requirement of cf-protection=return to Zimop (#223671)
DeltaFile
+10-12clang/test/Preprocessor/riscv-cf-protection-return.c
+1-1clang/lib/Basic/Targets/RISCV.cpp
+11-132 files

LLVM/project 4126b9cclang/lib/AST/ByteCode Interp.h Compiler.cpp, clang/test/AST/ByteCode cxx14.cpp cxx26.cpp

[clang][bytecode] Use a special opcode for trivial defaulted copy/move operator calls (#222332)

The default code that clang synthesizes for them contains calls to
`__builtin_memcpy`, e.g. in

```
CXXMethodDecl 0x7d471ee7cc90 <array.cpp:1983:10> col:10 implicit used constexpr operator= 'array &(const array &) noexcept' inline default trivial external-linkage
|-ParmVarDecl 0x7d471ee7cdd0 <col:10> col:10 used 'const array &'
`-CompoundStmt 0x7d471ee7e340 <col:10>
  |-CallExpr 0x7d471ee7e268 <col:10> 'void *'
  | |-ImplicitCastExpr 0x7d471ee7e248 <col:10> 'void *(*)(void *, const void *, __size_t) noexcept' <BuiltinFnToFnPtr>
  | | `-DeclRefExpr 0x7d471ee7e160 <col:10> '<builtin fn type>' Function 0x7d471ee7de88 '__builtin_memcpy' 'void *(void *, const void *, __size_t) noexcept'
  | |-ImplicitCastExpr 0x7d471ee7e2b0 <col:10> 'void *' <BitCast>
  | | `-UnaryOperator 0x7d471ee7dd18 <col:10> 'int (*)[4]' prefix '&' cannot overflow
  | |   `-MemberExpr 0x7d471ee7dca0 <col:10> 'int[4]' lvalue ->_M_elems 0x7d471ee52780
  | |     `-CXXThisExpr 0x7d471ee7dc88 <col:10> 'array *' this
  | |-ImplicitCastExpr 0x7d471ee7e2d0 <col:10> 'const void *' <BitCast>
  | | `-UnaryOperator 0x7d471ee7db38 <col:10> 'const int (*)[4]' prefix '&' cannot overflow
  | |   `-MemberExpr 0x7d471ee7dac0 <col:10> 'const int[4]' lvalue ._M_elems 0x7d471ee52780

    [15 lines not shown]
DeltaFile
+66-8clang/lib/AST/ByteCode/Interp.cpp
+56-0clang/test/AST/ByteCode/cxx26.cpp
+29-16clang/lib/AST/ByteCode/InterpBuiltin.cpp
+39-3clang/lib/AST/ByteCode/Compiler.cpp
+9-20clang/lib/AST/ByteCode/Interp.h
+20-0clang/test/AST/ByteCode/cxx14.cpp
+219-476 files not shown
+253-5112 files

LLVM/project e94698bllvm/lib/Target/AMDGPU AMDGPUTargetMachine.cpp, llvm/test/CodeGen/AMDGPU llc-pipeline-npm.ll

[AMDGPU][GISel][NPM] Complete Global ISel pipeline (#222552)
DeltaFile
+979-476llvm/test/CodeGen/AMDGPU/llc-pipeline-npm.ll
+46-0llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp
+1,025-4762 files

LLVM/project dc795bdllvm/lib/Transforms/Vectorize VPlanTransforms.cpp

[VPlan] Remove (X && Y) | (X && !Y) -> X combine. NFC

We have smaller combines that can take care of this now that we process recipes in a worklist
DeltaFile
+1-8llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
+1-81 files

LLVM/project d67f8e1llvm/test/Transforms/LoopVectorize/RISCV tail-folding-complex-mask.ll

Precommit test
DeltaFile
+163-0llvm/test/Transforms/LoopVectorize/RISCV/tail-folding-complex-mask.ll
+163-01 files

LLVM/project 47a3ff3llvm/lib/Transforms/Vectorize LoopVectorizationPlanner.h VPlanTransforms.cpp, llvm/test/Transforms/LoopVectorize/RISCV tail-folding-complex-mask.ll

[VPlan] Append recipes created via builder to worklist

The previous PR appended the top most created recipe to the worklist, and this PR extends it to any other nested recipes that were created, similar to InstCombine.

This removes the header mask in a good few more places on RISC-V as measured on SPEC CPU 2017, e.g. for the following loop:

```c
long f(const int *p, const int *q, long n) {
  long a = 0, b = 0;
  for (long i = 0;; i++) {
    if (p[i] && q[i]) { a += i; b += i; }
    if (i + 1 == n) break;
  }
  return a + b;
}
```

Before:


    [49 lines not shown]
DeltaFile
+26-8llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
+11-4llvm/lib/Transforms/Vectorize/LoopVectorizationPlanner.h
+5-7llvm/test/Transforms/LoopVectorize/RISCV/tail-folding-complex-mask.ll
+42-193 files

LLVM/project 05da97dllvm/lib/Target/AArch64 AArch64TargetMachine.cpp

AArch64: Avoid createDataLayout just to check endianness

The endianness can be checked from the triple, avoiding a datalayout
copy.
DeltaFile
+2-2llvm/lib/Target/AArch64/AArch64TargetMachine.cpp
+2-21 files

LLVM/project 3973230llvm/lib/CodeGen InterleavedLoadCombinePass.cpp, llvm/test/CodeGen/AArch64 interleaved-load-combine-crossblock.ll

[InterleavedLoadCombine] Do not combine loads across basic blocks (#223915)

This pass turns a group of interleaved loads into a single wide load
inserted at the first load. That is only valid when all of the loads are
in the same basic block. Otherwise the wide load can read memory that
the original program only accessed on a conditional path.

The offset index keyed candidates on base pointer, type and offset only,
so it could pair loads from different blocks. Restrict each block's
matching to candidates whose loads are in that block. This also keeps
the candidate list and index per block, so they stay small.

Fixes a miscompile introduced by #213053.
DeltaFile
+50-0llvm/test/CodeGen/AArch64/interleaved-load-combine-crossblock.ll
+17-9llvm/lib/CodeGen/InterleavedLoadCombinePass.cpp
+67-92 files

LLVM/project 4beeff3clang/lib/CodeGen CodeGenModule.cpp, clang/test/CodeGen/LoongArch target-abi-module-flag.c

[clang][LoongArch] Emit "target-abi" module flag (#223647)

The LoongArch backend reads the ABI from the "target-abi" module flag,
but clang only emits that flag for ARM, PowerPC and RISC-V. Since LTO code
generation doesn't see the -target-abi option passed to clang, it falls
back to the default ABI of the target, which is lp64d for
loongarch64-unknown-elf, regardless of the ABI the code was compiled for.

When an FPU is enabled, this silently miscompiles code built for another
ABI. For example, with -mabi=lp64s, functions get the lp64d calling
convention after LTO, passing and returning floating-point values in FP registers 
instead of general-purpose ones, and the output is marked as double-float. Nothing
reports this if every object goes through LTO. For instance, a shared library
built this way links without error, and so does lp64s code built without LTO that
uses it. Without an FPU, the generated code keeps the soft-float calling
convention, but the output is still marked as double-float.

The mismatch only shows up as an error when LTO output is linked
together with relocatable objects built without LTO, which LLD rejects with "cannot

    [15 lines not shown]
DeltaFile
+21-0clang/test/CodeGen/LoongArch/target-abi-module-flag.c
+4-5clang/lib/CodeGen/CodeGenModule.cpp
+25-52 files

LLVM/project 21a77e7llvm/test/CodeGen/AArch64 sve-bf16-converts.ll sve-bf16-reductions.ll

[LLVM][CodeGen][SME] Don't use non-streaming zeroing instruction when in streaming mode. (#222353)

When selecting scalable vector bf16-f32 converts we emit zip(0,vec).
Unfortunately, the typical zero-latency zeroing instruction is not
available when in streaming mode.

(cherry picked from commit 9679fbfea993cb2e815fe0fa5eefde310f917349)
DeltaFile
+538-260llvm/test/CodeGen/AArch64/sve-bf16-compares.ll
+265-130llvm/test/CodeGen/AArch64/sve-bf16-arith.ll
+177-86llvm/test/CodeGen/AArch64/sve-bf16-rounding.ll
+176-84llvm/test/CodeGen/AArch64/sve-bf16-int-converts.ll
+105-50llvm/test/CodeGen/AArch64/sve-bf16-reductions.ll
+25-9llvm/test/CodeGen/AArch64/sve-bf16-converts.ll
+1,286-6191 files not shown
+1,297-6217 files

LLVM/project 3c3c37ecompiler-rt/lib/interception interception_win.cpp, compiler-rt/lib/interception/tests interception_win_test.cpp

[win/asan] GetInstructionSize: Add some more instructions. (#219038)

These got reported in #96270.

- Allow "0F B6 44 24 XX : movzx eax, byte ptr [esp + XX]" for x86 and
x86_64.
- Add "0F B6 4C 24 XX : movzx ecx, byte ptr [esp + XX]"
- Add "4F 8D 0C XX : lea r9, [...]"
- Add "66 83 3A XX : cmp word ptr [rdx], XX"
- Add "85 D2 : test edx, edx"
- Add "8D 44 24 XX : lea eax, [esp + XX]"
- Add "F3 0F 1E FA : endbr64"
- Add "F3 0F 1E FB : endbr32"

(cherry picked from commit 7fd0dd89cf63bd363b7884232202fa958ccc974a)
DeltaFile
+9-5compiler-rt/lib/interception/interception_win.cpp
+8-1compiler-rt/lib/interception/tests/interception_win_test.cpp
+17-62 files

LLVM/project 5a0c86allvm/test/CodeGen/AMDGPU/GlobalISel and-vgpr-s32.ll regbankselect-sext.mir

[AMDGPU] Fix GlobalISel VGPR-to-VCC lowering types (#220987)

Register-bank legalization synthesized an untyped G_AND s32, but
instruction-selection patterns only matched typed G_AND i32, causing:

```
LLVM ERROR: cannot select: %:vgpr_32(s32) = G_AND ...
```

The source-level and i32 was valid; the incorrect type was introduced by
AMDGPU `VgprToVccCopy` lowering. SelectionDAG was unaffected because it
retained typed DAG nodes.

Assisted-by: Codex

---------

Signed-off-by: Keshav Vinayak Jha <keshavvinayakjha at gmail.com>
DeltaFile
+21-19llvm/test/CodeGen/AMDGPU/GlobalISel/regbankselect-and-s1.mir
+17-17llvm/test/CodeGen/AMDGPU/GlobalISel/regbankselect-zext.mir
+16-16llvm/test/CodeGen/AMDGPU/GlobalISel/regbankselect-brcond.mir
+16-16llvm/test/CodeGen/AMDGPU/GlobalISel/regbankselect-anyext.mir
+15-15llvm/test/CodeGen/AMDGPU/GlobalISel/regbankselect-sext.mir
+28-0llvm/test/CodeGen/AMDGPU/GlobalISel/and-vgpr-s32.ll
+113-8313 files not shown
+186-15019 files

LLVM/project f7cc8c8llvm/include/llvm/CodeGen SlotIndexes.h, llvm/lib/CodeGen SlotIndexes.cpp

AMDGPU: Maintain LiveIntervals when removing blocks in SILowerControlFlow (#223642)

removeMBBifRedundant removed a redundant block's instructions from the
LiveIntervals maps but not the block itself, leaving a stale idx2MBBMap
entry that crashed getMBBFromIndex in the verifier.

Add SlotIndexes::removeMBBFromMaps to drop the erased block's slot
range, and recompute the intervals that spanned it.

Co-authored-by: Claude claude-opus-4.8 <noreply at anthropic.com>
DeltaFile
+95-0llvm/test/CodeGen/AMDGPU/si-lower-control-flow-remove-redundant-block-liveintervals.mir
+23-0llvm/lib/CodeGen/SlotIndexes.cpp
+16-0llvm/lib/Target/AMDGPU/SILowerControlFlow.cpp
+5-0llvm/include/llvm/CodeGen/SlotIndexes.h
+139-04 files

LLVM/project 2ab3288llvm/test/tools/llubi intr_experimental_vector.ll, llvm/tools/llubi/lib Interpreter.cpp

Update llubi
DeltaFile
+4-2llvm/tools/llubi/lib/Interpreter.cpp
+1-1llvm/test/tools/llubi/intr_experimental_vector.ll
+5-32 files

LLVM/project d03ed6dllvm/test/tools/llubi intr_experimental_vector.ll

Precommit llubi test
DeltaFile
+2-0llvm/test/tools/llubi/intr_experimental_vector.ll
+2-01 files

LLVM/project 10c3714llvm/lib/Target/RISCV RISCVInstrInfo.h

[RISCV] Do not verify size for some Xqci instructions (#223913)

After instruction size verification was enabled by default in
https://github.com/llvm/llvm-project/pull/221687/ we were running into
crashes for certain 48-bit Xqci instructions. This was happening because
we have compress patterns for these 48-bit instructions to compress them
into 32-bit instructions which `getInstSizeInBytes` was not taking into
account.

The crash looks like:

```
Size mismatch for: QC_E_SW $x0, $x14, 0 :: (store (s32) into %stack.0)
Expected maximum size: 2
Actual size: 4
```

Do not verify size for such instructions until we can return the correct
size for them.
DeltaFile
+37-0llvm/lib/Target/RISCV/RISCVInstrInfo.h
+37-01 files

LLVM/project 6e180eallvm/lib/Target/AMDGPU SIOptimizeVGPRLiveRange.cpp, llvm/test/CodeGen/AMDGPU si-opt-vgpr-liverange-bug-deadlanes.mir opt-vgpr-live-range-verifier-error.mir

AMDGPU: Use LiveIntervals in SIOptimizeVGPRLiveRange when available (#222385)

LiveVariables has been long deprecated. Use LiveIntervals if available.
With the current pass structure, this will use LiveVariables.

Co-authored-by: Claude (Claude-Opus-4.8)
DeltaFile
+106-49llvm/lib/Target/AMDGPU/SIOptimizeVGPRLiveRange.cpp
+2-0llvm/test/CodeGen/AMDGPU/si-opt-vgpr-liverange-bug-deadlanes.mir
+2-0llvm/test/CodeGen/AMDGPU/opt-vgpr-live-range-verifier-error.mir
+110-493 files

LLVM/project dd58c11llvm/include/llvm/IR DebugInfoMetadata.h DebugInfo.h, llvm/lib/IR LLVMContextImpl.h Verifier.cpp

[IR] Simplify DIAssignID by storing its links in the node. NFC (#223324)

AssignmentTrackingPass generates DIAssignID metadata. A DIAssignID links
the instructions it is attached to, kept in
LLVMContextImpl::AssignmentIDToInstrs, with the dbg_assign records that
refer to it, found through a permanent use list (#78300 made DIAssignID
the only always-replaceable MDNode for this). Keep both lists in the
node as TinyPtrVector members instead (98% of instruction lists and
88-96% of record lists hold exactly one pointer), and drop the map and
`isAlwaysReplaceable()`.

Aided by Opus 5
DeltaFile
+22-40llvm/lib/IR/Metadata.cpp
+3-13llvm/lib/IR/DebugInfo.cpp
+11-4llvm/include/llvm/IR/DebugInfo.h
+10-3llvm/include/llvm/IR/DebugInfoMetadata.h
+3-5llvm/lib/IR/Verifier.cpp
+0-5llvm/lib/IR/LLVMContextImpl.h
+49-703 files not shown
+55-759 files

LLVM/project 76bb77ellvm/lib/Target/RISCV RISCVISelLowering.h, llvm/test/CodeGen/RISCV/rvv pr83017.ll pr90559.ll

[RISCV] Merge zeroing stores into wider LMUL vector stores (#223908)

memset lowers to LMUL1 vector stores (v2i64 for e64) that we rely on
store merging to widen. `storeOfVectorConstantIsCheap` counted the
number of MemVT-sized stores, so a v2i64 MemVT needed 4 stores before
merging kicked in, leaving two VL=2 m1 stores for a 32B zero region.

Use the total element count for zeroing stores so two v2i64 stores
merge into one VL=4 e64 m2 store.

Partially fixes #223906

Assisted-by: TRAE CLI (Opus 4.8)
DeltaFile
+16-34llvm/test/CodeGen/RISCV/rvv/memset-inline.ll
+12-2llvm/lib/Target/RISCV/RISCVISelLowering.h
+4-6llvm/test/CodeGen/RISCV/rvv/pr90559.ll
+3-5llvm/test/CodeGen/RISCV/rvv/pr83017.ll
+35-474 files

LLVM/project 8d6f414llvm/lib/Target/AArch64 SVEShuffleOpts.cpp

AArch64: Avoid depending on createDataLayout in a pass (#223776)

This should read directly from the context IR's module.
DeltaFile
+7-6llvm/lib/Target/AArch64/SVEShuffleOpts.cpp
+7-61 files

LLVM/project 3b42a54llvm/test/CodeGen/AArch64 misched-postra-only1.mir

[MISched] Remove verify-machineinstrs from test(NFC) (#223679)
DeltaFile
+6-6llvm/test/CodeGen/AArch64/misched-postra-only1.mir
+6-61 files

LLVM/project 3b8ee89llvm/lib/Analysis MustExecute.cpp, llvm/test/Analysis/MustExecute no-preheader.ll

[MustExecute] Use the loop predecessor instead of the preheader (#222096)

CanProveNotTakenFirstIteration() gets the IV start value via
LHS->getIncomingValueForBlock(CurLoop->getLoopPreheader()). If the loop
is not in simplified form, getLoopPreheader() returns null and the
lookup asserts. This is reachable from print<must-execute> on IR that is
not in LoopSimplify form (see the reproducer in #166488).

Fixed: use getLoopPredecessor() instead: it returns the unique
out-of-loop predecessor of the header even when it is not a dedicated
preheader, consequently the start value is still known. If there is no
such predecessor, bail out.

Fixes #166488.
DeltaFile
+33-0llvm/test/Analysis/MustExecute/no-preheader.ll
+8-1llvm/lib/Analysis/MustExecute.cpp
+41-12 files

LLVM/project 2b7c382llvm/docs LangRef.md, llvm/lib/Analysis ConstantFolding.cpp

[IR][InstSimplify] Clarify poison elements in cttz.elts results in poison

The generic expansion for cttz.elts in LegalizeVectorOps is

    (reduce.umax (select input, step_vector, 0))

Because reductions produce poison if any element is poison, this will also produce poison.

ConstantFolding currently has short circuiting behaviour, e.g. `cttz.elts <0, 1, poison, poison> -> 1`, but we should probably make this consistent with reductions and just return poison. This updates LangRef and ConstantFolding to be more explicit about this.
DeltaFile
+2-2llvm/test/Transforms/InstSimplify/ConstProp/cttz-elts.ll
+2-1llvm/lib/Analysis/ConstantFolding.cpp
+1-0llvm/docs/LangRef.md
+5-33 files

LLVM/project 94a0c83llvm/lib/CodeGen/GlobalISel IRTranslator.cpp, llvm/lib/Target/PowerPC PPCRegisterInfo.cpp

CodeGen: Replace some getPointerRegClass() uses with operand reg classes

Try to take the register class from the contexual instruction begin emitted
instead. This is a step towards fully replacing PointerLikeRegClass with
RegClassByHwMode.

Co-authored-by: Claude (Opus 4.8) <noreply at anthropic.com>
DeltaFile
+3-2llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp
+1-3llvm/lib/Target/PowerPC/PPCRegisterInfo.cpp
+2-2llvm/lib/Target/WebAssembly/WebAssemblyRegisterInfo.cpp
+2-2llvm/lib/Target/WebAssembly/WebAssemblyFrameLowering.cpp
+8-94 files

LLVM/project 1c1edc2lldb/source/Host CMakeLists.txt, lldb/source/Host/common Host.cpp

[lldb] Support building lldbHost under Emscripten (#223206)

This builds on the new `HostInfoEmscripten` and `PlatformEmscripten`
support.

Emscripten provides many POSIX APIs, but it does not support `fork` or
native host process management. This patch allows `lldbHost` to build
under Emscripten without treating it as Linux.

It:

- avoids building the `ProcessLauncherPosixFork` implementation;
- adds a small Emscripten Host implementation;
- reports process enumeration, process lookup, launching and shell
expansion as unsupported.

The remaining generic POSIX Host functionality continues to be used.

This is enough for the current libLLDB and SB API experiment, while live
process debugging will be handled separately once we have an in-browser
execution backend.
DeltaFile
+29-0lldb/source/Host/emscripten/Host.cpp
+7-1lldb/source/Host/CMakeLists.txt
+3-3lldb/source/Host/common/Host.cpp
+39-43 files

LLVM/project d3e5f97llvm/lib/Target/RISCV RISCVInstrInfoXTHead.td, llvm/lib/Target/RISCV/Disassembler RISCVDisassembler.cpp

[RISCV] Replace decodeImmThreeOperand/decodeImmFourOperand with a template function. NFC (#223924)

Make the immediate a template argument that we can be provided in the
DecoderMethod name.
DeltaFile
+3-8llvm/lib/Target/RISCV/Disassembler/RISCVDisassembler.cpp
+2-2llvm/lib/Target/RISCV/RISCVInstrInfoXTHead.td
+5-102 files

LLVM/project 1aad4c9clang/test/CodeGen/AArch64/sve dup.c, clang/test/CodeGen/AArch64/sve-intrinsics acle_sve_dup.c

[clang][AArch64] Consolidate codegen tests for SVE's DUP intrinsics

This patch completes the migration of the tests from:

* clang/test/CodeGen/AArch64/sve-intrinsics/acle_sve_dup.c

to:

* clang/test/CodeGen/AArch64/sve/dup.c

`dup.c` covers all the cases previously tested by `acle_sve_dup.c`.
However, unlike `acle_sve_dup.c`, it was only tested as C. Add `-x c++`
RUN lines to provide the equivalent C++ coverage, including lowering
via CIR.
DeltaFile
+0-1,130clang/test/CodeGen/AArch64/sve-intrinsics/acle_sve_dup.c
+146-80clang/test/CodeGen/AArch64/sve/dup.c
+146-1,2102 files

LLVM/project 54e36c8clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/zvzip/policy/non-overloaded vzip.c vunzipo.c, clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/zvzip/policy/overloaded vzip.c vunzipo.c

[RISCV] Update Zvzip support to v0.3 (#210603)

This updates the experimental Zvzip implementation to match the
v0.3 draft specification from RISC-V ISA manual PR:

https://github.com/riscv/riscv-isa-manual/pull/3233

In Zvzip 0.3, `vtype` and `vl` describe the destination vector for all
five instructions:

- `vzip.vv` produces a destination with EMUL=LMUL from two source
   operands with EMUL=LMUL/2. Its mask is indexed by destination
   elements and therefore has the mask type associated with the result
   vector. The overlap rule of `vzip.vv` matches widening vector
   arithmetic instructions;
  
- `vunzipe.v` and `vunzipo.v` produce a destination with EMUL=LMUL
   from a source operand with EMUL=2*LMUL. 


    [17 lines not shown]
DeltaFile
+145-1,729clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/zvzip/policy/overloaded/vunzipo.c
+145-1,729clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/zvzip/policy/overloaded/vunzipe.c
+145-1,729clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/zvzip/policy/non-overloaded/vunzipo.c
+145-1,729clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/zvzip/policy/non-overloaded/vunzipe.c
+868-871clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/zvzip/policy/overloaded/vzip.c
+868-871clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/zvzip/policy/non-overloaded/vzip.c
+2,316-8,65861 files not shown
+9,082-18,55867 files

LLVM/project 5835ef2clang/include/clang/AST Decl.h, clang/lib/AST Decl.cpp ItaniumMangle.cpp

[clang] Fix Itanium mangler crash on lambdas in top-level statements (#217041)

`clang-repl` asserts when a lambda in a top-level statement needs a
mangled name, for example `ns::call([]{});`. Since #84150 a
`TopLevelStmtDecl` is a `DeclContext`, and `manglePrefix` casts it to
`NamedDecl`.

Treat `TopLevelStmtDecl` as a local container and give it a synthesized
internal encoding (`L9__stmt__0v`), like `Ub_` for block literals.
Entities in a top-level statement then mangle as `<local-name>`s with
discriminators, so same-named locals in two statements do not collide.
Each `TopLevelStmtDecl` gets an ordinal at creation, in parse order; it
is serialized.

Tests: `Interpreter/lambda-top-level-stmt.cpp` (crashes without the fix)
and `CodeGenCXX/top-level-stmt-local-names.cpp` (two lambdas, two
same-named local classes). The interpreter test is `UNSUPPORTED:
system-windows`: MSVC compat enables `-fdelayed-template-parsing`, and
clang-repl asserts on any late-parsed template in a later fragment,

    [2 lines not shown]
DeltaFile
+20-0clang/test/Interpreter/lambda-top-level-stmt.cpp
+18-0clang/test/CodeGenCXX/top-level-stmt-local-names.cpp
+12-1clang/lib/AST/ItaniumMangle.cpp
+3-1clang/lib/AST/Decl.cpp
+4-0clang/lib/Serialization/ASTReaderDecl.cpp
+3-0clang/include/clang/AST/Decl.h
+60-22 files not shown
+64-28 files

LLVM/project 36bae08clang/lib/CodeGen TargetInfo.cpp TargetInfo.h, clang/lib/CodeGen/TargetBuiltins NVPTX.cpp

[clang][NVPTX] Emit !atomic.ignore.denormal.mode for CUDA atomics

CUDA's atomicAdd() family is defined in terms of PTX atom.add, whose
denormal behavior is fixed by the hardware. Without any annotation the
backend has to assume the function's denormal mode must be honored and
expands these into CAS loops whenever the two disagree. Mark them with
!atomic.ignore.denormal.mode so the native instruction is used.

That covers the __nvvm_atom_*_add_gen_f builtins that atomicAdd(),
atomicAdd_block() and atomicAdd_system() are written in terms of, plus
C11/C++11 atomics under -fatomic-ignore-denormal-mode and the
[[clang::atomic(ignore_denormal_mode)]] attribute, which requires
teaching the NVPTX target about AtomicOptions.

The condition for when the metadata is meaningful is now shared with the
AMDGPU and SPIR-V targets in addAtomicIgnoreDenormalModeMetadata(). It
takes an AllowHalf flag because whether f16 denormals are observable is
target specific: PTX exposes no FTZ control for f16 operations, so
atom.add.f16 never flushes and the opt-in is meaningful there, whereas

    [3 lines not shown]
DeltaFile
+321-0clang/test/CodeGenCUDA/atomic-ignore-denormal-mode-nvptx.cu
+19-4clang/lib/CodeGen/TargetBuiltins/NVPTX.cpp
+18-0clang/lib/CodeGen/TargetInfo.h
+15-0clang/lib/CodeGen/TargetInfo.cpp
+12-0clang/lib/CodeGen/Targets/NVPTX.cpp
+2-4clang/lib/CodeGen/Targets/SPIR.cpp
+387-85 files not shown
+402-1711 files