[ProfileData] Strip .cfi suffix in InstrProfSymtab (#240955)
Under CFI jump tables, `LowerTypeTests` renames function definitions to
`<name>.cfi`. `InstrProfSymtab::getCanonicalName` did not strip `.cfi`,
preventing canonical GUID lookups from matching `.cfi` function
definitions.
Co-authored-by: Benedict Schlüter <bschlueter at google.com>
Assisted-by: Gemini
[SLP] Merge redundant input operands of binary-operator nodes (#208670)
Replaces the merged-input machinery of the preceding commits, kept in
the branch history for reference. Load-only, and restricted to
power-of-two pools: otherwise the gathered-loads path may decline the
wide load and leave the operand stuck as a gather.
Co-authored-by: Cursor <cursoragent at cursor.com>
Co-authored-by: Alexey Bataev <a.bataev at outlook.com>
[BPF] Fix use-after-free in bpf-aspace-simplify (#240996)
BPFASpaceCastSimplifyPass rewrites
`addrspacecast M->N (getelementptr (addrspacecast N->M p))` to
`getelementptr p`. When the inner cast has no other uses, the rewrite
erases it. That cast can also be the outer cast of another chain that is
still in the worklist. The pass then reads the erased cast. Clang
crashes on this code:
```c
#define __arena __attribute__((address_space(1)))
struct hdr { int len; int flags; };
int use(int *p);
int f(void __arena *buf, long off)
{
struct hdr __arena *h = (struct hdr __arena *)((char *)buf + off);
return use((int *)&h->flags);
[22 lines not shown]
[lldb][NFC] A small cleanup in Process::ReadModuleFromMemory (#241137)
I added a check for "if corefile" right after a "if live process"
conditional. Initialize both variables in the same cond expr.
[ORC] Replace bindCallControllerHandlerSPS with HandlerSpec (#241133)
Give each existing call-controller handler a descriptor (its default tag
name and SPS signature) and bind it with
bindCallControllerHandler<sps::HandlerSpec<...>>, then remove
bindCallControllerHandlerSPS, which no longer has any users.
Each platform's handler descriptors live in a <platform>_sps_handlers
namespace alongside the platform's existing controller-interface
descriptors. The descriptors for LazyReexportsManager's and
ReOptimizeLayer's handlers follow the same naming scheme.
bindCallControllerHandlerSPS has not appeared in a release, so no
released API is removed.
[ProfileData] Prefer definitions over declarations in InstrProfSymtab (#240698)
When a function declaration and a definition in a module share a
canonical name or GUID (such as promoted ThinLTO symbols or CFI
jump-table declarations alongside `.cfi` bodies), `InstrProfSymtab`
resolved the GUID to whichever appeared first in module order,
preventing indirect call promotion from inlining the definition when the
declaration appeared earlier.
PR Stack:
* ➤ https://github.com/llvm/llvm-project/pull/240698
* https://github.com/llvm/llvm-project/pull/240955
* https://github.com/llvm/llvm-project/pull/240699
Co-authored-by: Benedict Schlüter <bschlueter at google.com>
Assisted-by: Gemini
StackProtector: Take libcall signatures from RuntimeLibcallsInfo
Stop constructing the types by hand, which also missed setting the
calling convention.
This also maintains the special case setting of dso_local, which I
also think should be automatically applied but this requires
additional work.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
RuntimeLibcalls: Declare __stack_smash_handler with only the function name
OpenBSD's libc defines __stack_smash_handler(const char func[], int
damaged) but never reads damaged, and GCC declares and calls it with
only the first argument. Match the compiler's convention instead of
the C prototype, which would require a dead argument at every call
site.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[SPIR-V] Fix G_PTR_ADD selection for addrspacecast global initializers (#238253)
A constant `GEP` of an `addrspacecast` in a global initializer reaches
instruction selection as `G_ADDRSPACE_CAST` followed by `G_PTR_ADD`.
And the `G_PTR_ADD` selector asserted that its base was a global, so
`llc` aborted.
So, select the access chain from the cast result. The `G_PTR_ADD` offset
is a byte count, so it is used as the Element operand over an `i8`
pointer casted from a typed base.
[AMDGPU][GISel] Use the function stack pointer in legalizeStackSave (#240815)
Currently, `legalizeStackSave` reads the concrete stack pointer
`$sgpr32`, but entry functions do not reserve that register until
`finalizeLowering`.
So, the machine verifier reported an undefined `$sgpr32` on
`G_AMDGPU_WAVE_ADDRESS` in `kernel_store_stacksave`.
Use the reserved `$sp_reg` placeholder instead, until `finalizeLowering`
rewrites it.
RuntimeLibcalls: Add missing attributes to memory and allocator libcalls
Add the attributes inferLibFuncAttributes would give these functions.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[libc][math] Correct expm1f16 subnormal rounding and range reporting (#236310)
Correct expm1f16 rounding for nonzero half subnormals and the negative
minimum-normal input. Select adjacent results directly, preserve signed
zero,
and use tininess after rounding for underflow/ERANGE.
Local tests on x86-64 Linux with GCC 13 and Clang 18: 5/5 focused smoke
tests
per compiler. MPFR 4.2.1 value checks cover all 63,488 finite half
encodings
in four rounding modes, with no mismatches. Reporting checks cover
nonzero
subnormals and four adjacent boundary encodings.
MPFR's own underflow flag differs at 0x03ff under upward rounding; the
PR uses
the after-rounding policy. The separate overflow fix is not included.
[2 lines not shown]