[mlir-c] Add mlirEmitWarning and mlirEmitRemark (#206542)
Adds C API entry points for emitting warning and remark diagnostics, complementing the existing `mlirEmitError`.
Assisted by: Claude
[AArch64][SME] Drop ZA marker on tail calls and lower as sibling calls
A tail call from a function with live ZA state was previously prevented
from being lowered as a sibling call to have a CALLSEQ_START to glue
INOUT_ZA_USE to. This led to bogus stack restores.
We now drop the INOUT_ZA_USE marker on tail calls and can thus lower as
sibling calls if needed to take advantage of the existing correct stack
restore behavior.
This is safe to do since tail calls use TCRETURN and the MachineSMEABI
pass requires live ZA state to stay live across returns anyway.
[Clang] Restrict darwin-static-lib-universal.c in cross-builds (#225447)
A new test was added in 841dbaab188ecfa756d4c946f33b58758d34d339 which
will fail when run on macOS if macOS is not set as the default target.
This has previously been solved in other tests by further restricting
the REQUIRES line to also check the target.
[lldb][NativePDB] don't assert when a public symbol sits past its section (#225734)
Fix an assertion failure in `SymbolFileNativePDB::AddSymbols` when a
public symbol's offset doesn't agree with its section's size (happens
with real-world PDBs after incremental linking). Instead of asserting,
we now log and skip the size estimate for that symbol.
Also adds a regression test that crafts such a PDB and checks lldb
doesn't crash.
This fixes crashes in swiftlang.
CodeGen: Mark dead PHI destination copies dead in the LiveIntervals path
When PHIElimination lowers a PHI whose destination is dead, it records a
dead def in LiveIntervals but did not set the dead flag on the lowered copy's
def operand. The LiveVariables path set this via addVirtualRegisterDead.
Avoids "Instruction ending live segment on dead slot has no dead flag" verifier
errors once LiveVariables is removed.
Co-authored-by: Claude (Opus 4.8) <noreply at anthropic.com>
Reapply "[AMDGPU] Remove definition of hi16 for scalar registers (#197467)" (#201552)
This reapplies #197467. The regression uncovered by this PR has been
fixed in #223653 and a test was added to verify that
`llvm/test/CodeGen/AMDGPU/issue197467-virt-reg-rewrite-failure.mir`.
[DAG] Don't detect flippable signs in MinMax matchers (#220527)
The Min/MaxLike pattern matchers are the only pattern matchers that use
computeKnownBits. They're used to match a smax as a umax if the operands
are known positive and so forth.
However in practice it has no affect on real-world codegen as correlated
value propagation already does this transform earlier in the pipeline,
including for all the tests changed in this PR:
https://llvm.godbolt.org/z/Pr4Ec1xrv
Nothing in the backends will emit a min/max that needs re-transformed in
this way as far as I'm aware.
Removing computeKnownBits from these matchers allows us to remove the
match context in #218372, and saves some compilation time at O3
https://llvm-compile-time-tracker.com/compare.php?from=2f2aa940de68abcdfe4959ddd3b9a0741a7c2a16&to=b771556fb2a7e9c2cb0c853a4a71ea9641e5ede0&stat=instructions:u
[ELF] Retain relocation sections for GOT entries added by relaxOnce (#225594)
x86-64 and SystemZ relax GOTPCRELX/GOTENT and, in relaxOnce, revert
relaxations that turn out to be out of range or misaligned. The reverted
relocation needs a GOT entry, which in -pie/-shared needs a relative
relocation. If .rela.dyn (or .relr.dyn) was empty, it has already been
removed by removeUnusedSyntheticSections, triggering an assertion
failure.
Retain the section that will receive the relative relocations when
relaxOnce may add GOT entries, and recompute .dynamic in each iteration.
This also fixes a truncated .dynamic when PPC64 PI long-branch thunks
add the first relative relocations to .rela.dyn.
LLM-aided. Fixes #224011
[Clang] Fix integer promotion of bit-fields in statement expressions (#225597)
`Expr::getSourceBitField()` now looks through the final expression of a
statement expression to preserve the bit-field information. This allows
the existing integer promotion rules to correctly promote the bit-field
to `int`.
Also added a regression test for the issue.
Fixes #221542
[DirectX] Set TypedUAVLoadAdditionalFormats on UAV texture loads (#225484)
Fixes https://github.com/llvm/llvm-project/issues/225147
This PR makes the `TypedUAVLoadAdditionalFormats` shader flag get set on
UAV texture loads.
Assisted by: GPT 5.6 Sol
[Support] Remove cl::DefaultOption (#225609)
https://reviews.llvm.org/D59746 added cl::DefaultOption so that the
built-in -h could be overridden by llvm-objdump and llvm-readobj, which
have since moved to OptTable. The remaining overrides just call
PrintHelpMessage, so remove them along with the flag. -h and --help
keep working in every tool.
LLM-aided
[SPIRV] Add support for dynamic/heap resources (#224488)
Extends the `SPIRVLegalizeImplicitBinding` pass to support heap
resources and renames it to `SPIRVLegalizeImplicitAndHeapBinding`.
The pass scans the module for calls to
`llvm.spv.resource.handlefromheap` and groups them into CBV/SRV/UAV
resources and samplers. Calls to
`llvm.spv.resource.counterhandlefromheap` form a third group.
The SPIR-V backend represents descriptor heaps as unbounded resource
arrays. After resolving implicit bindings, the pass assigns the first
available binding to each heap group in the following order: CBV/SRV/UAV
resources, samplers, and counters.
For each group, the pass will replace the heap intrinsic calls with the
explicit `llvm.spv.resource.handlefrombinding` equivalents using the
assigned binding. The pass does not actually need to create the
unbounded resource-array globals itself. It only needs to assign a
[10 lines not shown]
[compiler-rt] Add 'csan' library for the concurrency sanitizer
Summary:
Adds the runtime for the concurrency sanitizer, both CPU and GPU.
Fundamentally, this works using the following pseudocode:
```c
static u64 watchpoints[N]; // Hash-indexed, zero is empty.
// Emitted before the access, so we never trip on our own write.
void check_access(volatile void *addr, u32 size, u32 type) {
// Every access probes. A read conflicts only with a watched write, a
// write conflicts with either.
if (u64 *wp = find_watchpoint(addr, size, type))
consume(wp, this_pc()); // Hand our location to the owner.
if (!should_sample()) // Wave-uniform, 1-in-N chance.
return;
[17 lines not shown]
[Clang] Add support for the `-fsanitize=concurrency` runtime
Summary:
Add the frontend sanitizer kind, function attributes, pass pipeline
integration, predefined macro, and driver handling for
ConcurrencySanitizer.
[lldb] Add Options to LINK_COMPONENTS (#225684)
This fixes shared library build of lldb:
```
/usr/bin/ld: lib/liblldbPluginPlatformMacOSX.a(PlatformDarwin.cpp.o): undefined reference to symbol '_ZNK4llvm3opt8OptTable9getOptionENS0_12OptSpecifierE'
/usr/bin/ld: /work/kparzysz/git/llvm.org/b/x86/lib/libLLVMOption.so.24.0git: error adding symbols: DSO missing from command line
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
```
And several other cases in unittests.
AMDGPU: Preserve dead carry-out when shrinking adds in SIFoldOperands
The VOP3 form of add/sub with carry out are sometimes shrunk to the VOPC
form when the carry out is dead. Preserve this information by setting the
dead flag on the new instruction. This alleviates some implicit dependence
on LiveVariables' later recomputation of dead flags.
Co-authored-by: Claude (Opus 4.8) <noreply at anthropic.com>