CodeGen: Suppress per-invoke EH labels via an MCAsmInfo object predicate
This is to avoid depending on TargetOptions::ExceptionModel in the
X86ISelLowering constructor. This was used to legalize EH_LABEL to a nop.
Legality rules cannot depend on program state, and the exception model should
be read from the IR module flag. In this instance the exception model isn't
really the relevant property. The specific personality and the target
object's EH table format are. Introduce a new MCAsmInfo predicate which is a
known constant for the triple. Also just do this during the initial label
emission instead of leaving it to legalization. This cleans up some unused
labels for wasm. This is also a minor behavior change for unknown personalities;
the labels will now be conservatively emitted.
I don't know all that much about exceptions, there's a lot of AI reverse
engineering of intent here. Another bruteforce approach would be to just
relocate the current condition to the selector which has access to the
exception model, but the MCAsmInfo check will be reusable in other contexts.
Co-authored-by: Claude (Claude-Opus-4.8) <noreply at anthropic.com>
[CIR] Read a non-byval parameter back out of its spill slot (#225010)
CallConvLowering recognizes a forwarded non-byval indirect argument by
the slot its operand was loaded from. At -O1 and above cir-simplify
folds that load away when the slot is a constant alloca, which is what
CIRGen emits for a const-qualified by-value parameter. The walk that
gives each such parameter's slot the alignment the ABI promises now also
reads the record back out of the slot at the spill and points the
parameter's call-argument uses at that load, so an Expand, byval or
coerced argument reads it too.
Assisted-by: Cursor / claude-opus-5
[flang] Fix TRANSFER into derived type with tail padding (#223814)
When assigning a derived type value whose allocated size exceeds its
declared
field size (e.g. `SEQUENCE` type `{i32, i8}` — 5 bytes of fields, 8
bytes
allocated due to ABI tail padding), the assignment path in
`genRecordAssignment` took a "simple type" fast path that called
`genComponentByComponentAssignment`. That function iterated over
declared
fields and copied them one by one via `fir.coordinate_of`/`fir.load`/
`fir.store`, silently skipping the tail-padding bytes and leaving them
**unwritten** in the destination.
This is a compatibility choice rather than a correctness fix: F2023
10.2.1.3
p15 defines derived-type intrinsic assignment component by component,
and p16
allows any means with the same effect, so padding is outside the defined
[195 lines not shown]
[SPIRV] Fix -Wunused-variable in #224488 (#225897)
Use [[maybe_unused]] as the operations either have side effects where we
can't inline them into the assert or the definitions/variable names
provide additional clarity.
AMDGPU: Preserve carry-out dead flag in buildShrunkInst (#225798)
Shrinking from the e64 to the e32 form drops the explicit carry-out def
in favor of an implicit vcc def. If the original carry out had a dead
flag, preserve it in the shrunk instruction's implicit-def operand.
Co-Authored-By: Claude Opus 5 <noreply at anthropic.com>
[SandboxVec][LoadStoreVec] Support constant vectors of mixed types
createConstantVector() previously packed the constant store operands
as-is, which only worked when every store had the same element type.
Take the lane type from VecUtils::getCombinedVectorTypeFor() instead and
reinterpret each constant's bits as that type, going through an integer
of matching width via ptrtoint/inttoptr/bitcast. Constants wider than a
lane (e.g. an i64 in an <N x i32>) are split across several lanes in
memory order. Bail out when a constant cannot be reinterpreted, such as
a non-integral pointer or a relocatable address that needs splitting.
Also flatten vector-typed ConstantPointerNull into per-lane nulls, and
bail out on the remaining vector constants such as poison rather than
packing them into the result.
Co-authored-by: Cursor <cursoragent at cursor.com>
[Clang][Sema] Add fortify warnings for recv and recvfrom (#223520)
Add `-Wfortify-source` diagnostics for `recv` and `recvfrom` when the size argument exceeds the destination buffer size.
Part of #142230
Assisted-by: Gemini
[HLSL] Implement the SV_InstanceID semantic (#221091)
Fixes #212572
Adds type validation, stage restriction, and lowering for
`SV_InstanceID`.
- Type check rejects non-uint; DXIL accepts U32/U16, SPIR-V accepts U32
only (VUID-InstanceIndex-InstanceIndex-04265).
- Rejected all sigpoints but Vertex In.
- On SPIR-V, the variable is decorated with `BuiltIn InstanceIndex`
instead of a user-assigned Location.
- SPIR-V lowering loads from the `InstanceIndex` (ID 43) built-in; DXIL
lowering uses `dx.op.loadInput`.
- LIT tests for sema (wrong type, wrong stage, output direction) and
codegen (BuiltIn decoration, no Location).
@dnovillo @pow2clk
Assisted-by: LLM
[NFC][sanitizer] Allow fread in symbolizer (#225853)
Commit 3c63fcb246f3 (#212010) introduced `fread` usage in libc++
`std_stream.h`. Because libc++ is linked into the internal symbolizer,
`fread` is now referenced in `symbolizer.o`. Add `fread U` to
`global_symbols.txt` so symbol verification succeeds.
Assisted-by: Gemini
AMDGPU: Preserve dead carry-out when shrinking adds in SIFoldOperands (#225687)
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>
[libc++] Don't pass a path lvalue to DoNotOptimize in the filesystem benchmark (#225504)
BM_PathIterateOnceBackwards passes *I directly to DoNotOptimize.
However, libstdc++ returns a const lvalue reference to `path` from that
operation, which selects GoogleBenchmark's deprecated const-ref
overload.
Use the pattern used elsewhere in this file instead.
[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]
[LV] Add additional outer loop vectorization tests. (#225821)
Add test more test coverage for outer loop vectorization path, focusing
on various legality aspects, like supported instructions and memory
checks.
[lit][docs] Document %if conditional substitution in lit CommandGuide (#225683)
`%if ... %else` conditional substitutions (implemented in
`TestRunner.py` and mentioned in `TestingGuide.md`) were missing from
the `SUBSTITUTIONS` table and `available_features` description in
`llvm/docs/CommandGuide/lit.md`. Add `%if` to the base substitutions
table and note that `available_features` can be used in `%if`
conditions.
Signed-off-by: Ingo Müller <ingomueller at google.com>
[Clang] Add support for the `-fsanitize=concurrency` runtime
Summary:
Add the frontend sanitizer kind, function attributes, pass pipeline
integration, predefined macro, driver handling, and documentation for
ConcurrencySanitizer.
[SLP]Pair small sign-aware reduction groups only if both signs have one
The small-group check of the flattened fsub/fneg fadd reductions
used whenever any leaf was negated, vectorizing 2-wide parts that
have no opposite-sign part to combine with via the vector fsub.
Allow it only if both signs have a group of at least 2 values.
Reviewers:
Pull Request: https://github.com/llvm/llvm-project/pull/225881