[KnownFPClass] Fix minnum/maxnum sNaN propagation (#233986)
Fixes https://github.com/llvm/llvm-project/issues/233270
Per the LangRef, `minnum`/`maxnum` may return NaN if either input is
sNaN.
`simplifyFCmpInst` also needs to handle `ord`/`uno` for `fcmp
(minnum/maxnum X, C2), C1`, since these would otherwise hit
`llvm_unreachable`. They no longer fold if `X` may be an sNaN. The
existing folds for the other predicates in that switch are unchanged.
A lot of AMDGPU tests involving `minnum`/`maxnum` were changed. So I
"duplicated" the tests to have a no-sNaN version. sNaN was ruled out via
`llvm.canonicalize` if I couldn't write `nofpclass(snan)` directly. I
attempted to make the "duplicated" tests as close to the original as
possible.
AI Disclosure:
I used Claude Opus 5 and Claude Opus 5.5 to help implement the changes,
along with writing and "duplicating" the tests.
[NFC][SLP] Directly call Candidate.getRootNode() from BoUpSLP funcitons (#246934)
Eventually will pass in Candidate as a function parameter to these
functions rather than store Candidate in BoUpSLP.
AI Usage: Codex assisted
[SPARC] Add R_SPARC_JMP_IREL to the relocation list (#246966)
R_SPARC_JMP_IREL (248) is the PLT relocation for an ifunc, which glibc's
sparc64 ld.so handles. It was missing from Sparc.def, so llvm-readelf
and llvm-objdump could not name it.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[Support][llvm-mc] Match the full diagnostic message in llvm-mc --verify (#242553)
Like Clang's -verify, `llvm-mc --verify` directives currently match a
substring of the diagnostic message, so tests that want to check the
complete message cannot use --verify (see #242096).
Since --verify is new in llvm-mc, make it match the full message by
default: plain directives must equal the message and `-re` directives
must match all of it. `--verify-allow-partial-match` restores substring
matching. MLIR's verifier keeps substring matching.
Update the RISC-V tests that relied on substring matches.
Assisted-by: AI tooling
Pull-Request: https://github.com/llvm/llvm-project/pull/242553
[lld][MachO] Stream FunctionStartsSection from laid-out code sections
Currently, `FunctionStartsSection::finalizeContents()` scans every
`ObjFile`'s full symbol table, resolves `defined->getVA()` for each live
code symbol, sorts all addresses with `llvm::sort`, and encodes ULEB128
deltas through `raw_svector_ostream`.
By the time `FunctionStartsSection::finalizeContents()` runs, output
segments, their sections, and each `ConcatOutputSection`'s inputs are
already laid out in ascending virtual address order, and each input
section's `symbols` list is kept sorted by offset. This PR walks those
laid-out code sections directly and streams ULEB128 deltas straight into
`contents` via `llvm::appendLEB128`. If a malformed input produces an
out-of-order symbol address, it reports an `error()` and skips the
symbol.
To avoid calling `isCodeSection()` on every subsection, we add a
`SectionView` wrapper so `isCodeSection()` can accept either a `Section`
or an `InputSection`, and cache its result across consecutive inputs
[10 lines not shown]
[Mips] Set _MIPS_SPFPSET to 16 before MIPS32 with 32-bit FPRs (#246579)
Before MIPS32, single-precision arithmetic can't use the odd FPRs when
the FPRs are 32 bits wide, and the backend doesn't use them there.
Clang still defined _MIPS_SPFPSET as 32 for MIPS I, and for MIPS II to
MIPS IV with -mfp32. Define it as 16 there, as GCC does. A single-float
FPU such as the R5900 has 32 single-precision FPRs, so single-float is
not changed.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[Support][mlir] Check verify directives in buffers without diagnostics (#233307)
Buffers added after the verifier was created (e.g. `.include`d files)
were only scanned when a diagnostic was reported in them, so their
directives were never checked if they produced no diagnostics. Scan all
buffers in `verify()` and when looking for `@unknown` directives, and
make calling `verify()` again not report the same directives twice.
This means callers no longer need to scan their buffers up front, so
we can drop that from llvm-mc and MLIR's handler.
Assisted-by: AI tooling
Pull-Request: https://github.com/llvm/llvm-project/pull/233307
[Support] Track verify directives per buffer instead of per file name (#233306)
Expected diagnostics were looked up by by buffer identifier, so buffers
with the same name shared one list, and a diagnostic in one buffer could
match a directive in another. Use the buffer as the key instead and
check them in registration order to be deterministic.
Assisted-by: AI tooling
Pull-Request: https://github.com/llvm/llvm-project/pull/233306
[Support][mlir] Highlight the whole directive in verifier errors (#233309)
The highlighted range started at the directive but had the length of the
expected text, so it usually ended in the middle of the directive.
Highlight up to and including the closing `}}` instead.
Assisted-by: AI tooling
Pull-Request: https://github.com/llvm/llvm-project/pull/233309
[Support] Fix parsing of line offsets in verify directives (#233305)
`@+N` and `@-N` offsets were parsed with `getAsInteger(0, ...)` and the
result was never checked. So `@+010` was read as octal (8), `@+08`
failed to parse and left the offset uninitialized, and offsets before
the start or past the end of the file silently wrapped around.
Always force decimal parsing and report an error if they are invalid or
out of bounds. Line 0 is still allowed because MLIR uses it for the
implicit top-level module.
Assisted-by: AI tooling
Pull-Request: https://github.com/llvm/llvm-project/pull/233305
[Support][llvm-mc] Add baseline tests for SourceMgrDiagnosticVerifier bugs (#236283)
These will be fixed by the following commits.
Assisted-by: AI tooling
Pull-Request: https://github.com/llvm/llvm-project/pull/236283
[RISC-V][MC] Remove dead CHECK lines from converted --verify tests (#238224)
These CHECK lines used prefixes that no RUN line passed to FileCheck, so
they were never checked and the conversion to --verify left them alone.
Assisted-by: AI tooling
Pull-Request: https://github.com/llvm/llvm-project/pull/238224
[libc][test] Fix dangling temporary CString pointers in unit tests (#241063)
libc_make_test_file_path returns a temporary CString wrapping an owning
cpp::string. Passing its implicit const char * conversion directly to
TESTONLY_set_group_path (which stores the raw pointer without copying in
getgrouplist_test.cpp and initgroups_test.cpp) leaves a dangling heap
pointer once the full-expression ends whenever the filename exceeds
cpp::string's short-string buffer.
Annotate CString's pointer and string_view accessors with
LIBC_LIFETIMEBOUND so Clang diagnoses temporary lifetime escapes at
compile time, allow default and move construction/assignment on CString
for test fixture members, and keep the CString objects alive in
getgrouplist_test and initgroups_test.
Assisted-by: Gemini
[LV] Add tests with dead vector loops (NFC). (#247011)
Add tests where the main or epilogue vector loop is dead due to the trip
count, with VF and IC chosen by the cost model or forced by the user.
[VPlan] Remove redundant execute/printRecipe declarations (NFC) (#247012)
VPRecipeWithIRFlags, VPHeaderPHIRecipe and VPWidenInductionRecipe
re-declare the pure virtual VPRecipeBase::execute (and VPHeaderPHIRecipe
also VPRecipeBase::printRecipe) as pure virtual with the same signature,
which has no effect.
VPInterleaveBase::execute is unreachable: VPInterleaveBase is abstract
(clone is pure virtual) and both VPInterleaveRecipe and
VPInterleaveEVLRecipe override execute.
Assisted-by: Opus 5.5
[RISC-V][MC] Convert remaining diagnostic tests to llvm-mc --verify (#238223)
Convert the remaining RISC-V MC diagnostic tests (41 files: 2 newly
convertible tests, Relocations/leb128.s and rvv/xsfvfofp4min.s, plus 39
tests that need manual changes on top of
`convert_mc_test_to_verify.py --inline`):
- Add 273 directives for diagnostics that the FileCheck lines did not
check, mostly "invalid instruction" (154) and "instruction requires
the following: ..." from RUN lines without the extension (e.g. the
xqci*, xmips, xsmtvdot*, rvzacas, and zicfiss tests).
- Move directives that the script attached to the wrong instruction
because their CHECK lines had no line numbers (mostly the *c-valid.s
and *zacas-valid.s tests).
- Fix 8 directives in rv32c-fuzzed-invalid.s whose CHECK lines only
matched the echoed source line rather than the real diagnostic.
Assisted-by: AI tooling
[Attributor] Merge the scopes of potential values with a `|=` (#246909)
`recurseForValue` merges the scopes of a value with `+=`. If a value
appears more than once in the values of one scope, the sum is not a
valid scope.
This PR was assisted by AI but I reviewed all the changes.