LLVM/project afdcd7fllvm/include/llvm/ADT FoldingSet.h, llvm/lib/Support FoldingSet.cpp

[ADT] Remove FoldingSet's void * insert position API (#219845)

FindNodeOrInsertPos/InsertNode/GetOrInsertNode/RemoveNode and the
encode/decode helpers behind them are gone; use
lookup/insert/getOrInsert/erase with FoldingSetInsertToken.

LLM-aided
DeltaFile
+62-62llvm/unittests/ADT/FoldingSet.cpp
+0-32llvm/include/llvm/ADT/FoldingSet.h
+0-4llvm/lib/Support/FoldingSet.cpp
+62-983 files

LLVM/project 7694751llvm/include/llvm/ExecutionEngine/Orc LookupAndApply.h, llvm/lib/ExecutionEngine/Orc LookupAndApply.cpp

[ORC] Drop redundant ExecutionSession& arg from lookupAndApply (#219797)

The ExecutionSession& can be retrieved from the first element of the
SearchOrder.

This changes behavior in a corner case: An empty SearchOrder always
fails on a non-empty PrepareFns list, even if all symbols added would
have been weakly referenced, because no ExecutionSession& is available
to intern the symbol names. An empty SearchOrder is pathological, so
this seems like a reasonable trade-off.
DeltaFile
+21-9llvm/lib/ExecutionEngine/Orc/LookupAndApply.cpp
+22-0llvm/unittests/ExecutionEngine/Orc/LookupAndApplyTest.cpp
+7-2llvm/include/llvm/ExecutionEngine/Orc/LookupAndApply.h
+50-113 files

LLVM/project 0538497llvm/lib/CodeGen RegAllocFast.cpp

[RegAllocFast] Use getOneDef() in traceCopyChain(). NFC (#219850)

getUniqueVRegDef() finds one defining instruction, while getOneDef()
finds one def operand and is inlined.
(They differ for a register defined twice by one instruction but
RegAllocFast does not support that shape in defineVirtReg().)
DeltaFile
+8-6llvm/lib/CodeGen/RegAllocFast.cpp
+8-61 files

LLVM/project e016329llvm/lib/Transforms/Vectorize VPlanTransforms.cpp VPlanPatternMatch.h, llvm/test/Transforms/LoopVectorize scalarized-bitcast.ll

[VPlan] Fold trivial bitcasts. (#219849)

Fold trivial bitcasts in VPlan. This avoids special handling when
constructing SCEV expressions (which folds such trivial casts), and
ensures we can close the gap between IR-based SCEV analysis and
VPlan-based SCEV analysis. This is important going forward to make sure
we can replace existing IR analysis without regressions.
DeltaFile
+6-6llvm/test/Transforms/LoopVectorize/VPlan/vplan-scev-address-idioms.ll
+3-3llvm/test/Transforms/LoopVectorize/scalarized-bitcast.ll
+6-0llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
+6-0llvm/lib/Transforms/Vectorize/VPlanPatternMatch.h
+1-1llvm/test/Transforms/LoopVectorize/SystemZ/load-scalarization-cost-0.ll
+22-105 files

LLVM/project 152edef.github/workflows libc-overlay-tests.yml

[libc][Github] Use explicit names for libc overlay tests (#219783)
DeltaFile
+11-6.github/workflows/libc-overlay-tests.yml
+11-61 files

LLVM/project 49b1085llvm/lib/CodeGen PeepholeOptimizer.cpp

CodeGen: Use getOneNonDBGUser in PeepholeOptimizer (#219526)
DeltaFile
+2-2llvm/lib/CodeGen/PeepholeOptimizer.cpp
+2-21 files

LLVM/project c8c0197llvm/lib/Target/AArch64 AArch64MCInstLower.cpp

AArch64: Use AsmPrinter's MachineFunction in lowerSymbolOperandELF (#219475)
DeltaFile
+3-3llvm/lib/Target/AArch64/AArch64MCInstLower.cpp
+3-31 files

LLVM/project be9007bclang/include/clang/AST DeclTemplate.h, clang/lib/AST ASTImporter.cpp DeclTemplate.cpp

[clang] Migrate remaining FoldingSet users to lookup/insert. NFC (#219844)

findSpecialization/AddSpecialization and their Decl.h wrappers stop
threading a `void *` through the AST, Sema, Serialization and CodeGen
callers. This is the last user of FoldingSet's `void *` insert position.

LLM-aided
DeltaFile
+54-50clang/lib/AST/DeclTemplate.cpp
+29-28clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
+29-20clang/include/clang/AST/DeclTemplate.h
+19-20clang/lib/AST/ASTImporter.cpp
+18-20clang/lib/StaticAnalyzer/Core/BasicValueFactory.cpp
+19-19clang/lib/Sema/SemaTemplate.cpp
+168-15727 files not shown
+282-27233 files

LLVM/project b45b02allvm/lib/Transforms/Vectorize VPlanUnroll.cpp, llvm/test/Transforms/LoopVectorize float-induction.ll

[VPlan] Fix VPScalarIVStepsRecipe for FSub inductions. (#219214)

The lane offsets passed to the new VPScalarIVStepsRecipe always count
upwards (based on the canonical IV), independent of the induction
opcode.

Remove code incorrectly negating the lane offset for inductions with
FPSub opcode. The double negation caused incorrect results.

PR: https://github.com/llvm/llvm-project/pull/219214
DeltaFile
+10-10llvm/test/Transforms/LoopVectorize/float-induction.ll
+4-5llvm/lib/Transforms/Vectorize/VPlanUnroll.cpp
+14-152 files

LLVM/project a95b4d1llvm/include/llvm/Analysis ScalarEvolution.h, llvm/unittests/Analysis ScalarEvolutionTest.cpp

[SCEV] Use SCEVUse for FoldID. (#219813)

As pointed out in https://github.com/llvm/llvm-project/pull/216761,
FoldID was not properly migrated to use SCEVUse. This caused incorrect
lookups, when an expression was cached with an operand with SCEVUse
flags and queried for the same expression without flags.

PR: https://github.com/llvm/llvm-project/pull/219813
DeltaFile
+44-0llvm/unittests/Analysis/ScalarEvolutionTest.cpp
+6-5llvm/include/llvm/Analysis/ScalarEvolution.h
+50-52 files

LLVM/project 9946f44clang/lib/Driver/ToolChains Cygwin.h Cygwin.cpp, clang/test/Driver cygwin.cpp

[Clang][Driver] Revise Cygwin ToolChain to call linker directly (#147960)

...so that `libc++`, `compiler-rt`, and `libunwind` can be used by the
options: `-stdlib=libc++`, `-rtlib=compiler-rt`, and
`-unwindlib=libunwind` respectively. Along with this change, the test
for this driver is also trimmed a bit.

This is a followup patch for
https://github.com/llvm/llvm-project/commit/52924a2d7255cdd280b2b82dad8616e01fe065da.

---------

Signed-off-by: Takashi Yano <takashi.yano at nifty.ne.jp>
Co-authored-by: Jeremy Drake <github at jdrake.com>
Co-authored-by: Tomohiro Kashiwada <kikairoya at gmail.com>
DeltaFile
+275-0clang/lib/Driver/ToolChains/Cygwin.cpp
+112-12clang/test/Driver/cygwin.cpp
+18-0clang/lib/Driver/ToolChains/Cygwin.h
+0-0clang/test/Driver/Inputs/basic_cygwin_tree/usr/lib/gcc/i686-pc-cygwin/10/crtend.o
+0-0clang/test/Driver/Inputs/basic_cross_cygwin_tree/usr/i686-pc-msys/lib/crt0.o
+0-0clang/test/Driver/Inputs/basic_cygwin_tree/usr/lib/gcc/x86_64-pc-msys/10/crtend.o
+405-125 files not shown
+405-1211 files

LLVM/project f9d53b2llvm/test/Transforms/LoopVectorize/VPlan vplan-scev-address-idioms.ll

[VPlan] Add tests for more address idioms not by VPlan's SCEV (NFC). (#219843)

Add tests gaps currently handled by IR based SCEV analysis, but not
VPlan-based SCEV analysis.
DeltaFile
+975-0llvm/test/Transforms/LoopVectorize/VPlan/vplan-scev-address-idioms.ll
+975-01 files

LLVM/project 5c9c1f5llvm/include/llvm/ADT FoldingSet.h, llvm/lib/Support FoldingSet.cpp

[ADT] Inline FoldingSet's equality dispatch (#219784)

FoldingSetBase compares nodes through a FoldingSetInfo table of function
pointers, which the compiler cannot inline through to the node's
Profile().
Add a probe() template taking the match test as a template parameter,
and build lookup, FindNodeOrInsertPos and getOrInsert on it in
FoldingSetImpl where the trait is known.

LLM-aided
DeltaFile
+60-64llvm/include/llvm/ADT/FoldingSet.h
+1-54llvm/lib/Support/FoldingSet.cpp
+61-1182 files

LLVM/project a6e5d88llvm/lib/Analysis ValueTracking.cpp, llvm/test/Transforms/InstCombine stepvector-known-bits.ll

[ValueTracking] Compute known bits for llvm.stepvector (#219779)

Teach ValueTracking to infer high zero bits for `llvm.stepvector` from
the
vector element count and a finite `vscale_range`.

Conservatively give up when the lane-count calculation overflows the
element
width, since `llvm.stepvector` truncates out-of-range lane indices.

This allows existing sign-bit reasoning to eliminate redundant
extensions for
bounded step vectors.

The regression tests cover scalable and fixed vectors, bounded and
unbounded
`vscale_range`, lane-index truncation, unconstrained inputs, and
signed-i32
boundary cases.

Fixes #219776.
DeltaFile
+117-0llvm/test/Transforms/InstCombine/stepvector-known-bits.ll
+24-0llvm/lib/Analysis/ValueTracking.cpp
+141-02 files

LLVM/project 8e32376clang/include/clang/AST ASTContext.h, clang/lib/AST NestedNameSpecifier.cpp DeclarationName.cpp

[clang] Migrate AST/Sema FoldingSet users to typed lookup/insert. NFC (#219766)
DeltaFile
+246-287clang/lib/AST/ASTContext.cpp
+15-16clang/lib/AST/DeclarationName.cpp
+4-6clang/lib/Sema/SemaConcept.cpp
+3-3clang/lib/Sema/SemaLookup.cpp
+3-3clang/lib/AST/NestedNameSpecifier.cpp
+1-1clang/include/clang/AST/ASTContext.h
+272-3166 files

LLVM/project 868246fllvm/lib/Transforms/InstCombine InstCombineAndOrXor.cpp, llvm/test/Transforms/InstCombine fsh.ll

[InstCombine] Recognize rotate patterns with `X + 1` shift counts as funnel shifts (#214035)

fix #173132

godbolt: https://llvm.godbo.lt/z/WE6Woxqj4
alive2: https://alive2.llvm.org/ce/z/SYa7uG
https://alive2.llvm.org/ce/z/Y6HqoV
DeltaFile
+219-0llvm/test/Transforms/InstCombine/fsh.ll
+11-0llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
+230-02 files

LLVM/project 8c3eb53llvm/include/llvm/CodeGen SelectionDAG.h, llvm/include/llvm/CodeGen/GlobalISel CSEMIRBuilder.h CSEInfo.h

[CodeGen] Migrate to FoldingSet's typed lookup/insert/erase. NFC (#219830)

Rename SelectionDAG::FindNodeOrInsertPos to lookupNode and use the new
FoldingSetInsertToken API in place of `void *`.

In SelectionDAG the token is named `InsertToken`, as Token there means
the chain operand (TokenFactor, EntryToken).
DeltaFile
+187-186llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
+20-19llvm/lib/CodeGen/GlobalISel/CSEInfo.cpp
+15-13llvm/include/llvm/CodeGen/SelectionDAG.h
+13-14llvm/lib/CodeGen/GlobalISel/CSEMIRBuilder.cpp
+5-4llvm/include/llvm/CodeGen/GlobalISel/CSEInfo.h
+4-4llvm/include/llvm/CodeGen/GlobalISel/CSEMIRBuilder.h
+244-2402 files not shown
+250-2488 files

LLVM/project 88f3a79llvm/lib/Transforms/Utils SCCPSolver.cpp, llvm/test/Transforms/SCCP ipsccp-recursive-arg-update.ll

[SCCP] Fix missing worklist push for recursive calls that update lattice values (#219826)

For a recursive call, the call instruction itself is a user of the
function's arguments. Because I == CurI, I->comesBefore(CurI) is false,
and the condition triggers an early return. The recursive call
instruction was skipped and never pushed back onto the worklist, halting
the solver prematurely before reaching a fixpoint. This caused the
solver to incorrectly believe arguments were hardcoded constants rather
than a wider constant range, resulting in invalid branch folding.

The Fix: This patch updates the condition to explicitly check if I comes
strictly after CurI.

Fixes: https://github.com/llvm/llvm-project/issues/219503
DeltaFile
+37-0llvm/test/Transforms/SCCP/ipsccp-recursive-arg-update.ll
+1-1llvm/lib/Transforms/Utils/SCCPSolver.cpp
+38-12 files

LLVM/project 5bea437llvm/lib/Target/X86 X86CodeGenPassBuilder.cpp, llvm/test/CodeGen/X86/GlobalISel binop.ll

[X86][NewPM] Wire up GISel pipeline (#219785)
DeltaFile
+42-6llvm/lib/Target/X86/X86CodeGenPassBuilder.cpp
+1-0llvm/test/CodeGen/X86/GlobalISel/binop.ll
+43-62 files

LLVM/project b139ae5llvm/lib/Target/AArch64/AsmParser AArch64AsmParser.cpp, llvm/test/MC/AArch64 arm64-diags.s

[AArch64] Fix crash parsing an operand with both :specifier: and `@specifier` (#219737)

`add x3, x5, :lo12:sym at PAGEOFF` hits llvm_unreachable in applySpecifier:
Mach-O accepts both ELF style `:specifier:` and its own `@specifier`.
When an ELF-style :specifier already wraps the expression,
applySpecifier then receives an unexpected MCSpecifierExpr.

Parse `@specifier` only when no :specifier: is present.
DeltaFile
+2-1llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp
+3-0llvm/test/MC/AArch64/arm64-diags.s
+5-12 files

LLVM/project 03cbe93compiler-rt/test/fuzzer merge-sigusr.test

[fuzzer] Restrict merge-sigusr.test to Linux (#216702)

The `fuzzer/merge-sigusr.test` test causes the whole `ninja check-all`
run on NetBSD to be killed with `SIGUSR2`.

It turns out the test is highly Linux-specific in at least two ways:

- The `setsid` command doesn't exist on any of Darwin, FreeBSD, and
NetBSD.

- `ps -o sess= <pid>` is highly unportable, too:

  - FreeBSD `ps` doesn't have the `sess` keyword at all.

- NetBSD `ps` does, but with different semantics: it's the session
pointer, not the session id as on Linux, which leads to randomly killing
unrelated processes.

Therefore this patch restricts the test to Linux instead of simply

    [6 lines not shown]
DeltaFile
+3-3compiler-rt/test/fuzzer/merge-sigusr.test
+3-31 files

LLVM/project 01efbeacompiler-rt/test/msan fork.cpp, compiler-rt/test/sanitizer_common/TestCases/Posix fork_threaded.c

[sanitizer] Skip hanging tests on FreeBSD (#216703)

Three sanitizer tests hang indefinitely on FreeBSD:

```
MemorySanitizer-X86_64 :: fork.cpp
SanitizerCommon-tsan-x86_64-FreeBSD :: Posix/fork_threaded.c
ThreadSanitizer-x86_64 :: fork_multithreaded.cpp
```

All of them loop and don't time out, so they need to be terminated
manually for `ninja check-all` to complete. To avoid this, this patch
skips the affected tests.

Tested on `x86_64-pc-freebsd15.1`, `x86_64-pc-netbsd11.0` and
`x86_64-pc-linux-gnu`.

(cherry picked from commit cb2f67d1556c1232f99b4512a35129ec04f73c75)
DeltaFile
+3-0compiler-rt/test/sanitizer_common/TestCases/Posix/fork_threaded.c
+1-1compiler-rt/test/msan/fork.cpp
+2-0compiler-rt/test/tsan/fork_multithreaded.cpp
+6-13 files

LLVM/project 539a51allvm/lib/Transforms/InstCombine InstCombineSelect.cpp, llvm/test/Transforms/InstCombine select-bitext.ll

[InstCombine] narrow select to match trunc condition operand size (#219794)

changed to matches the cmp handling and avoids some regressions from
https://github.com/llvm/llvm-project/pull/184182
DeltaFile
+26-0llvm/test/Transforms/InstCombine/select-bitext.ll
+2-2llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
+28-22 files

LLVM/project 492a3a4llvm/lib/Transforms/InstCombine InstCombineCasts.cpp, llvm/test/Transforms/InstCombine cast-select.ll

[InstCombine] Don't change the size of a select if it would mismatch its trunc condition operand size (#219789)

Matching cmp handling and stops infinit loop for
https://github.com/llvm/llvm-project/pull/219794
DeltaFile
+77-0llvm/test/Transforms/InstCombine/cast-select.ll
+3-2llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
+80-22 files

LLVM/project 98f0f00flang/include/flang/Semantics openmp-modifiers.h openmp-utils.h, flang/lib/Semantics check-omp-loop.cpp resolve-directives.cpp

[flang][OpenMP] Switch OpenMP version from unsigned to llvm::omp::Version

Also make llvm::omp::Version converting constructor/operstor explicit.
DeltaFile
+91-88flang/lib/Semantics/check-omp-structure.cpp
+20-18flang/include/flang/Semantics/openmp-utils.h
+18-17flang/lib/Semantics/openmp-utils.cpp
+10-10flang/include/flang/Semantics/openmp-modifiers.h
+7-7flang/lib/Semantics/resolve-directives.cpp
+6-6flang/lib/Semantics/check-omp-loop.cpp
+152-14621 files not shown
+220-20227 files

LLVM/project 7e20a1aclang/include/clang/AST OpenMPClause.h, clang/lib/AST DeclPrinter.cpp StmtPrinter.cpp

[clang][OpenMP] Switch OpenMP version from unsigned to llvm::omp::Version
DeltaFile
+61-58clang/lib/Sema/SemaOpenMP.cpp
+16-16clang/lib/Parse/ParseOpenMP.cpp
+6-9clang/lib/AST/StmtPrinter.cpp
+4-3clang/lib/Sema/TreeTransform.h
+3-3clang/lib/AST/DeclPrinter.cpp
+3-2clang/include/clang/AST/OpenMPClause.h
+93-912 files not shown
+98-928 files

LLVM/project 968f030clang/lib/AST/ByteCode Source.h Source.cpp

[clang][bytecode][NFC] Remove unused SourceMapper functions (#219786)
DeltaFile
+0-12clang/lib/AST/ByteCode/Source.cpp
+0-6clang/lib/AST/ByteCode/Source.h
+0-182 files

LLVM/project 65a8ecdflang/include/flang/Semantics openmp-modifiers.h openmp-utils.h, flang/lib/Semantics check-omp-loop.cpp resolve-directives.cpp

[flang][OpenMP] Switch OpenMP version from unsigned to llvm::omp::Version

Also make llvm::omp::Version converting constructor/operstor explicit.
DeltaFile
+91-88flang/lib/Semantics/check-omp-structure.cpp
+20-18flang/include/flang/Semantics/openmp-utils.h
+18-17flang/lib/Semantics/openmp-utils.cpp
+10-10flang/include/flang/Semantics/openmp-modifiers.h
+7-7flang/lib/Semantics/resolve-directives.cpp
+6-6flang/lib/Semantics/check-omp-loop.cpp
+152-14621 files not shown
+220-20227 files

LLVM/project 5e5d1adclang/include/clang/Basic LangOptions.h, clang/lib/AST DeclPrinter.cpp StmtPrinter.cpp

[clang][OpenMP] Switch OpenMP version from unsigned to llvm::omp::Version
DeltaFile
+61-58clang/lib/Sema/SemaOpenMP.cpp
+16-16clang/lib/Parse/ParseOpenMP.cpp
+6-9clang/lib/AST/StmtPrinter.cpp
+4-3clang/lib/Sema/TreeTransform.h
+3-3clang/lib/AST/DeclPrinter.cpp
+6-0clang/include/clang/Basic/LangOptions.h
+96-892 files not shown
+100-928 files

LLVM/project b369c19llvm/include/llvm/Frontend/OpenMP OMPDescriptors.h OMPVersion.h, llvm/lib/Frontend/OpenMP OMPDescriptors.inc

[OpenMP] Make OpenMP version have separate type

It's unsigned now. Giving it a separate type would make the code clearer,
and it would make it easier to change the effective type if it's ever
needed.
DeltaFile
+788-788llvm/lib/Frontend/OpenMP/OMPDescriptors.inc
+63-0llvm/include/llvm/Frontend/OpenMP/OMPVersion.h
+29-17llvm/utils/TableGen/Basic/DirectiveEmitter.cpp
+13-13llvm/test/TableGen/directive1.td
+12-12llvm/test/TableGen/directive2.td
+10-10llvm/include/llvm/Frontend/OpenMP/OMPDescriptors.h
+915-84011 files not shown
+975-88917 files