[VPlan] Build SCEV of VPDerivedIVRecipe like its expansion (NFC). (#242804)
Compute the SCEV of a VPDerivedIVRecipe as Start + zext-or-trunc(Index)
* Step, matching expandVPDerivedIV. Previously Start and Step were
truncated or sign-extended to the type of Index, so the SCEV had Index's
type rather than the recipe's, and VPScalarIVStepsRecipe truncated it
back. Remove that truncate.
All derived IVs queried today have an Index at least as wide as Start,
where both forms fold to the same SCEV.
[ConstantFolding] Use the pointer width for ptrtoint of inttoptr (#237878)
Previously, folding `ptrtoint (inttoptr C)` truncated C to the address
width and dropped the non-address bits; use the pointer width instead.
Fixes #235642.
Assisted-by: Claude Opus 5.5
Revert "[Hexagon] Test lowering of Clang HLX vector pair locals at -O0 (#242403) (#242803)
This reverts commit 351abdb04162065e75b007840aaf20ec7ac99a2b.
The tests fail in release builds because the values are unnamed.
[mlir][acc] Add the #acc.offload_packager offloading handler
Add an offloading handler attribute for gpu.module and gpu.binary that
is meant to embed the device images in the host object as LLVM offloading
binaries of kind OpenACC, for the offloading linker wrapper to link and
register with the OpenACC runtime.
Assisted-by: Claude Sonnet 5.5
[mlir][acc] Translate the acc.offload_entry attribute to an offloading entry
Add the acc.offload_entry unit attribute, which marks a global host symbol
(either a function or a global variable) that the offload runtime must be able
to associate with its device counterpart. The translation emits entries that
are registered with the OpenACC runtime libacctarget.
Assisted-by: Claude Sonnet 5.5
[mlir][acc] Translate #acc.offload_packager to LLVM IR
Add a translation library for the OpenACC dialect that implements the
offloading translation interface of #acc.offload_packager. Each object
of a gpu.binary is wrapped in an offloading binary of kind OpenACC,
carrying the target triple and architecture, and the images are placed
in the .llvm.offloading section of the host module for the offloading
linker wrapper to extract.
Assisted-by: Claude Sonnet 5.5
[CIR] Make cir-canonicalize a full canonicalizer
cir-canonicalize applied the CIR canonicalization patterns and folders
only to a hand-written list of operations. It now builds the pattern set
once in initialize() and runs the greedy driver over every operation, so
every pattern and folder applies everywhere. Only operations that
rewriting left dead are erased, such as the inputs of a folded
operation: CIR stays close to the source, so unused locals and ignored
expressions are kept as in classic codegen. Empty scopes and switches
were removed only because they were dead, so they get explicit
canonicalization patterns.
The pass uses the multi-op driver because the region driver always
erases blocks without a CFG predecessor, and a block that starts with
cir.label is reached only through cir.goto until the goto solver runs.
Region simplification stays off for the same reason. The new
test-convergence option fails the pass when the driver does not reach a
fixpoint, as in the upstream canonicalizer.
Assisted-by: Claude Code (claude-opus-5-5).
[mlir] Add a dead code elimination mode to the greedy rewriter
The greedy pattern rewrite driver always erases trivially dead
operations, so a client that wants canonicalization patterns and
folders without dead code elimination has no way to get it. Add
GreedyRewriteConfig::setDeadCodeElimination and the matching
dead-code-elimination option of the canonicalizer pass, with three
modes:
- all, the default, erases every trivially dead operation as before.
- newly-dead erases an operation only once the erasure or replacement
of another operation drops its last use, so the inputs that a fold
leaves unused go away while operations that were dead before
rewriting are kept.
- disabled erases an operation only by a pattern or by folding.
Region simplification is separate and still removes dead values unless
it is disabled too. The deadness cache skips invalidation while it is
empty, so a run that never queries it pays nothing for its tracking.
[2 lines not shown]
[Mips] Select MADDF and MSUBF instructions for scalar FMA on R6 (#233171)
Legalize FMA and STRICT_FMA for supported scalar floating-point types on
standard-encoding MIPS R6 targets, and match them to the existing MADDF
and MSUBF instructions instead of libcalls. Preserve tied accumulator
operands and strict FP exception semantics using the existing
instruction properties.
[CIR] Make cir-canonicalize a full canonicalizer
cir-canonicalize applied the CIR canonicalization patterns and folders
only to a hand-written list of operations. It now builds the pattern set
once in initialize() and runs the greedy driver over every operation, so
every pattern and folder applies everywhere. Dead code elimination is
disabled: CIR stays close to the source, so unused locals and ignored
expressions are kept as in classic codegen, and only the inputs of a
folded operation can be left unused. Empty scopes and switches were
removed only because they were dead, so they get explicit
canonicalization patterns.
The pass uses the multi-op driver because the region driver always
erases blocks without a CFG predecessor, and a block that starts with
cir.label is reached only through cir.goto until the goto solver runs.
Region simplification stays off for the same reason. The new
test-convergence option fails the pass when the driver does not reach a
fixpoint, as in the upstream canonicalizer.
Assisted-by: Claude Code (claude-opus-5-5).
[CIR][NFC] Add isVolatileOrAtomic() to cir.load and cir.store (#242709)
Several places spell out `getIsVolatile() || getMemOrder()` to decide
whether a load or store must stay as written. This names that check once
on both ops and uses it in the load effects, mem2reg, `CIRSimplify` and
the ABI rewriter.
Assisted-by: Claude Code (claude-opus-5-5).
[EarlyCSE] Fold equivalent `bitextract` and `bitinsert` (#242720)
EarlyCSE replaces an instruction with an earlier one that computes the
same value. It only considers instructions accepted by
`SimpleValue::canHandle`, which lists the opcodes it knows.
`bitextract` and `bitinsert` were missing from that list. They use the
generic hash, which mixes the opcode and operands, so they are also
added to the assert that guards it.
This mirrors the GVN change in #242716.
[ValueTracking][NFC] Check whether assume and context in isValidAssumeForContext are equal first (#242796)
This check is really cheap, so we should do it at the start.