[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.
[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).
[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
[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.
[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]
[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)
[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
[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
[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.
[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.
Revert "[clang] Don't add documentation comments to the AST if not requested" (#219807)
Reverts llvm/llvm-project#206363 due to huge compile-time regression.