[MLIR] Filter out recursive memory effect for ReturnLike
ReturnLike interface should be rule out from the MemoryEffect check
for RecursiveMemoryEffect. It makes sense as the memory effect for
ReturnLike never effect its parent scope.
Assisted-by: Claude # Test
[MLIR][EmitC][SparseTensor] Mark yield ops as ReturnLike
emitc.yield and sparse_tensor.yield only transfer control back to their
parent op (or to the next region iteration), which is exactly what the
ReturnLike trait models. Add the trait so these terminators implement
RegionBranchTerminatorOpInterface, and the region control flow of their
parents is verified through the generic RegionBranchOpInterface checks.
The sparse_tensor.iterate type-mismatch test now reports the generic
control-flow edge diagnostic.
Co-Authored-By: Claude Opus 5.5 <noreply at anthropic.com>
[LV] Compute IV in trip count type for early exits with side effects. (#245081)
handleUncountableExitsWithSideEffects compares IV + FirstActiveLane
against the trip count in the middle block, but computed the sum in the
IV type. The trip count can be wider than the IV, e.g. i32 for an i8 IV,
which crashed with "different types inferred for different operands".
Compute the exit IV in the trip count type, which also avoids wrapping
when the exit IV is one past the largest IV value, and truncate it to
the IV type for the scalar loop resume value.
[dsymutil] Make -j an alias for --num-threads (#245080)
The help text calls -j an alias for --num-threads, but the option was
declared without Alias<threads> when the options moved to TableGen.
[VPlan] Encode single-scalar-ness of VPInstruction in a field (NFC). (#227761)
Add a dedicated field to VPInstruction to encode whether it produces a
single scalar.
The goal is to remove the hard-coded opcodes in isSingleScalar and
support opcodes both as single-scalar and vector.
The initial version just uses it for casts, to enable using
VPInstruction for VPWidenCastRecipe
(https://github.com/llvm/llvm-project/pull/129712)
Other single-scalar opcodes (PHI, Load, Intrinsic, ExplicitVectorLength,
ResumeForEpilogue) are still derived from the opcodes and will be
transitioned later.
PR: https://github.com/llvm/llvm-project/pull/227761
[ADT] Allow null pointers in TinyPtrVector. (#244938)
The restriction that null pointers aren't allowed is a footgun, and it
isn't necessary for the class to function. Change the representation so
an empty vector is a null pointer on the other side of the PointerUnion.
(This is the underlying cause of
https://github.com/llvm/llvm-project/pull/243189 .)
This hopefully shouldn't have any noticeable performance impact.
[clang][ARM][AArch64] Make __ARM_SIZEOF_WCHAR_T match wchar_t (#240570)
__ARM_SIZEOF_WCHAR_T was 4 unless -fshort-wchar or -fwchar-type was
given. On Windows wchar_t is 2 bytes, so on ARM and AArch64 Windows the
macro said 4. Use the size of the target's wchar_t, which already takes those
options into account.
Assisted-by: Claude Opus 5.5 (Anthropic)
[Analysis] Do not reuse GEP instruction with tighten wrap flag
A GEP with tighten wrap flag can introduce poision to the user of phi
node. Skip such reuse so that GVN can produce another instruction and
merge the flag in next processInstruction round on the same target
Asissted-by: Claude # Test
[CodeGen] Remove write-only private member variables (NFC) (#245007)
This patch removes private member variables in CodeGen that are
initialized or assigned to but never read, along with their
initializers and assignments.
Assisted-by: Antigravity
[CODEOWNERS] Group MLIR rules and add section markers (NFC) (#244354)
This is part of improving CODEOWNERS hygiene for MLIR. For context, see:
https://discourse.llvm.org/t/rfc-mlir-align-codeowners-with-active-reviewing/
This PR adds markers around the MLIR section and moves the rules
introduced in #234652 so that MLIR and non-MLIR rules are no longer
interleaved.
[llvm-mca][ARM] Fix Cortex-A9 dispatch hazards and NEON memory resources (#230454)
Fix the Cortex-A9 llvm-mca crash by checking execution-resource
availability for instructions that must issue immediately.
Restore NEON structure load/store resource pressure by using the
existing `ItinRW` mappings instead of resource-free `SchedRW` entries.
Add regression tests for the dispatch hazard, original crash reproducer,
and NEON load/store resource pressure.
Fixes #225087.
[DirectX] Declare command line options in TableGen (#234865)
Move the options into MCTargetDesc/DirectXMCOptions.td, since the object
writer reads them too. The asm backend hands them from MCTargetOptions
to the object writer; the passes read them from the module's
LLVMContext.
-disable-dxil-remove-unused-resources is renamed to
-dx-remove-unused-resources, with the old spelling kept as an alias.
Aided by Opus 5.5
[ARM] Trap after a noreturn call that ends a function or funclet on Windows (#242026)
On Windows the unwinder finds the function or funclet of a frame from
its return address. When a noreturn call is the last instruction of a
function or funclet, the return address is the start of the next one. With
C++ EH (#240693), MSVC's runtime then catches a rethrow from the
end of a catch funclet again and again until the stack overflows. I hit
this running Kodi's exception tests on a Surface RT.
MSVC puts a `__debugbreak` after these calls. This adds a pass that puts
a trap there. AArch64 does this in its AsmPrinter (#232358), but on ARM
blocks can't grow after ARMConstantIslands, so the pass runs before it.
Assisted-by: Claude Opus 5.5 (Anthropic)
[ARM] Count the funclet entry alignment in ARMConstantIslands (#242153)
WinException aligns each funclet entry to the function's preferred
alignment, which is 4 once ARMConstantIslands has placed a
constant pool or found a Thumb-2 jump table. ARMConstantIslands
didn't count that padding, so in a function with many funclets a
constant pool load could end up out of range, and the assembler
stopped with "out of range pc-relative fixup value". I hit this building
Kodi for Windows on Arm: a vldr ended up 1032 bytes from its
pool, behind 38 bytes of funclet padding.
This gives funclet entries that alignment once it is final, and updates
the block offsets.
Assisted-by: Claude Opus 5.5 (Anthropic)
[LLD][COFF] Make the call graph profile sort deterministic (#240563)
sortSections copied the call graph priorities into ctx.config.order,
which is keyed by symbol name. When two sections had leaders
with the same name, for example static functions with the same
name in different files, both got the priority of whichever came
last in a map keyed by pointers. So the layout could change
between two links of the same inputs. Sort by each section's
own priority instead.
Assisted-by: Claude Opus 5.5 (Anthropic)
[LLD][COFF] Don't thunk an in-range branch within one section (#240564)
createThunks gives a branch a range extension thunk when it is out of
range with a safety margin, and the margin grows when a pass fails. A
branch to a target in its own section chunk got one too, although its
distance can't change: thunks are only placed between chunks. The
thunk clobbers r12 on ARM (x16 on ARM64) in the middle of a function.
MSVC's __rt_sdiv keeps a value in r12 across such a branch, so its
remainders came back with the wrong sign. Check these branches
without the margin.
Assisted-by: Claude Opus 5.5 (Anthropic)