[AMDGPU] Update waterfall-call-inreg-agpr.ll mismatched CC (#235075)
update test such that the call CC matches the CC of the target function
Identified while investigating
https://github.com/llvm/llvm-project/issues/234232
[SimplifyCFG] Propagate unknown weights in ConstantFoldTerminator (#234823)
Before we were just dropping the metadata node which causes a profcheck
failure. Propagate the unknown profile so the profcheck verifier knows
that we have dealt with this case.
Found while doing a bootstrapping build of LLVM with -mllvm
-enable-profcheck-in-pipeline.
[libclang] Resolve dependent member references in clang_getCursorReferenced
Inside a class template, references to members of a dependent base, such
as 'this->size()' where the base is 'A<T>', aren't bound to a declaration
until instantiation, so clang_getCursorReferenced() returned a null cursor
for them.
Fall back to HeuristicResolver, which clangd uses for the same purpose, to
look the name up in the primary template, and return the result if it's a
single declaration. This also resolves 'type_trait<T>::value' in a
requires-clause or concept to the primary template's static member.
'A<T>::size()' (a qualified reference to an instance member) still isn't
resolved, because HeuristicResolver only considers static members for a
DependentScopeDeclRefExpr.
Addresses part of #15370.
Assisted-by: Claude Opus 5.5
InlineSpiller: Stop adding kill flags on virtual registers
The spiller was marking uses of the new virtual registers created for
rematerialization and spilling as killed. VirtRegRewriter recomputes
kill flags from live intervals after allocation, so these were never
needed.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[RegAlloc] Restrict statepoint remat by default
Statepoint deopt and GC operands may live in stack slots, but when a
statepoint has more of them than there are registers, InlineSpiller
can rematerialize them into registers in front of it. Greedy then
runs out of registers and the basic allocator asserts.
restrict-statepoint-remat makes these operands spill and fold into
the statepoint instead. It was added off by default pending
validation, and the statepoint register allocation tests already
enable it, so turn it on by default.
AArch64: Stop adding kill flags on new virtual registers
Continue purging uses of kill flags
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[Interpreter] Strip the '\01' mangling escape when looking up external functions
The interpreter looked up external functions, both in its "lle_X_" table
and via dlsym() for libffi calls, using the IR name as-is. A declaration
such as @"\01printf" or @"\01_stat$INODE64" (as produced for asm labels)
was looked up with the escape, and on targets with a global prefix also
with the prefix, so it failed with "Tried to execute an unknown external
function" even though the JIT handled it.
Drop the escape and, if present, the data layout's global prefix before
looking the function up.
Fixes #5852.
Assisted-by: Claude Opus 5.5
[PowerPC] Remove unnecessary FP_EXTENDS from non-compare operand of FSEL. NFCI (#231540)
The first operand of PPCISD::FSEL always needs to be f64, but not the
second or third operand. Those operands need to match each other and the
result type.
AI tells me that f32 operands are already held in f64 format so an
fp_extend codegens to a copy.
Found while adding verification of SDTCisSameAs in
SDNodeInfo::verifyNode.
Assisted-by: Claude
[ARM][GlobalISel] Legalize G_CONSTANT_FOLD_BARRIER
The IRTranslator emits G_CONSTANT_FOLD_BARRIER for the no-op bitcasts that
ConstantHoisting uses to materialize hoisted constants, but ARM had no
legalizer rule or register bank mapping for it, so ordinary code such as
an add and a mul sharing a large constant failed with "unable to legalize
instruction" at -O2.
Mark it legal for s32 (clamping other scalar sizes) and map it to GPRs, as
AArch64, X86, and RISC-V already do. InstructionSelect removes it
generically.
Fixes #235104.
Assisted-by: Claude Opus 5.5
[ARM] Don't create VBSP for vbsl of an illegal vector type
The arm_neon_vbsl intrinsic combine turned every call into ARMISD::VBSP.
That combine runs before type legalization, which doesn't know how to
promote or split VBSP, so a vbsl of an illegal type such as v4i8, v2i16,
or v8i32 crashed with "Don't know how to custom expand this!".
For illegal types, expand to (Mask & A) | (~Mask & B) instead. Split types
still end up as vbsl after legalization.
Fixes #15375.
Assisted-by: Claude Opus 5.5
[AMDGPU] Fix prefetch lowering for buffer, 32-bit and divergent pointers (#232366)
A prefetch is only a hint, but in many cases there are valid prefetches
which crash the backend. Instead of doing that we just drop them as is
already done for prefetches of LDS and private memory.
[LibCallsShrinkWrap] Shrink-wrap dead tan() calls like sin() and cos()
tan(), tanf(), and tanl() only set errno for a domain error when the
argument is +/-infinity, exactly like sin() and cos(). Treat them the same
way so that a call whose result is unused is only executed when it could
set errno, instead of always.
Fixes #234894.
Assisted-by: Claude Opus 5.5
Revert "[compiler-rt] Restrict __gnu_h2f_ieee and __gnu_f2h_ieee to arm32 EABI" (#235018)
Reverts llvm/llvm-project#220170.
It turns out that LLVM can produce calls to `__gnu_h2f_ieee` and
`__gnu_f2h_ieee` when targeting at least Windows/arm, even if that isn't
an EABI target - contrary to what was said in #220170.
Reverting the change to builtins, expose these functions for non-EABI
targets (like before) until we can avoid emitting the calls to them.