[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.
Preserve reachable metadirective variants across ranking and scopes
Incorrect candidate scores and stale scope boundaries can suppress required
loop diagnostics or let directives associate with loops outside their region.
Keep pending scopes consistent as directives are consumed, and preserve
candidate scores and highest-valued ordered matches when selecting and
merging reachable paths. Handle unknown properties without aborting ranking.
[flang][OpenMP] Track reachable metadirective replacement paths
The existing semantic checks can validate loop-associated directives in a
METADIRECTIVE against the following loop, but they do not model how the
METADIRECTIVE chooses among its replacements.
Today each WHEN is considered independently: if its selector can match, its
replacement is checked. Selection instead ranks all applicable candidates as
a set. An unguarded higher-ranked candidate makes lower-ranked candidates
unreachable, while a dynamically guarded candidate leaves them reachable
when its condition is false. Treating both cases alike can diagnose loop
requirements on a replacement that can never be selected.
The selected replacement can also affect later selection. Its directive
contributes to the construct context seen by a nested metadirective. The
checker currently retains only syntactic nesting, so nested construct
selectors cannot observe a directive selected by an enclosing
metadirective.
[44 lines not shown]
[SPIRV] Rename pass to SPIRVLegalizeResourceBinding (#224747)
Rename `SPIRVLegalizeImplicitBinding` pass to
`SPIRVLegalizeResourceBinding` since it will soon be extended to handle
heap resource bindings as well. Renaming is as a separate PR will make
the upcoming change easier to review.
Related to #208054
[mlir][VectorToXeGPU] Lower out-of-bounds 1-D transfers (#220490)
A vector.transfer_read / vector.transfer_write whose vector is 1-D and
whose access is out of bounds was not lowered.
This PR now builds a real in-bounds mask instead of handing
xegpu.load/xegpu.store an all-ones one. An element is in bounds when its
index is still inside the memref dimension it reads, i.e. i < dim(d) -
indices[d], and dimensions the transfer already declares in-bounds are
left alone. Since masked-off lanes of an xegpu.load hold unspecified
values rather than zeros, a read adds an arith.select to fill them with
the transfer's padding.
It also lowers a transfer_read of a single-element vector (any rank) to
a scalar xegpu.load, when that vector is only ever extracted to a
scalar. The load takes a scalar offset and a scalar mask, and the mask
is what keeps an out-of-bounds transfer from touching memory; because a
masked-off load is unspecified, the padding is applied with an
arith.select, as the scattered path already does. This avoids
[6 lines not shown]
[CIR] Add object offset calculation for basic AA (#219047)
This adds code to compute the offset of a pointer into a base object
when the base object is computed by CIR's basic alias analysis. The
offset will be used in a future change to determine partial alias, but
at this point the analysis still reports MayAlias for objects with
different offsets.
Assisted-by: Cursor / various models