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

LLVM/project 14197d8 — llvm/test/Transforms/SLPVectorizer/X86 dependent-seeds-rejected-window.ll

[SLP][NFC] Add tests for dependent seeds in rejected windows

Precommit tests for the once-used seeds that depend on each other, such
as x * x and x * (x * x), whose window is rejected and whose users are
bypassed by the window walk.

Co-Authored-By: Claude Opus 5.5 <noreply at anthropic.com>
DeltaFile
+291-0llvm/test/Transforms/SLPVectorizer/X86/dependent-seeds-rejected-window.ll
+291-01 files

LLVM/project 6be16f3 — flang/lib/Optimizer/OpenACC/Support FIROpenACCUtils.cpp, flang/test/Transforms/OpenACC acc-implicit-data-common-block.fir

[flang][openacc] Do not implicitly map whole common block when not needed (#239772)

A common block that is used in a compute region only as the `storage`
operand of the fir.declare of its members must not be implicitly mapped
as a
whole as it would clash with explicit mappings of the individual
members. When the common block is accessed directly, the mapping can be
done like before.
DeltaFile
+62-0flang/test/Transforms/OpenACC/acc-implicit-data-common-block.fir
+23-0flang/lib/Optimizer/OpenACC/Support/FIROpenACCUtils.cpp
+85-02 files

LLVM/project 615c308 — llvm/lib/Transforms/Vectorize SLPVectorizer.cpp, llvm/test/Transforms/SLPVectorizer/X86 loads-from-single-predecessor.ll

[SLP]Fix metadata propagation for copyable loads

The wide load reads the memory of the copyable loads from the
predecessor block too. Intersect their flags and metadata with the
other lanes instead of skipping them, which kept metadata the
predecessor load does not have.

Reported in https://github.com/llvm/llvm-project/pull/233297#issuecomment-6710823367

Assisted-by: Cursor

Reviewers: 

Pull Request: https://github.com/llvm/llvm-project/pull/240050
DeltaFile
+3-4llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
+2-4llvm/test/Transforms/SLPVectorizer/X86/loads-from-single-predecessor.ll
+5-82 files

LLVM/project 38645c3 — llvm/test/Transforms/SLPVectorizer/X86 loads-from-single-predecessor.ll

[SLP][NFC]Add a test with incorrect metadata propagation, NFC



Reviewers: 

Pull Request: https://github.com/llvm/llvm-project/pull/240046
DeltaFile
+41-0llvm/test/Transforms/SLPVectorizer/X86/loads-from-single-predecessor.ll
+41-01 files

LLVM/project cac5de1 — llvm/lib/Transforms/Vectorize SLPVectorizer.cpp, llvm/test/Transforms/SLPVectorizer/X86 fma-copyable.ll

[SLP]Use fma as copyable main op without fmuladd lanes

fma(V, 1.0, -0.0) and fma(0.0, -0.0, V) equal V exactly, so fma
bundles model non-fma lanes as copyables, like fmuladd. fma lanes
never absorb fmul/fadd, so fma loses ties with fmul/fadd.

Assisted-by: Cursor

Reviewers: 

Pull Request: https://github.com/llvm/llvm-project/pull/240039
DeltaFile
+32-40llvm/test/Transforms/SLPVectorizer/X86/fma-copyable.ll
+4-5llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
+36-452 files

LLVM/project 0fd0b44 — clang/test/OpenMP irbuilder_unroll_unroll_partial_heuristic.c irbuilder_unroll_partial_heuristic_runtime_for.c, llvm/include/llvm/Frontend/OpenMP OMPIRBuilder.h

OpenMP: Stop using TTI to pick the partial unroll factor in OMPIRBuilder

When the unrolled loop's CanonicalLoopInfo is needed by an enclosing
loop directive and no factor was given, unrollLoopPartial computed one
by constructing its own TargetMachine with default TargetOptions and a
standalone FunctionAnalysisManager, then running LoopUnrollPass's cost
model on the function while it was still being built.

This is a layering violation. Frontends should not be using codegen
optimization information to construct the original program. This will
not have a properly configured TargetTransformInfo from a pass
manager. The cost model is also not meaningful on incomplete,
unoptimized IR.

Use a factor of 2, matching what Sema's OpenMP loop transformation
uses for a partial clause without a factor. This removes the hidden
-openmp-ir-builder-unroll-threshold-factor option.

Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
DeltaFile
+2-189llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
+4-8llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h
+4-4clang/test/OpenMP/irbuilder_unroll_unroll_partial_heuristic.c
+4-4clang/test/OpenMP/irbuilder_unroll_partial_heuristic_runtime_for.c
+4-4clang/test/OpenMP/irbuilder_unroll_partial_heuristic_constant_for.c
+18-2095 files

LLVM/project 284971a — llvm/lib/Frontend/OpenMP OMPIRBuilder.cpp

OpenMP: Use TargetMachine::getTargetIRAnalysis in OMPIRBuilder

Use the TargetMachine's TargetIRAnalysis instead of wrapping
getTargetTransformInfo in a custom callback. This is a marginal
improvement. TTI should come from the pass manager. There isn't a pass
manager because this is frontend IR construction code, and it's
entirely inappropriate to be using TTI at all.

Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
DeltaFile
+1-2llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
+1-21 files

LLVM/project 44112a1 — clang/tools/clang-linker-wrapper ClangLinkerWrapper.cpp, llvm/include/llvm/CodeGen CommandFlags.h

[Support] Pass tool options to parseCommandLineOptions

Follow-up to #239920: `RegisterMCToolOptions` adds `MCToolOptions` to
the process-wide registry. Once lld registers them, every later parse in
the process accepts `-crel`, including clang's `-mllvm`, which then
ignores it.

Add a `parseCommandLineOptions` overload that takes the libraries a tool
opts in to. Replace `RegisterMCToolOptions` with `mc::getToolOptions`
and `codegen::getToolOptions`, which tools pass where they parse,
including lld's `-mllvm`, gold's `-plugin-opt`, and libLTO's debug
options. `RegisterCodeGenFlags` no longer registers the MC options. When
CodeGen's options move to TableGen, their parser joins
`codegen::getToolOptions` without changing these call sites.

clang-linker-wrapper forwards `-mllvm` to the device and host link steps
and does not pass the MC options. Its wrapper module uses the module's
own context instead of the user's `-mllvm`, as discussed on #233513.


    [5 lines not shown]
DeltaFile
+62-27llvm/lib/Support/CommandLine.cpp
+31-0llvm/unittests/Option/LibraryOptionsTest.cpp
+9-13clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
+13-0llvm/include/llvm/Support/CommandLine.h
+5-5llvm/include/llvm/MC/MCTargetOptionsCommandFlags.h
+9-0llvm/include/llvm/CodeGen/CommandFlags.h
+129-4528 files not shown
+199-7334 files

LLVM/project 635f308 — clang/lib/Serialization ModuleCache.cpp, clang/unittests/Serialization ModuleCacheTest.cpp

[clang][Modules] Refresh a module file's access time when it is read (#239747)
DeltaFile
+35-1clang/unittests/Serialization/ModuleCacheTest.cpp
+29-0clang/lib/Serialization/ModuleCache.cpp
+64-12 files

LLVM/project 7eb1158 — llvm/lib/Target/BPF BPFUnwind.cpp, llvm/test/CodeGen/BPF unwind-reject-typed-catch.ll unwind-reject-nounwind.ll

Lower unwinding after reporting an error
DeltaFile
+3-4llvm/lib/Target/BPF/BPFUnwind.cpp
+1-0llvm/test/CodeGen/BPF/unwind-reject-typed-catch.ll
+1-0llvm/test/CodeGen/BPF/unwind-reject-nounwind.ll
+1-0llvm/test/CodeGen/BPF/unwind-reject-no-uwtable.ll
+1-0llvm/test/CodeGen/BPF/unwind-reject-filter.ll
+7-45 files

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

BPF: Stop lowering unwinding through nonexistent unwinder calls

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
+39-66llvm/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
+175-1116 files not shown
+205-11712 files

LLVM/project fb9c029 — llvm/include/llvm/CodeGen CommandFlags.h, llvm/include/llvm/MC MCTargetOptionsCommandFlags.h

[Support] Pass tool options to parseCommandLineOptions

Follow-up to #239920: `RegisterMCToolOptions` adds `MCToolOptions` to
the process-wide registry. Once lld registers them, every later parse in
the process accepts `-crel`, including clang's `-mllvm`, which then
ignores it.

Add a `parseCommandLineOptions` overload that takes the libraries a tool
opts in to. Replace `RegisterMCToolOptions` with `mc::getToolOptions`
and `codegen::getToolOptions`, which tools pass where they parse,
including lld's `-mllvm`, gold's `-plugin-opt`, and libLTO's debug
options. `RegisterCodeGenFlags` no longer registers the MC options. When
CodeGen's options move to TableGen, their parser joins
`codegen::getToolOptions` without changing these call sites.

`LibraryOptionsContext` records the library that parsed each argument,
so `assign`, which runs on each ThinLTO backend thread, replays without
looking up the registry.

LLM-aided
DeltaFile
+62-27llvm/lib/Support/CommandLine.cpp
+31-0llvm/unittests/Option/LibraryOptionsTest.cpp
+13-0llvm/include/llvm/Support/CommandLine.h
+5-5llvm/include/llvm/MC/MCTargetOptionsCommandFlags.h
+9-0llvm/include/llvm/CodeGen/CommandFlags.h
+4-2llvm/lib/MC/MCTargetOptionsCommandFlags.cpp
+124-3428 files not shown
+192-6134 files

LLVM/project bc0d038 — mlir/lib/Dialect/Vector/IR VectorOps.cpp, mlir/test/Dialect/Vector canonicalize.mlir

[mlir][vector] Fix foldInsertUseChain to return getDest() (#239714)

Fixes a regression introduced in #238070, which changed `return
insertOp.getResult()` to `return insertOp.getDest()` in
`foldInsertUseChain`. `dest` is `InsertOp`'s destination vector rather
than its result.

Because of this change, folding `vector.insert` ops at the same position
replaced `insertOp` with its destination operand instead of signaling an
in-place fold, dropping the final insertion.

We also add a test to prevent this regression from happening again. 

cc @banach-space
DeltaFile
+6-6mlir/test/Dialect/Vector/canonicalize.mlir
+1-1mlir/lib/Dialect/Vector/IR/VectorOps.cpp
+7-72 files

LLVM/project 4039e79 — llvm/test/Transforms/SLPVectorizer/X86 fma-copyable.ll

[SLP][NFC]Add fmuladd missing copyable case, NFC



Reviewers: 

Pull Request: https://github.com/llvm/llvm-project/pull/240016
DeltaFile
+558-0llvm/test/Transforms/SLPVectorizer/X86/fma-copyable.ll
+558-01 files

LLVM/project f0afbed — llvm/include/llvm/CodeGen CommandFlags.h, llvm/include/llvm/MC MCTargetOptionsCommandFlags.h

[Support] Pass tool options to parseCommandLineOptions

`RegisterMCToolOptions` adds `MCToolOptions` to the process-wide
registry. Once lld registers them, every later parse in the process
accepts `-crel`, including clang's `-mllvm`, which then ignores it.

Add a `parseCommandLineOptions` overload that takes the libraries a tool
opts in to. Replace `RegisterMCToolOptions` with `mc::getToolOptions`
and `codegen::getToolOptions`, which tools pass where they parse,
including lld's `-mllvm`, gold's `-plugin-opt`, and libLTO's debug
options. `RegisterCodeGenFlags` no longer registers the MC options.

`LibraryOptionsContext` records the library that parsed each argument,
so `assign` replays without looking up the registry, which does not
contain tool options.

LLM-aided
DeltaFile
+68-26llvm/lib/Support/CommandLine.cpp
+33-0llvm/unittests/Option/LibraryOptionsTest.cpp
+13-0llvm/include/llvm/Support/CommandLine.h
+5-5llvm/include/llvm/MC/MCTargetOptionsCommandFlags.h
+9-0llvm/include/llvm/CodeGen/CommandFlags.h
+4-2llvm/lib/MC/MCTargetOptionsCommandFlags.cpp
+132-3328 files not shown
+202-6234 files

LLVM/project 28df8c4 — llvm/lib/CodeGen MachineVerifier.cpp, llvm/test/CodeGen/AMDGPU si-fold-operands-bundle.mir

MachineVerifier: Remove dead virtual register kill tracking

Kill flags on virtual registers are now rejected, so the per-block
tracking of killed virtual registers can never report anything
new. Physical register kills are handled separately.

Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
DeltaFile
+9-30llvm/lib/CodeGen/MachineVerifier.cpp
+5-6llvm/test/CodeGen/AMDGPU/si-fold-operands-bundle.mir
+14-362 files

LLVM/project ae4efc0 — llvm/lib/Target/AArch64 AArch64MIPeepholeOpt.cpp AArch64InstrInfo.cpp

AArch64: Remove clearKillFlags calls (#239892)

Kill flags are no longer permitted on virtual registers, but these
contexts may also see physical registers. Those physical register
kills are either never set by the time this code runs or are on
reserved or constant registers where they carry no information.

Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
DeltaFile
+0-2llvm/lib/Target/AArch64/AArch64InstrInfo.cpp
+0-1llvm/lib/Target/AArch64/AArch64MIPeepholeOpt.cpp
+0-32 files

LLVM/project a16ebff — llvm/include/llvm/Analysis LibcallLoweringInfo.h, llvm/lib/Analysis LibcallLoweringInfo.cpp

LibcallLoweringInfo: Use unique_ptr for map entries.

ModuleLibcallLoweringInfo stored each context's LibcallLoweringInfo by
value in a DenseMap, so returned references dangled once a later
insertion grew the map. Current users look the entry up again for each
function, but future changes will introduce long lived references.

Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
DeltaFile
+7-8llvm/include/llvm/Analysis/LibcallLoweringInfo.h
+3-2llvm/lib/Analysis/LibcallLoweringInfo.cpp
+10-102 files

LLVM/project 01b6afb — llvm/lib/CodeGen PreISelIntrinsicLowering.cpp

CodeGen: Stop using TargetLowering's libcall info in PreISelIntrinsicLowering (#239898)

The TargetLowering copy of RuntimeLibcallsInfo should be deleted and
only the analysis should be used.

Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
DeltaFile
+6-3llvm/lib/CodeGen/PreISelIntrinsicLowering.cpp
+6-31 files

LLVM/project ea8f595 — llvm/lib/Target/Sparc SparcISelLowering.cpp, llvm/test/CodeGen/SPARC fp128-strict.ll fp-strict.ll

[SPARC] Branch directly on the result of a constrained FP compare (#239385)

A branch on a constrained FP compare currently materializes the compare
result with a select of 1/0 and then branches on an integer compare of
that value against zero.

Branch on the FP condition codes directly when the compare's output
chain feeds only the branch, either directly or through a token factor
used only by the branch. The compare is glued to the branch, so this
is not done when another node is ordered after the compare, such as a
call.

Also look through the "and X, 1" that brcond expansion inserts when X
is already a SELECT_[IF]CC of 1 and 0, which lets the existing
LookThroughSetCC fold the soft-quad f128 compare as well.

Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
DeltaFile
+145-236llvm/test/CodeGen/SPARC/fp-strict-cmp.ll
+111-18llvm/test/CodeGen/SPARC/fp-strict.ll
+89-0llvm/test/CodeGen/SPARC/fp128-strict.ll
+79-0llvm/lib/Target/Sparc/SparcISelLowering.cpp
+424-2544 files

LLVM/project ed640e9 — llvm/lib/Target/Hexagon HexagonOptAddrMode.cpp HexagonInstrInfo.cpp

Hexagon: Remove redundant clearKillFlags calls (#239894)

HexagonOptAddrMode recomputes kill flags with Liveness::resetKills
after any change, so its clears are redundant.

Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
DeltaFile
+0-12llvm/lib/Target/Hexagon/HexagonInstrInfo.cpp
+0-2llvm/lib/Target/Hexagon/HexagonOptAddrMode.cpp
+0-142 files

LLVM/project 3512521 — llvm/lib/Target/AArch64 AArch64PTrueCoalescing.cpp AArch64InstrInfo.cpp

AArch64: Remove clearKillFlags calls on virtual registers (#239782)

Kill flags are no longer permitted on virtual registers, so clearing
them is a no-op. Remove the calls where the register can only be
virtual.

Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
DeltaFile
+0-3llvm/lib/Target/AArch64/AArch64MIPeepholeOpt.cpp
+0-1llvm/lib/Target/AArch64/AArch64PTrueCoalescing.cpp
+0-1llvm/lib/Target/AArch64/AArch64InstrInfo.cpp
+0-53 files

LLVM/project 4152af1 — llvm/lib/Target/ARC/MCTargetDesc ARCMCTargetDesc.cpp, llvm/lib/Target/BPF/MCTargetDesc BPFMCTargetDesc.cpp

BPF, Lanai, ARC, M68k: Register null target streamer (#239823)

Since 44a08dc732c5, llc -filetype=null is a fatal error on targets
that do not register a null target streamer. These targets do not need
a target specific streamer for the null case, so register the base
MCTargetStreamer.

Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
DeltaFile
+7-0llvm/lib/Target/M68k/MCTargetDesc/M68kMCTargetDesc.cpp
+7-0llvm/lib/Target/Lanai/MCTargetDesc/LanaiMCTargetDesc.cpp
+7-0llvm/lib/Target/BPF/MCTargetDesc/BPFMCTargetDesc.cpp
+7-0llvm/lib/Target/ARC/MCTargetDesc/ARCMCTargetDesc.cpp
+5-0llvm/test/CodeGen/Lanai/null-target-streamer.ll
+5-0llvm/test/CodeGen/M68k/null-target-streamer.ll
+38-02 files not shown
+48-08 files