[clang][NFC] Test msvc multilib resource dirs (#238210)
As with other similar tests, explicitly add checks for the resource dir
paths added by the driver when using multilibs.
Assisted-by: AI
libunwind: Use libgcc's function context layout for sjlj (#238128)
Make call_site an i32 and the __data words pointer
sized. compiler-rt's SjLj_Function_Context was not defined in the same
way as libgcc.
This was broken for all 64-bit targets. Every field was i32, so the
exception pointer in __data[0] was truncated. It just happens that no
64-bit target defaults to SJLJ exceptions except VE. Instead of fixing
that, a VE special case was introduced in the libunwind sources and
SjLjEHPrepare, which had a special TargetMachine hook for this data
size. In reality it should just be a uintptr_t which we can already
infer from the DataLayout.
This is an ABI break for 64-bit targets other than VE when using
libunwind built for SjLj: the __data, personality, lsda and jbuf
offsets move, so compiled code and libunwind must be updated
together. That configuration was already broken by the pointer
truncation and is not the default anywhere. 32-bit targets are
[3 lines not shown]
Attributor: Add new call graph references before reanalyzing (#238535)
If a reference moved between two functions of the SCC, e.g. an argument
was replaced by the function passed at its only call site, reanalyzing the
caller first removed the edge that kept the target a descendant. Adding
the edge for the callee then failed the trivial edge assertion with
EXPENSIVE_CHECKS in cgscc-new-ref-edge.ll.
Add the reference edges of a new constant when it replaces a use, before
any function is reanalyzed.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[BOLT] Batch instruction insertion during instrumentation (#237930)
Insert each instrumentation snippet as a range to avoid repeatedly
shifting the remaining instructions in a basic block.
| Variant | Instrumentation Time (s) |
| --- | ---: |
| Baseline (before optimization) | 51.93 |
| commit | 40.19 |
---------
Co-authored-by: Jinjie Huang <huangjinjie at bytedance.com>
[LoopUnroll] Cap unrolling and peeling in very large loop nests (#221702)
Add an option, `-unroll-max-nest-loops` (default 128), that suppresses
**heuristic run-time unrolling, partial unrolling, and peeling** of a
loop when the outermost loop of its nest contains more than that many
loops.
Each of these transforms calls `forgetTopmostLoop` (from LoopUnroll and
LoopPeel), which invalidates ScalarEvolution for the entire top-level
nest. In a nest with a very large number of sibling/child loops,
transforming each candidate re-invalidates the whole nest, so compile
time grows quadratically with the nest size while the run-time benefit
of these transforms is negligible.
The nest size for each top-level loop is computed once per function, so
the guard adds only a constant-factor check per candidate loop. None of
the gated transforms enqueue new loops (remainder/peeled bodies are
never added to the worklist), and a nest that shrinks later only makes
the cap more conservative. Explicit unroll pragmas and forced counts are
[14 lines not shown]
AArch64: Remove kill flags on virtual registers from MIR tests
These will soon be disallowed by the verifier. Delete tests which only
tested kill flag maintenance and only differed from other functions in
kill flag uses.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[libc] Use a syscall wrapper for poll (#238266)
This PR move poll behind the centralized syscall wrappers, following
libc/docs/dev/syscall_wrapper_refactor.md.
---
<sub>Stack created with <a
href="https://github.com/github/gh-stack">GitHub Stacks CLI</a> • <a
href="https://gh.io/stacks-feedback">Give Feedback 💬</a></sub>
[libc] Use a syscall wrapper for openat (#238264)
This PR move openat behind the centralized syscall wrappers, following
libc/docs/dev/syscall_wrapper_refactor.md.
---
<sub>Stack created with <a
href="https://github.com/github/gh-stack">GitHub Stacks CLI</a> • <a
href="https://gh.io/stacks-feedback">Give Feedback 💬</a></sub>
[Hexagon] Enable SlotIndexes compaction by default
Opt Hexagon in to dropping dead SlotIndexes entries before greedy
allocation, as AMDGPU already does, so live range sizes count only
instructions that still exist.
The test updates are register allocation changes; two pipeliner tests
get back their original, shorter kernels.
RuntimeLibcalls: Add signatures for size returning new and GPU profiling
__size_returning_new and its variants return __sized_ptr_t, a pointer
and size pair. The GPU profiling functions use the compiler-rt
prototypes.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
libunwind: Use libgcc's function context layout for sjlj
Make call_site an i32 and the __data words pointer
sized. compiler-rt's SjLj_Function_Context was not defined in the same
way as libgcc.
This was broken for all 64-bit targets. Every field was i32, so the
exception pointer in __data[0] was truncated. It just happens that no
64-bit target defaults to SJLJ exceptions except VE. Instead of fixing
that, a VE special case was introduced in the libunwind sources and
SjLjEHPrepare, which had a special TargetMachine hook for this data
size. In reality it should just be a uintptr_t which we can already
infer from the DataLayout.
This is an ABI break for 64-bit targets other than VE when using
libunwind built for SjLj: the __data, personality, lsda and jbuf
offsets move, so compiled code and libunwind must be updated
together. That configuration was already broken by the pointer
truncation and is not the default anywhere. 32-bit targets are
[4 lines not shown]
[Hexagon] Enable SlotIndexes compaction by default
Opt Hexagon in to dropping dead SlotIndexes entries before greedy
allocation, as AMDGPU already does, so live range sizes count only
instructions that still exist.
The test updates are register allocation changes; two pipeliner tests
get back their original, shorter kernels.
RuntimeLibcalls: Add a signature for __llvm_deoptimize
llvm.experimental.deoptimize is lowered to a call to __llvm_deoptimize
with the intrinsic's arguments and return type, which vary between
calls, so declare it as void (...). No actual output change because
this happens to be the filler signature used for unhandled functions.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
RuntimeLibcalls: Add signatures for size returning new and GPU profiling
__size_returning_new and its variants return __sized_ptr_t, a pointer
and size pair. The GPU profiling functions use the compiler-rt
prototypes.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[flang][NFC] Explain the -Waix-compat suppression in real-value.h (#238635)
Follow-up to 238605, which suppressed `-Waix-compat` on
`RealValue::opaque_` without saying why the warning does not point at a
real problem.
The warning flags a by-value struct with a 16-byte-aligned member as not
binary compatible with IBM XL C/C++ for AIX 16.1.0 or older. Here the
alignment is required: it is that of `RealValueImpl`, which comes from
`Real<>::word_`, and `real.h` already suppresses the same warning there.
Those older compilers cannot compile flang's C++17 code, so there is no
compatibility to preserve. This adds a comment saying so; no functional
change.
Assisted-by: AI
Set IsLittleEndian in arm64e-input-abi.s
#238122 makes IsLittleEndian required in Mach-O YAML. Set it here so this test works whichever of the two lands first.
Assisted-by: Claude Code
[BPF] Promote i32 stack arguments to i64 with ALU32 (#238315)
Without ALU32, `CC_BPF64` promotes i32 arguments to i64, so the caller
sign- or zero-extends `signext`/`zeroext` arguments to the full 64-bit
stack slot and the callee relies on that.
With ALU32, `CC_BPF32` assigns i32 stack arguments as is, with
`CCValAssign::Full`. The caller any-extends them to the 64-bit slot, but
the callee reads the slot as i64 and the generic argument lowering still
asserts it is sign/zero-extended, so it is used without extending (`llc
-mcpu=v3`):
```
declare i64 @ext(i64, i64, i64, i64, i64, i32 zeroext, i32 signext)
... call i64 @ext(..., i32 zeroext %t, i32 signext %t)
caller: *(u64 *)(r11 - 8) = r1 ; %t not extended
*(u64 *)(r11 - 16) = r1
callee: r1 = *(u64 *)(r11 + 8) ; assumed extended
r0 = *(u64 *)(r11 + 16)
[25 lines not shown]
[ProfCheck] Wire up enable-profcheck-in-pipeline to CodeGen
This patch wires up the enable-profcheck-in-pipeline flag to the CodeGen
pipeline (NewPM only because it's complete enough for testing and should
become the default soonish). This enables catching issues in the IR
section of the CodeGen pipeline.
From attempting a bootstrap of LLVM, it seems like there are many such
issues to dig through.
Reviewers: mtrofin, aeubanks
Pull Request: https://github.com/llvm/llvm-project/pull/238608
[sanitizer_common] Fix strlcpy shadow handling (#238598)
The `strlcpy` interceptor passes `internal_strlen(dst) + 1` to
`COMMON_INTERCEPTOR_COPY_STRING`, which already unpoisons the next byte.
Use the copied length instead of `internal_strlen(dst) + 1 `, and skip
the update when `size` is zero.
Follow-up to #236414.
Check arm64e ABI markers in static links too
Static links skipped the check, but ld64 takes only unversioned and
kernel objects there besides version 0, and ignores the other markers.
Assisted-by: Claude Code