AMDGPU: Fold global address into subregister use with lo/hi relocation (#237041)
Split 64-bit relocations into the 32-bit halves when applying a
subregister extract, similar to how immediates are modified when
folding. The same split is applied when 64-bit mov pseudos are
expanded.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[SimplifyLibCalls] Annotate wcslen pointer argument if folding fails (#240333)
Following `optimizeStrLen`. The call reads at least the terminating wide
character, so the dereferenceable size is the size of wchar_t.
Assisted-by: Claude
[BOLT][AArch64] Don't patch short-range PC-relative refs in un-emitted code (#221344)
scanExternalRefs() updates references in functions that BOLT does not
emit by creating instruction patches. For a bare PC-relative reference,
such as ADR or LDR (literal), the patch cannot be encoded once the
referenced function is moved: both forms reach only +/-1MB, while the
new code is typically several MB away. JITLink then reports the fixup as
out of range and BOLT fails, e.g.:
BOLT-ERROR: JITLink failed: In graph in-memory object file, section
.local.text.__BP_0: relocation target 0x400014
(<anonymous symbol>:0x400000 + 0x14) is out of range of ADRLiteral21
fixup at address 0x400000 (__BP_0, 0x10230 + 0x0)
There is an existing check for this, but it only runs when the
instruction has a relocation. For a local symbol in the same section the
assembler resolves the reference itself, in which case the reference is
created by the symbolizer from the instruction's immediate and
getRelocationAt() returns nothing.
[12 lines not shown]
[mlir][arith] Fix division by zero in divui divisibility inference (#240106)
DivUIOp::inferResultDivisibility divides by a constant right-hand side
without checking for zero, so a zero divisor raises SIGFPE. Bail out
instead, since arith.divui by zero is undefined and there is nothing to
infer.
Fixes #239604
[mlir][ODS] Add DefaultValuedEnumProp (#240360)
Giving an enum property a default currently means subclassing `EnumProp`
and spelling the default as `Enum.cppType # "::Case"`, or wrapping it in
`DefaultValuedProp` with the same hand-written string.
`DefaultValuedEnumProp<Enum, Case>` takes the `EnumInfo` and one of its
`EnumCase` defs, mirroring `DefaultValuedEnumAttr`, and asserts at
TableGen time that the case belongs to the enum. `GEPNoWrapFlagsProp`
and the test dialect's default-valued enum props switch to it.
Assisted-by: Claude Code (Claude Fable 5.1).
[SLP]Do not match the scalable compare for the select conditions
The select conditions cannot be all lanes of a scalable vector compare,
which number is unknown.
Fixes #240459
Assisted-by: Cursor
Reviewers:
Pull Request: https://github.com/llvm/llvm-project/pull/240483
[lldb-dap][ext][NFC] Use one `dap` module for protocol types (#240443)
Have only one module for the DAP types. This prevents creating new
LLDBXXXX classes when extending one of the DAP types.
[DWARFLinker][Determinism] Clear the string offsets map of a unit that is cloned again (#240432)
While trying to optimize the parallel linker, I found that the output
wasn't always deterministic. Tracking it down with an agent, I found
this edge case where maybeResetToLoadedStage() doesn't clear the
.debug_str_offsets.
Context from agent:
When the parallel linker finds that an already cloned compile unit is
referenced by another unit, it resets the unit with
maybeResetToLoadedStage() and clones it again. The reset cleared the
abbreviations, the address index map and the output sections, but not
the map from strings to their .debug_str_offsets indexes. The second
cloning therefore kept the indexes assigned by the first one, and those
depend on whether, and how far, the unit had been cloned when it was
found to be referenced. With DWARF 5 inputs, the DW_FORM_strx indexes,
the .debug_str_offsets contents and the order of .debug_str could change
from one run to the next.
[7 lines not shown]
[CIR] Shard the dialect naturally along op partitions
Replace the count-based `-op-shard-count=8` sharding of CIROps.td with the
op partitions introduced by the ODS natural sharding (llvm/llvm-project
PR 239254). Each of the eleven partitions (Core, Symbols, ControlFlow,
Arith, Builtins, Math, Coroutine, EH, VectorMatrix, Complex, ClassMembers)
is generated into its own CIROps<Partition>.{h,cpp}.inc, declared by its own
CIROps<Partition>.h on top of the new CIRDialectBase.h (the dialect,
attributes, types and interfaces without any op), and compiled in its own
CIROps<Partition>.cpp together with the hand-written op code that used to
live in CIRDialect.cpp. CIRDialect.h becomes an umbrella over the
partition headers, so existing includers are unchanged; files that use no
op switch to CIRDialectBase.h.
Assisted-by: Claude Code (Fable 5.1).
[InstCombine] Canonicalize null checks of pointer umax selects (#233501)
Decompose an unsigned pointer maximum compared equal to null into a
logical AND of input null comparisons when the null representation is
all-zero. Require both the select and its condition to have one use to
avoid increasing the instruction count.
Fixes #199402
Proof: https://alive2.llvm.org/ce/z/CTUdtN
Assisted-by: GPT 6
[AMDGPU] Finalize atomic loads before inserting waits after them (#239590)
In SIMemoryLegalizer::expandLoad, finalizeLoad and setCFS were called
after the acquire/seq_cst waits had been inserted. Inserting a wait
after
the load moves MI to point at the new wait instruction, so these calls
operated on the wait instead of the load:
- load_monitor instructions with acquire or seq_cst ordering at a scope
that maps to SCOPE_CU (e.g. workgroup) were not raised to SCOPE_SE.
- Acquire and seq_cst atomic loads lost their !amdgpu.cfs cache fill
size.
Call them before inserting the waits instead.
Co-Authored-By: Claude Opus 5.5 <noreply at anthropic.com>
[mlir][SPIR-V] Add SPIRVToLLVM conversion for InBoundsAccessChain (#238743)
Integration/GPU/SPIRV tests fail to legalize since #216984 started
emitting this op
[clang][NVPTX] Init GPU_LAST via NVPTXTargetParser.def (#240417)
In #213362, the GK_LAST sentinal was added to the GPUKind enum by
manually defining it as GK_SM_121f.
To avoid manually assigning GK_LAST, instead count the rows in
`NVPTXTargetParser.def` via a macro. This keeps the alias correct when
architectures are added without having to manually update this enum.
[Clang][OpenMP] Fix crash on `cancel taskgroup` inside `masked taskloop` (#240335)
Fixes #154552
`#pragma omp cancel taskgroup` inside a `masked taskloop` asserted in
`getOMPCancelDestination`. The cancel is emitted in the outlined task
function, whose exit target came from a list of directive kinds that
stopped at `master taskloop`, so `OMPD_masked_taskloop` fell through to
the worksharing assertion. `parallel masked taskloop` and `cancellation
point taskgroup` hit it too.
Pick the target with `isOpenMPTaskingDirective`, so every task-based
region returns from its outlined function, and read `HasCancel` from the
masked `taskloop` directives like the master ones.
AI Aided!
[AMDGPU] Register async barrier warning option during parser initialization
Keep the warning flag in constant-initialized storage and register its
command-line option in LLVMInitializeAMDGPUAsmParser. This avoids a
file-scope cl::opt destructor rejected by -Werror=global-constructors
while retaining the default warning and explicit opt-out.
[clang][CIR][NFC] Explicitly cast values to avoid narrowing implicit conversion (#239951)
Use `static_cast` to explicitly convert the 64 bit int values to the
expected `int32_t` type to avoid narrowing implicit conversions from 64
bit int to 32 bit int values.
Signed-off-by: Hardik Kumar <hardikxk at gmail.com>
[SystemZ] Introduce SystemZCodeGenPassBuilder
Standard NewPM CodeGenPassBuilder implementation. Tries to mirror the
existing SystemZTargetPassConfig as much as possible.
Reviewers: JonPsson1, uweigand
Pull Request: https://github.com/llvm/llvm-project/pull/240268
[libc++] Add a target to validate the conformance status CSV files (#238977)
This adds a libcxx-validate-conformance-csvs target which runs
`libcxx/utils/conformance csv validate` on all the status CSV files, to
make sure they don't get broken. Also add to the CI jobs.
[libc][math] Fix low-precision range reporting and rounding (#236472)
Group five related fixes that share implementation or test-registration
files:
- Raise overflow/inexact for directed finite exponential overflow
results.
- Avoid intermediate range exceptions in atanbf16, expbf16 and exp2bf16,
and correct expbf16 underflow rounding.
- Correct sinhf16 subnormal rounding/reporting and exp2m1f16 at 0x8461.
Finite-overflow errno choices are unchanged. The exp2m1f16 correction
uses
the accurate pass. The expm1f16 subnormal fix in #236310 is not
included.
Tests: 38 smoke configurations per compiler with GCC 13 and Clang 18 on
x86-64 Linux. MPFR 4.2.1 value checks cover five functions' finite
domains
in all four rounding modes; exception/errno checks cover scoped inputs.
[5 lines not shown]