LLVM/project e44fff5 — clang/lib/AST DeclBase.cpp, clang/lib/Interpreter IncrementalParser.cpp

[clang-repl] Undo the enumerators of an unscoped enumeration (#228370)

The enumerators of an unscoped enumeration are in the lookup table of
the enclosing context. Undoing the input that declared the enumeration
removed the enumeration, but its enumerators stayed visible:

```
clang-repl> enum E { Red };
clang-repl> %undo
clang-repl> int Red = 5;
error: redefinition of 'Red' as different kind of symbol
```

`ASTDeclUnmerger` now also visits the declarations of an undone
enumeration definition.

**Test:** new lit test `code-undo-enumerators.cpp` with three cases: an
enumerator reused as a variable, an enumeration redefined, and an
enumeration in a namespace. It checks printed values only, not

    [7 lines not shown]
DeltaFile
+29-0clang/test/Interpreter/code-undo-tag-members.c
+25-0clang/test/Interpreter/code-undo-enumerators.cpp
+14-6clang/lib/AST/DeclBase.cpp
+6-0clang/lib/Interpreter/IncrementalParser.cpp
+74-64 files

LLVM/project 1987483 — clang/lib/Sema SemaLifetimeSafety.h, clang/test/Sema/LifetimeSafety safety.cpp

[LifetimeSafety] Look through parentheses when reporting alias chain notes
DeltaFile
+13-3clang/lib/Sema/SemaLifetimeSafety.h
+1-3clang/test/Sema/LifetimeSafety/safety.cpp
+14-62 files

LLVM/project 3aec233 — mlir/include/mlir/Dialect/NVGPU/Transforms Transforms.h, mlir/lib/Dialect/NVGPU/Transforms OptimizeSharedMemory.cpp

[mlir][nvgpu] Expose which memrefs optimize-shared-memory can swizzle (NFC) (#237180)

Extract checks on a memref's type out of
`optimizeSharedMemoryReadsAndWrites` into a new public function,
`canSwizzleSharedMemoryType`. The function would be helpful for prior
passes to reason about optimization decisions based on whether it is a
valid swizzling candidate.

Assisted-by: Claude
DeltaFile
+23-19mlir/lib/Dialect/NVGPU/Transforms/OptimizeSharedMemory.cpp
+7-0mlir/include/mlir/Dialect/NVGPU/Transforms/Transforms.h
+30-192 files

LLVM/project e3f9a6e — compiler-rt/test/asan/TestCases/Linux stack-overflow-recovery-mode.cpp

[ASan][test] Mark Linux/stack-overflow-recovery-mode.cpp UNSUPPORTED on Android AArch64 (#240097)

Temporarily mark `TestCases/Linux/stack-overflow-recovery-mode.cpp`
unsupported on Android AArch64 while waiting for #236879, matching
#236884 (https://lab.llvm.org/buildbot/#/builders/186/builds/4079).

Assisted-by: Gemini
DeltaFile
+5-0compiler-rt/test/asan/TestCases/Linux/stack-overflow-recovery-mode.cpp
+5-01 files

LLVM/project 88a56ff — llvm/include/llvm/ADT SmallPtrSet.h, llvm/lib/CodeGen/SelectionDAG ScheduleDAGSDNodes.cpp

[ADT] Add LLVM_ATTRIBUTE_WARN_UNUSED to SmallPtrSet (#240080)

This patch adds LLVM_ATTRIBUTE_WARN_UNUSED to SmallPtrSet so that
compilers can diagnose unused SmallPtrSet variables even though
SmallPtrSet has a non-trivial constructor and destructor.

This patch also addresses the existing warnings uncovered by the
attribute:

- ScheduleDAGSDNodes::BuildSchedUnits had an unused local variable
  Visited, which this patch removes.
- SmallPtrSetTest.cpp intentionally leaves Other unused in two move
  tests, so this patch marks Other with [[maybe_unused]].

Assisted-by: Antigravity
DeltaFile
+2-2llvm/unittests/ADT/SmallPtrSetTest.cpp
+1-2llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp
+1-1llvm/include/llvm/ADT/SmallPtrSet.h
+4-53 files

LLVM/project 376f682 — compiler-rt/test/asan/TestCases/Linux stack-overflow-recovery-mode.cpp

[spr] update

Created using spr 2.0.0-beta.2
DeltaFile
+5-0compiler-rt/test/asan/TestCases/Linux/stack-overflow-recovery-mode.cpp
+5-01 files

LLVM/project ff5dd66 — clang/lib/Lex PPExpressions.cpp

[clang][Lex][NFC] Simplify macro expansion state restoration (#239918)

Replace the repeated restoration assignments with `llvm::scope_exit`.
DeltaFile
+3-10clang/lib/Lex/PPExpressions.cpp
+3-101 files

LLVM/project f33894c — llvm/lib/Transforms/IPO FunctionImport.cpp, llvm/unittests/IR ConstantRangeTest.cpp

[LLVM] FIx fallout from #239908 (#240096)

The original patch added LLVM_ATTRIBUTE_WARN_UNUSED to some ADT classes,
which caused some more -Wunused-variable warnings under release builds
(that optimize out asserts).

https://lab.llvm.org/buildbot/#/builders/228/builds/17397
DeltaFile
+4-4llvm/unittests/IR/ConstantRangeTest.cpp
+1-2llvm/utils/TableGen/DAGISelMatcherOpt.cpp
+1-1llvm/lib/Transforms/IPO/FunctionImport.cpp
+6-73 files

LLVM/project 04284b5 — clang/lib/Sema SemaTemplateInstantiateDecl.cpp

[clang][Sema][NFC] Share member template instantiation lookup (#239450)

Use `RedeclarableTemplateDecl` to consolidate the identical
`isInstantiationOf` implementations for class and function templates,
leaving the other overloads unchanged.

I initially considered turning these helpers into a function template,
but the declaration types use different accessors, such as
`getInstantiatedFromMemberTemplate()` and `getInstantiatedFromMember()`.

I'd also like to discuss whether a function template would be preferable
here, although that would likely require a broader change.
DeltaFile
+2-15clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
+2-151 files

LLVM/project f48b069 — llvm/utils/TableGen DAGISelMatcherOpt.cpp

[TableGen] Fix -Wunused-variable after #239908 (#240095)
DeltaFile
+1-0llvm/utils/TableGen/DAGISelMatcherOpt.cpp
+1-01 files

LLVM/project 00dd9b8 — llvm/lib/Target/BPF BPFUnwind.cpp, llvm/test/Assembler invoke-bpf-unwind-exit.ll

BPF: Stop lowering unwinding through nonexistent unwinder calls (#239899)

BPF borrowed the DWARF EH pipeline in an unsound way. DwarfEHPrepare
turned resume into a call of _Unwind_Resume, which will never be
linked in. BPFUnwindLower later replaced it, and calls of
_Unwind_RaiseException, by matching callee names after register
allocation. This fixes the pass pipeline relying on these transient
calls to phantom functions.

Instead add an invokable llvm.bpf.unwind.exit intrinsic, similar to
wasm's throw intrinsics. BPFUnwindPrepare replaces resume with it so
no impossible call to _Unwind_Resume reaches selection.

The intrinsic selects to a pseudo which BPFUnwindLower turns into
either unwind_exit or a branch to the landing pad when invoked. The
pseudo clobbers nothing, so register allocation can be more aggressive
than when the function looked like an ordinary call.

Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
DeltaFile
+42-70llvm/lib/Target/BPF/BPFUnwind.cpp
+61-0llvm/test/CodeGen/BPF/unwind-prepare.ll
+55-0llvm/test/CodeGen/BPF/unwind-lower.mir
+4-25llvm/test/CodeGen/BPF/unwind.ll
+0-20llvm/test/CodeGen/BPF/unwind-own-raise.ll
+16-0llvm/test/Assembler/invoke-bpf-unwind-exit.ll
+178-1159 files not shown
+212-12115 files

LLVM/project 3d02d39 — llvm/include/llvm/MC MCSchedule.h, llvm/lib/MC MCSchedule.cpp MCSymbol.cpp

[MC] Remove unused MCScheduleOptions and the MCFragment sentinel's static constructor (#240014)
DeltaFile
+0-6llvm/include/llvm/MC/MCSchedule.h
+3-2llvm/lib/MC/MCSymbol.cpp
+0-3llvm/lib/MC/MCSchedule.cpp
+1-1llvm/tools/llvm-mca/llvm-mca.cpp
+4-124 files

LLVM/project 5fa5910 — llvm/lib/Target/Sparc SparcFrameLowering.h SparcFrameLowering.cpp, llvm/test/DebugInfo/Sparc leaf-param-dbg-value.ll

[SPARC] Remap the parameter DBG_VALUEs of a leaf procedure (#239545)

A leaf procedure stays in its caller's register window, so
remapRegsForLeafProc rewrites %i0-%i7 to %o0-%o7. PEI calls it from
determineCalleeSaves, while the parameter DBG_VALUEs at the start of the
entry block are stashed outside the function (stashEntryDbgValues), so
they keep naming %i registers and gdb reads the arguments of leaf
functions from the wrong register.

This renames the debug operands that are left once PEI has put the
stashed values back, in processFunctionBeforeFrameIndicesReplaced. Other
DBG_VALUEs on the same value were already renamed, it's only the stashed
parameter ones that were missed.

Fixes #235238.

`leaf.c` from the issue, `break get` in gdb, before:

```

    [13 lines not shown]
DeltaFile
+50-0llvm/test/DebugInfo/Sparc/leaf-param-dbg-value.ll
+19-0llvm/lib/Target/Sparc/SparcFrameLowering.cpp
+4-0llvm/lib/Target/Sparc/SparcFrameLowering.h
+73-03 files

LLVM/project 4f8fb94 — llvm/lib/Target/Sparc SparcISelLowering.cpp, llvm/test/CodeGen/SPARC bitcast.ll

[SPARC] Expand f64 bitcasts from v2i32 on 32-bit SPARC (#234201)

It is not possible to directly transfer values from integer registers to
floating point registers, so it needs to be done via the stack.

Fixes the following error:

  LLVM ERROR: Cannot select: t10: f64 = bitcast t16
    t16: v2i32 = BUILD_VECTOR t2, t4
      t2: i32,ch = CopyFromReg t0, Register:i32 %0
      t4: i32,ch = CopyFromReg t0, Register:i32 %1
  In function: v2i32_build_vector

Assisted-by: Claude
DeltaFile
+136-0llvm/test/CodeGen/SPARC/bitcast.ll
+1-0llvm/lib/Target/Sparc/SparcISelLowering.cpp
+137-02 files

LLVM/project d7dc171 — llvm/lib/Target/Sparc SparcInstrInfo.cpp, llvm/test/CodeGen/SPARC bpr-reg-flags.ll

[SPARC] Preserve register operand flags in BPR branch conditions (#240077)

parseCondBranch() rebuilt the register operand of a branch-on-register
(BPR) instruction from just its register number, and insertBranch()
re-added it with addReg(), so any operand flags were lost when a branch
was analyzed and reinserted.

When the register is undef (ProcessImplicitDefs marks the use undef
after removing its IMPLICIT_DEF), PHI elimination splitting a critical
edge rewrites the terminator via updateTerminator() and the BPR ends up
reading a virtual register with no def. The machine verifier rejects
this, and without the verifier the greedy register allocator segfaults
in VirtRegAuxInfo::weightCalcHelper.

Copy the whole MachineOperand into Cond and add it back with add(), as
other targets do.

Fixes #233111

Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
DeltaFile
+47-0llvm/test/CodeGen/SPARC/bpr-reg-flags.ll
+3-6llvm/lib/Target/Sparc/SparcInstrInfo.cpp
+50-62 files

LLVM/project 0fc5afa — llvm/lib/Target/NVPTX NVPTXInstrInfo.td, llvm/test/CodeGen/NVPTX bf16.ll

[NVPTX] Select scalar_to_vector for bf16x2 (#236706)

Fixes #235368.

DAG combining can create a v2bf16 SCALAR_TO_VECTOR for byte-vector
concatenations, including copies of unaligned bfloat values through
local arrays. NVPTX treats the node as legal but lacks a selection
pattern.

Pack the bf16 value into the low half of a 32-bit register and zero the
unspecified high half, as already done for v2f16. Add regression
coverage for direct packing, unaligned loads, and the original
local-array copy.
DeltaFile
+83-0llvm/test/CodeGen/NVPTX/bf16.ll
+2-0llvm/lib/Target/NVPTX/NVPTXInstrInfo.td
+85-02 files

LLVM/project 27cf3e0 — libc/src/__support/OSUtil/linux/syscall_wrappers CMakeLists.txt remap_file_pages.h, libc/src/sys/mman/linux CMakeLists.txt remap_file_pages.cpp

[libc] Use a syscall wrapper for remap_file_pages

This PR move remap_file_pages behind the centralized syscall wrappers, following libc/docs/dev/syscall_wrapper_refactor.md.
DeltaFile
+41-0libc/src/__support/OSUtil/linux/syscall_wrappers/remap_file_pages.h
+11-16libc/src/sys/mman/linux/remap_file_pages.cpp
+17-2utils/bazel/llvm-project-overlay/libc/BUILD.bazel
+13-0libc/src/__support/OSUtil/linux/syscall_wrappers/CMakeLists.txt
+5-3libc/src/sys/mman/linux/CMakeLists.txt
+87-215 files

LLVM/project 306b3e1 — libc/src/sys/mman/linux CMakeLists.txt posix_madvise.cpp, utils/bazel/llvm-project-overlay/libc BUILD.bazel

[libc] Use a syscall wrapper for posix_madvise

This PR move posix_madvise behind the centralized syscall wrappers, following libc/docs/dev/syscall_wrapper_refactor.md.
DeltaFile
+9-7libc/src/sys/mman/linux/posix_madvise.cpp
+3-2libc/src/sys/mman/linux/CMakeLists.txt
+1-1utils/bazel/llvm-project-overlay/libc/BUILD.bazel
+13-103 files

LLVM/project 319bd32 — llvm/lib/Analysis BlockFrequencyInfo.cpp

[BFI] Scale block frequencies with native 128-bit integers (NFC) (#239953)

Update setBlockFreqAndScale to use native 128 bit integers instead of
APInt if available, as this improves compile-time:

stage1-O3: -0.7%
stage1-ReleaseThinLTO: -0.08%
stage1-ReleaseLTO-g: -0.06%
stage1-aarch64-O3: -0.07%
stage2-O3: -0.07%
stage2-clang: -0.14%


https://llvm-compile-time-tracker.com/compare.php?from=f82380b4c3ff92a6293f03f7c02e40249ba10e13&to=b885f69205b43f51764127d753eaed4fd91a12e8&stat=instructions:u

Assisted-by: Opus 5.5

PR: https://github.com/llvm/llvm-project/pull/239953
DeltaFile
+20-13llvm/lib/Analysis/BlockFrequencyInfo.cpp
+20-131 files

LLVM/project aa4eebd — llvm/test/Transforms/LoopVectorize runtime-checks-hoist.ll

[LV] Add runtime check tests with loop invariant operand sums. (NFC) (#240067)

Add tests for nested loops whose runtime check bounds combine operands
invariant in the outer loop with variant ones.
DeltaFile
+317-0llvm/test/Transforms/LoopVectorize/runtime-checks-hoist.ll
+317-01 files

LLVM/project d0919a3 — llvm/lib/Transforms/Vectorize VPlanUtils.h VPlanUtils.cpp

[VPlan] Factor out VPSCEVExpander::canExpandInIR (NFC). (#240063)

Split off the check for expressions that are expanded in IR and hoisted
out of HoistOutOf, to reuse it in follow-ups.
DeltaFile
+6-2llvm/lib/Transforms/Vectorize/VPlanUtils.cpp
+3-0llvm/lib/Transforms/Vectorize/VPlanUtils.h
+9-22 files

LLVM/project db43068 — llvm/include/llvm/Transforms/Vectorize LoopVectorizationLegality.h LoopVectorize.h, llvm/lib/Transforms/Vectorize VPlan.h LoopVectorizationLegality.cpp

[LV] Remove InnerLoopVectorizer (NFC) (#240055)

All that is left of InnerLoopVectorizer is a bundle of state passed to
executePlan, of which only the assumption cache, a fresh IRBuilder and
whether runtime checks were generated are used, plus fixVectorizedLoop,
which runs legacyCSE on the vector loop header.

Create the IRBuilder in executePlan, take the assumption cache from
Legal, pass whether there are runtime checks as a bool and run legacyCSE
directly. Also drop executePlan's DominatorTree argument, which is the
same as the planner's DT member, and update comments that still refer to
InnerLoopVectorizer.

PR: https://github.com/llvm/llvm-project/pull/240055
DeltaFile
+16-105llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+3-3llvm/lib/Transforms/Vectorize/LoopVectorizationPlanner.h
+3-2llvm/include/llvm/Transforms/Vectorize/LoopVectorize.h
+1-3llvm/include/llvm/Transforms/Vectorize/LoopVectorizationLegality.h
+1-2llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp
+0-1llvm/lib/Transforms/Vectorize/VPlan.h
+24-1166 files

LLVM/project 09b8388 — llvm/lib/Support KnownFPClass.cpp

[KnownFPClass][NFC] Move fma logic out of fadd_impl, and document rounding mode assumption made by fadd/fsub (#240054)

I have plans to improve deductions made by `fadd`/`fsub` and `fma`.
However, some of these deductions are only valid for `fadd`/`fsub`, so I
have moved the `fma` logic outside of `fadd_impl` and into its own
`fma_impl` function. This allows us to make improvements to `fadd/fsub`
independently of `fma`, and it also makes it easier to audit
improvements to `fma`.

I also have plans to support the rounding mode for primitive arithmetic
functions https://github.com/llvm/llvm-project/issues/228974, so I have
documented the `NearestTiesToEven` assumption that `fadd_impl` makes
when ruling out `-0.0`, allowing `fadd_impl` to be valid for all
rounding modes.
DeltaFile
+49-17llvm/lib/Support/KnownFPClass.cpp
+49-171 files

LLVM/project fad6946 — clang/test/OpenMP GH141228.cpp, llvm/lib/MC MCTargetOptionsCommandFlags.cpp

Rebase, address comments

Created using spr 1.3.7
DeltaFile
+550-0llvm/test/Transforms/SLPVectorizer/X86/fma-copyable.ll
+145-236llvm/test/CodeGen/SPARC/fp-strict-cmp.ll
+38-216llvm/lib/MC/MCTargetOptionsCommandFlags.cpp
+214-0llvm/test/Transforms/SLPVectorizer/X86/copyable-freeze.ll
+201-0clang/test/OpenMP/GH141228.cpp
+111-18llvm/test/CodeGen/SPARC/fp-strict.ll
+1,259-470119 files not shown
+2,514-714125 files

LLVM/project 2f1a1b0 — llvm/test/Transforms/SLPVectorizer/X86 copyable-freeze.ll

[SLP][NFC]Add extra tests with copyable freeze, NFC



Reviewers: 

Pull Request: https://github.com/llvm/llvm-project/pull/240068
DeltaFile
+274-0llvm/test/Transforms/SLPVectorizer/X86/copyable-freeze.ll
+274-01 files

LLVM/project 2be03e6 — llvm/lib/Transforms/Vectorize SLPVectorizer.cpp

fixup! [SLP] Pruning when there is no Undef
DeltaFile
+7-6llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
+7-61 files

LLVM/project ae123a7 — llvm/lib/Transforms/Vectorize VectorizeOptions.td SLPVectorizer.cpp

fixup! [SLP] Give failed seed a try
DeltaFile
+5-2llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
+2-0llvm/lib/Transforms/Vectorize/VectorizeOptions.td
+7-22 files

LLVM/project e924ae8 — llvm/lib/Transforms/Vectorize SLPVectorizer.cpp, llvm/test/Transforms/PhaseOrdering/X86 avg.ll

[SLP] Give failed seed a try

Previously, with the following vectorizable code:
y = x * x * x;
where IR ordered the code as:
sq = x * x;
y = sq * x;
If the seed is [sq0, y0, sq1, y1] and the cost model rejects
vectorizing sq0 and sq1, y0 will be bypassed without any retry in `I
+= ActualVF - 1`.

To fix this, we give skipped nodes a chance by using them as the root
of the tree and rebuilding it. In the retry logic, we starts from
bring the child of failure match (sq0,sq1) but uses FirstSkipped as
the filter. In here, [y0, y1] will be the new User to go
TryVectorizeWindow. If it still fails, it tried to bring its child in
as the next level try. For example, [sq0, y0, z0, sq1, y1, z1]. [y0,
y1] will brings [z0, z1] in until converge.
DeltaFile
+105-148llvm/test/Transforms/SLPVectorizer/X86/dependent-seeds-rejected-window.ll
+99-43llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
+35-27llvm/test/Transforms/SLPVectorizer/X86/c-ray.ll
+22-22llvm/test/Transforms/PhaseOrdering/X86/avg.ll
+13-10llvm/test/Transforms/SLPVectorizer/X86/reduce-or-bitpack.ll
+274-2505 files

LLVM/project f2e4fe6 — llvm/lib/Transforms/Vectorize SLPVectorizer.cpp

[SLP] Pruning when there is no Undef

By checking all (two) of the users of isGuaranteedNotToBePoison.
1. IsNotPoisonedVec: FindReusedSplat do same check as HasUndefScalars
so it never called and can safely prunning.
2. all_of(NonConstants, [=](Value *V)...: Also do the same check as
HasUndefScalars.

Nowadays, we generates very few undef value. So the prunning here
makes sense as we try to do linear check to find a possible undef
instead of calling the very expensive isGuaranteedNotToBePoison.
DeltaFile
+11-6llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
+11-61 files

LLVM/project 71b6d8e — llvm/lib/Transforms/Vectorize SLPVectorizer.cpp

fixup! [SLP] Give failed seed a try
DeltaFile
+5-1llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
+5-11 files