[LowerTypeTests] Apply kill switch to CFI jump table reordering (#224782)
This is follow up to #221046, for which I failed to upload rebased
version.
* https://github.com/llvm/llvm-project/pull/221046
[LowerTypeTests] Reorder CFI jump table entries based on hotness (#221046)
Order CFI jump table entries by function hotness. We use `cfi.functions`
metadata in ThinLTO, or `BlockFrequencyInfo` / function entry counts in
full LTO.
We want the hottest function to be optimized by the last entry thing for
SHT_LLVM_CFI_JUMP_TABLE. The linker deletes the final branch in the jump
table and moves the table directly before that target function so it
falls through.
This also ensures the jump table lands in a hot section (.text.hot)
instead of a cold section (.text.unlikely). Type contiguity is
preserved.
This PR reliably improves the performance of our server binary by 0.2%,
and some smaller binaries up to 5%.
PR Stack:
[8 lines not shown]
[Clang][NFC] Move GH211943 test into existing builtin-dump-struct test file (#224421)
Follow-up to #212377 per post-commit review by @shafik.
Moves the regression test from a standalone GH211943.cpp into the
existing CodeGenCXX/builtin-dump-struct.cpp under a namespace GH211943
block, guarded by #ifdef TEST_WERROR with a second RUN line.
[NFC][LowerTypeTests] Add RUN line for -reorder-cfi-jump-tables-profiles=false (#224779)
Update CHECK lines to match the new jump table layout in
* https://github.com/llvm/llvm-project/pull/224779
Assisted-by: Gemini
[TargetLowering][COFF] Allow GlobalAlias in lowerRelativeReference (#220674)
In commit 2b321e2f293a (#203171), splitAndWriteThinLTOBitcode was
updated to create a GlobalAlias with external linkage for promoted
internal globals instead of renaming them directly.
When generating COFF object files on Windows (such as MSVC RTTI
CompleteObjectLocator structures), relative references against
@__ImageBase (e.g. sub (ptrtoint @alias to i64), (ptrtoint @__ImageBase
to i64))
are lowered to IMAGE_REL_AMD64_ADDR32NB (VK_COFF_IMGREL32) relocations
in TargetLoweringObjectFileCOFF::lowerRelativeReference.
Previously, lowerRelativeReference checked `!isa<GlobalObject>(LHS)`,
which rejected GlobalAlias instances. As a result,
lowerRelativeReference returned nullptr, and AsmPrinter fell back to
emitting a raw MC subtraction expression. This caused
WinCOFFObjectWriter
to fail with:
[9 lines not shown]
[SanbdoxIR][SandboxVec] AuxPassArgs for auxiliary pass arguments (#224450)
This patch implements helper classes for handling the pass auxiliary
arguments. These classes handle the parsing of the auxiliary argument
string such that the passes themselves won't have to deal with it.
We currently only support boolean arguments that are false by default.
If an argument shows up in the string then it is set to true.
Example:
```
AuxPassArgsRegistry ArgsRegistry; // The "parent" of the arguments
AuxPassArg Arg1 = ArgsRegistry.createArg("arg1");
AuxPassArg Arg2 = ArgsRegistry.createArg("arg2");
...
ArgsRegistry.parse("arg1"); // From this point on (bool)Arg1 evaluates to true.
```
[5 lines not shown]
[llvm-jitlink] Rework out-of-process launch/connect options (#224632)
Replace -oop-executor and -oop-executor-connect, which were mutually
exclusive and each parsed their own ad hoc connection syntax, with two
orthogonal options built on the shared ConnectionSpec parser:
-oop-launch [<path>] Launch an out-of-process executor (default:
llvm-jitlink-executor).
-oop-connect <spec> How to connect to the executor, whether or not
it was launched by llvm-jitlink.
Either may be used alone (matching the old -oop-executor and
-oop-executor-connect behavior) or combined, e.g. to have llvm-jitlink
bind and listen while the executor it launches dials back in:
llvm-jitlink -oop-launch -oop-connect=tcp:listen=127.0.0.1:0 a.o
Both llvm-jitlink and llvm-jitlink-executor now parse connection
[15 lines not shown]
[llvm][AArch64] Fix FPDiff founding direction in non-sibcall tail calls (#223545)
This fixes another subtle bug in frame accounting (see: #217156 /
#220406), for tail calls that have a non-multiple of 16 bytes worth of
stack arg area, and need that stack arg re-use to be increased to cover
the alignment requirement. This is best illustrated with callers
containing 8 formal arguments covering the first 8 GPRs (x0-x7),
followed by 9 bytes of argument passed on the stack.
In a callee-pops tail call (e.g. tailcc/swifttailcc), the set of
reusable stack arg area bytes has already been sufficiently aligned by
LowerFormalArguments, so growing NumBytes up to StackAlign is enough to
consume that excess. Otherwise (e.g. a plain C-convention call, forced
off the sibcall path, as in the aarch64_inout_za tests), we can't rely
on either having been pre-aligned, so we round NumBytes up to the same
residue mod StackAlign as NumReusableBytes, which cancels the residue
out of their difference (FPDiff), thus keeping the stack aligned going
into the callee.
[11 lines not shown]
[lldb] Get IRExecutionUnit mangling-mode from llvm::Module. (#224595)
Get the mangling mode (IRExecutionUnit::m_strip_underscore) from the
llvm::Module at IRExecutionUnit construction time, rather than getting
it from the llvm::ExecutionEngine in GetRunnableInfo.
This is a step towards decoupling IRExecutionUnit from
llvm::ExecutionEngine / MCJIT.
Reland "[llvm][AArch64] Ensure stack alignment in non-sibcall tail calls with FPDiff" (#220406)
When a caller has a non-multiple of the minimum stack alignment more
argument stack space than the callee it is tail calling, we need to ensure that
the resulting FPDiff's magnitude has been rounded up to a multiple of the
platform's minimum stack alignment.
In this re-land there is a fixup to 234ce03692ede13ffd2fcb35570d801c1e332814,
which, because of the wrong order, wasn't actually moving NumBytes after
FPDiff had been re-aligned.
rdar://184474075
(cherry picked from commit 393710bbf74c4e7b92226603a18ead0bba70a8a0)
[CIR] Harden static-local lowering against malformed .cir (#224744)
Enforce that a `static_local_guard` is always paired with a
`static_local_info` attribute via a GlobalOp verifier.
[libc++] Reword confusing warning message about AppleClang version (#222380)
AppleClang 26.4 is not a thing -- it's AppleClang 21.0 that shipped with
Xcode 26.4.
(cherry picked from commit 9e39a5e4a606e2ef8e46bd4a947f0b39feacecc7)
[scudo] Fix AllocatorCacheMaxResidentBytesDisabled test (#224698)
The test made an implicit assumption about how the maps were created. On
a device where the page size is much greater than 4096, the test fails
because of the hard-coded limits. Make the limits and values depend on
page size to avoid this problem.
Count all enclosing leaves in reachable paths
Reachability must use the same construct positions and depth as lowering
when ranking metadirective replacements. Count source constructs without
selector traits, including leaves of combined directives, while keeping
NOTHING transparent.
Add regressions for actual and dynamically selected TASK regions and
DISTRIBUTE within TEAMS DISTRIBUTE PARALLEL DO.
Reject negative trait scores during metadirective recovery
Reachability analysis can rank candidates before CheckTraitScore diagnoses
invalid scores. A score of -1 wraps the initial unsigned score to zero,
causing selection to dereference a null best candidate.
Treat negative scores as absent during recovery while preserving the
existing diagnostic.
Preserve OpenMP variant ranking and reachability
Incorrect scores and premature candidate rejection can change lowering
selection or suppress required metadirective loop diagnostics.
Preserve full score values and context-dependent device weights, retain
paths distinguished by those weights, and let runtime conditions satisfy
match_any despite unknown static properties.
Fix extension matching and reachable path merging
Metadirective semantic checking relies on ranked selection to decide which
replacements need validation. With match_any and match_none, a selector can
remain applicable even when some construct traits are absent. The existing
matching and path-merging assumptions do not fully account for this, so
ranking can crash or discard a reachable replacement, allowing invalid loop
nests to pass unchecked.
Make applicability, scoring, and reachable-path merging agree on what these
matching extensions can observe. Preserve enough construct context to rank
partially matching selectors and distinguish paths whose nesting changes
the selected replacement. That context must also remain visible inside a
BLOCK associated with a selected directive, so nested metadirectives are
checked against the context in which they can execute.
Fix metadirective reachable path boundaries
Stop construct trait paths at the innermost target and retain the implicit
nothing fallback during unsupported-selector recovery.
Add coverage for actual and selected target boundaries and for nested
metadirectives reached through implicit fallback.
Preserve metadirective selection semantics
Reachability checks can miss required loop diagnostics when selection
drops SIMD traits or treats NOTHING with APPLY as a no-op.
Preserve those distinctions in the shared selection plan so semantic
checks retain reachable transformations and lowering diagnoses
unsupported cases.
Respect target boundaries during OpenMP variant lowering
Stop collecting construct traits at the innermost TARGET so lowering
agrees with semantic analysis when selecting metadirective replacements
and DECLARE VARIANT callees.