[RISCV] Reassociate exts in ext/add reduction tree (#230928)
With an ext-add-ext-add pattern, the second ext can be pushed to after
the final add if the first ext adds enough bits to guarantee that the
second add won't overflow even without the second ext.
Further optimize ext-add reduction in x264 sad_NxN, building on #230657.
AI Usage: Assisted by Codex
[LV] Add epilogue test with FP IV with same start and step (NFC) (#235987)
Add a test with an fadd and an fsub induction that share start and step
values, to make sure each resumes from its own value in the epilogue
vector loop.
Revert "[KnownFPClass] Refactor NaN sign encoding for KnownFPClass" (#235992)
Reverts llvm/llvm-project#220606
Breaks the build with GCC, since
`KnownFPClass::toFPClassMask(FPClassTest, bool)` is not a constant
expression, because the compound assignment operators (`|=`, `&=`, `^=`)
in `llvm/ADT/BitmaskEnum.h` are not `constexpr`.
[llubi] Add support for llvm.masked.store. (#235876)
Re-use the logic for llvm.masked.load to also support llvm.masked.store.
The mask/pointer arithmetic logic is the same for both intrinsic.
PR: https://github.com/llvm/llvm-project/pull/235876
[InstCombine] Share common binop folds between icmp and [su]cmp (#222978)
This PR extends #216157, which adds a missed `[su]cmp` fold for matching
operands in order-preserving/reversing binops (covers `add`, `sub`,
`mul`)
- Extracted common-operand logic from `foldICmpBinOp()` into a
`matchCommonBinOpOperands()` helper function for `icmp`, `scmp`, and
`ucmp`. However, existing specialized `icmp` equality and signed
multiplication folds remain separate - see current state of
`foldICmpBinOp()`.
- The helper accepts the comparison predicate by reference so `icmp` can
canonically keep operand order (predicate flips with an order-reversing
operation), while `[su]cmp` can use the predicate to swap operand order
afterward.
- `m_AddLike` is explicitly used in the helper to support `or disjoint`
for `[su]cmp`, equivalent to non-wrapping addition.
- Moved `hasNoWrapProblem()` outside into a file-level function for both
the new helper and existing passes that rely on it.
[14 lines not shown]
[RISCV] Double the cost of slides (#232827)
From what I've measured and from what I can read on
https://camel-cdr.github.io/rvv-bench-results, vslideup and vslidedown
generally aren't pipelined to the same degree as arithmetic ops. This,
combined with the fact that they require a vsetvli toggle which we don't
currently cost for, makes shufflevector sequences emitted by SLP
expensive on hardware.
Doubling the costs of the slides prevents unprofitable SLP vectorization
in 525.x264_r, and improves performance by 3.91% on the SpacemiT-K3,
-march=rva23u64 -O3 -flto. There were no other noticeable changes on
SPEC CPU 2017.
[X86][AsmParser] Fix Intel mask position for AVX512PF prefetch instructions (#233869)
AVX512PF gather/scatter prefetch instructions reject a memory operand
followed by a mask decorator in Intel syntax. LLVM also prints the mask
as a leading operand, producing Intel disassembly that cannot be
reassembled.
Move the mask after the memory operand in the Intel assembly variant of
`avx512_gather_scatter_prefetch`. Preserve the AT&T variant and the
outer dialect selection so the literal mask braces survive TableGen
processing.
Add Intel MC tests for all 16 mnemonics, using the 32 existing AT&T
encoding expectations. Cover sized/unsized memory, high VSIB registers,
YMM/ZMM indices, k1-k7, scaled addressing, compressed displacement, and
assembly output round trips. Add diagnostics for missing/zero masks,
zeroing, incorrect VSIB widths, and incorrect memory size.
Update the existing APX disassembler expectation to the corrected mask
[13 lines not shown]
[VPlan] CSE replicated loads (#234525)
This improves a pattern found in 736.ocio_r, see
https://github.com/llvm/llvm-project/pull/195886#issuecomment-6196462669
In the following loop `s` isn't noalias, so a runtime alias check needs
to be added:
```c
void f(const float *s, const unsigned short *in, float *out, long n) {
for (long i = 0; i < n; i++) {
out[4 * i + 0] = in[4 * i + 0] * *s;
out[4 * i + 1] = in[4 * i + 1] * *s;
out[4 * i + 2] = in[4 * i + 2] * *s;
out[4 * i + 3] = in[4 * i + 3] * *s;
}
}
```
[65 lines not shown]
[KnownFPClass] Refactor NaN sign encoding for KnownFPClass (#220606)
Part of https://github.com/llvm/llvm-project/issues/217072
Replaces the `struct` layout for `KnownFPClass`
```c++
struct KnownFPClass {
FPClassTest KnownFPClasses;
std::optional<bool> SignBit;
};
struct KnownFPClass {
FPClassMask KnownFPMask;
};
```
I also added conversion functions between `FPClassTest` and
`FPClassMask`.
[AMDGPU] Report packed F32 unpacking as a change (#234859)
SIPreEmitPeephole::run did not set Changed after unpacking, so when
unpacking was the only change the new pass manager kept every cached
analysis and the legacy one saw an unchanged function.
Assisted-by: Claude Opus 5.5
[lldb] Report why a script interpreter is unavailable (#235947)
When Python can't be loaded, no plugin registers for it and LLDB falls
back to ScriptInterpreterNone, which claims LLDB was built without
scripting support. The real error was dropped during initialization.
Record the error per language in the PluginManager where the failure
happens, and pass the requested language to the create callback so
ScriptInterpreterNone can report it from the relevant commands.
For a language LLDB was built with but has no recorded error, report
that its plugin wasn't loaded.
rdar://190746062
Assisted-by: Claude
[DebugInfo] Preserve original value when replacing instructions (#234978)
There are several places in `correlated-propagation` where an
instruction is replaced without salvaging the debug info. The value
computed by the new instruction may be different to the original that
was replaced. This leads to debuggers like lldb reporting incorrect
values for variables (reporting the value of the new instruction).
This PR makes sure the compiler salvages the debug information of the
replaced instructions before replacing them.
(See issues #218621, #218622, #218623 and #218366)
(Pinging @MrEven132, since I can't add as a reviewer)
[DebugInfo] Salvage replaced and instructions (#234693)
When `correlated-propagation` removes and instructions, it doesn't
correctly salvage the debug info. This leads to variables having
incorrect debug info. This patch makes sure we salvage the debug info
before removing the instructions
(See https://github.com/llvm/llvm-project/issues/219940)
Pinging @MrEven132 since I can't seem to add as a reviewer
[scudo] Omit quarantine state when QuarantineDisabled (#235117)
When QuarantineDisabled is true, GlobalQuarantine still occupies 192
bytes (three cache lines) in Allocator and QuarantineCache occupies 32
bytes (plus 32 bytes of cache-line tail padding) in each TSD.
Allows the now empty classes to be empty by using [[no_unique_address]].
[compiler-rt][Android] Filter out linker warnings from stderr in android_run.py (#235973)
Older Android dynamic linkers (e.g. API 24) print `WARNING: linker: ...`
lines to stderr for newer ELF flags/tags such as `DT_FLAGS_1=0x8000001`
(`DF_1_PIE`) and `DT_AARCH64_BTI_PLT` (`0x70000001`). When these lines
are emitted at startup or when spawning `llvm-symbolizer`, they break
tests using `count 0`, `CHECK-NEXT`, or `CHECK-NOT` on
https://lab.llvm.org/buildbot/#/builders/sanitizer-x86_64-linux-android.
Strip `^WARNING: linker: .*` lines from stderr in `android_run.py`,
matching `libcxx/utils/adb_run.py`.
Assisted-by: Gemini
[lldb] Return llvm::Error from breakpoint callback setters (#235964)
Have ScriptInterpreter::SetBreakpointCommandCallback and
SetBreakpointCommandCallbackFunction return llvm::Error instead of
Status, converting back to SBError at the API boundary.
Requiring the error to be handled surfaces two dropped errors:
- The Python SetBreakpointCommandCallbackFunction ignored the result of
generating the callback.
- Deserializing a breakpoint reported the outer, still-empty Status
instead of the script error.
Assisted-by: Claude
[lldb][CMake] Link static libraries before liblldb (#235949)
The static linker resolves each undefined symbol from the first library
on the command line that defines it. When liblldb re-exports private
symbols, for example with LLDB_ENABLE_DYNAMIC_SCRIPTINTERPRETERS, tools
that list liblldb before lldbHost and lldbUtility bind part of those
libraries to liblldb and the rest to their own static copies.
List liblldb last so the static libraries take precedence. On Linux,
`lldb_prevent_liblldb_symbol_interposition` already covers this with
--exclude-libs.
[ci] Create a monorepo-wide workflow to submit to LNT (#235863)
Lift the libc++ specific workflow into one that is clearly decoupled
from libc++ and can be reused by other projects in the monorepo. This is
intended to support other projects submitting data into LNT.
One interesting question is whether we want all jobs to use the same
token. In LNT v5, a token can be scoped to specific test suites (e.g. a
token can be limited to submitting only to the libcxx test suite). Right
now, this workflow assumes that the token in use can submit to the
provided suite, and all submissions would use the same token, which
would be unscoped.
I think this is fine, at least for now, but we could potentially revisit
this decision in the future.
[mlir][math] Add a set-llvm-linkage option to convert-math-to-funcs (#235961)
`--convert-math-to-funcs` adds a `llvm.linkage` attribute to each
generated function (which is consumed by FuncToLLVM), but this breaks
other pipelines, such as FuncToEmitC, since `mlir-translate
--mlir-to-cpp` registers only the cf, emitc and func dialects (but not
llvm) so
```
mlir-opt --convert-math-to-funcs --convert-arith-to-emitc --convert-func-to-emitc in.mlir \
| mlir-translate --mlir-to-cpp --declare-variables-at-top
```
fails on, e.g., `math.ipowi` with "#llvm.linkage<...> attribute created
with unregistered dialect".
This adds a `set-llvm-linkage` option to `--convert-math-to-funcs`
(default on) and leaves the attribute off when the flag is set to off.
[WebAssembly] Fix Analysis Preservation for GISel Passes (#235960)
These are preserved by the LegacyPM so also mark them as preserved by
the NewPM versions.