[Clang][CFI] Only normalize integer types `cfi-icall` metadata (#242466)
When using `-fsanitize-cfi-icall-experimental-normalize-integers`, its
normalization was applied unconditionally when creating metadata,
appending `.normalized` and normalizing parts of C++ class vtable
`!type` metadata, virtual member-pointer metadata, virtual call checks,
and `-fexperimental-call-graph-section` metadata
This would cause ThinLTO to see vtable `!type` identifiers that mismatch
RTTI type-infos. Best case, this blocked whole-program devirtualization,
but in the worst case (mixed use of normalization) it would cause WPD to
make unsound transforms. =[
Restricting the normalization and `.normalized` suffix strictly to
`cfi-icall` function type metadata fixes these issues.
Added both direct tests and a CFI test that actually uses ThinLTO and
would break without this.
Assisted-by: Antigravity with Gemini
[CIR] Flatten unions passed Direct in CallConvLowering (#241201)
Summary:
- On AMDGPU, a union wider than 64 bits is passed Direct with no coerce
type.
- OGCG passes it as its LLVM type's fields, storage member and tail
padding while CIR passed whole union.
Example:
` typedef union { int a[3]; double d; } u_pad_t;`
` void arg_u_pad(u_pad_t u) {}`
` OGCG: @arg_u_pad(double, [8 x i8])`
` CIR: @arg_u_pad(%union.u_pad_t)`
- This patch flattens such a union the same way. Returns stay the union,
as in OGCG.
- A flattened field stored into a packed slot now uses the slot's
[5 lines not shown]
[CIR] Flatten wide _Complex arguments in CallConvLowering (#240808)
Summary:
- When the ABI classifier passes a value `Direct` with no coerce type
and allows flattening, the CIR bridge only flattened struct records. A
`_Complex` was passed unchanged as one argument.
- On AMDGPU, a `_Complex` wider than 64 bits that fits the register
budget is classified this way.
- Classic codegen passes it as its two parts, but ClangIR passed one `{
double, double }`.
- This PR coerces such a `_Complex` to a `{real, imag}` struct, so the
rewriter splits it into two arguments the same way it does for structs.
Reference classic test:
[amdgcn-openmp-device-math-complex.c](https://github.com/llvm/llvm-project/blob/3f4a3d6a4f5cbcc1b7996e342f409234febbe1d0/clang/test/Headers/amdgcn-openmp-device-math-complex.c#L6)
Relates to Issue: https://github.com/llvm/llvm-project/issues/220471
Assisted by: claude opus 5.5
[HLSL] Add DebugBreak() (#242109)
Adds support for `void DebugBreak();` to Shader Model 6.10. The function
is defined in a new header `hlsl_debugging.h` which is included from the
main `hlsl.h` header. The function calls the existing
`__builtin_debugtrap()`. Lowering to SPIR-V and DXIL is added in
separate PRs.
Fixes #231325
IR: Look up PassInstrumentation once when erasing invalidated results (#242562)
AnalysisManager::invalidate looked up the cached PassInstrumentation
result for each erased result. It is never invalidated, so look it up
once.
Whole O3 instructions (callgrind): kimwitu++ k.bc -0.27%, SPASS cnf.bc
-0.05%, sqlite3 -0.02%.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
18658 ZTS TRIM tests check file vdev sizes before the pool holding them syncs
Portions contributed by: Giuseppe Piscitelli <ooonea at gmail.com>
Portions contributed by: Matthew Ahrens <matt at mahrens.org>
Portions contributed by: Toomas Soome <tsoome at me.com>
Reviewed by: Matthew Ahrens <matt at mahrens.org>
Reviewed by: Toomas Soome <tsoome at me.com>
Approved by: Robert Mustacchi <rm at fingolfin.org>
CodeGen: Allocate LiveIntervals ranges with BumpPtrAllocator (#242423)
LiveInterval and register unit LiveRange objects were individually
heap allocated and freed. Allocate them from a BumpPtrAllocator owned
by LiveIntervals, with recyclers so removed intervals and register
unit ranges reuse their storage. The arena is reset in clear(),
keeping the first slab across functions.
Reduces llc instructions by ~0.3% on the 40 largest CTMark TUs for
x86_64 and arm64. The impact is larger for amdgpu.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
OpenMP: Use getOrInsertFunction init callback for runtime functions
Use the new overload to set up the function on first use. The
MD_callback check is dropped since a newly created function will never
have metadata.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>