[CIR] Shorten the #cir.fenv parameter names
Rename the #cir.fenv parameters dynamic_rounding_mode, except_mode and
strict_except to rounding, except and strict, so a constrained op prints as
fenv<rounding = tonearest, except = unknown, strict = true>. The fields stay
optional with the same meaning and defaults; the OrDefault helpers follow the
new getter names. No functional change.
Assisted-by: Claude Code (Opus 5.5).
[CIR] Give complex FP add/sub the fenv memory effects
cir.complex.fadd and cir.complex.fsub were Pure even with a constrained
fenv attribute, so they could be speculated or erased like unconstrained
ops. Derive them from CIR_FenvOp, as the other fenv ops are: constrained
ops read and write the FP environment and are only conditionally
speculatable, unconstrained ops stay effect-free.
Assisted-by: Claude Code (Opus 5.5).
[AMDGPU] Expand AS6 prefetch addresses during selection (#245568)
Keep 32-bit constant addresses through SelectionDAG lowering so the
scalar prefetch selector can fold nonwrapping offsets. Widen the address
after any wrapping arithmetic has completed.
Assisted by: GPT 6.2-Sol
[Clang][OpenMP] Fix declare variant calls to member functions
When a declare variant is selected for a call to a member function,
ActOnOpenMPCall built the call to the variant from the original call
treated as a CXXMemberCallExpr, through a '.' MemberExpr. That is wrong
in two ways:
- A call to a member function is not always a CXXMemberCallExpr. Calls
to static member functions, and member calls in a template (even with
non-dependent arguments), are CallExprs with a MemberExpr callee.
The existing dereference of a CXXMemberCallExpr would crash on e.g.:
template <typename T> struct CT {
void m_v(T);
#pragma omp declare variant(m_v) match(user = {condition(1)})
void m(T);
void use(T t) { m(t); }
};
[6 lines not shown]
[Clang][OpenMP] Add code generation for the dispatch construct
I had previously made a start on dispatch directive support (#126914)
but saw that another implementation was underway (#117904, then #131838)
so stopped to avoid duplicate effort. Now it seems that the latter
effort stalled, so I've tried to synthesize the two patches together
into a new version (with Claude's help).
The resulting patch implements code generation for the 'dispatch'
construct, with its 'novariants', 'nocontext' and 'depend' clauses.
Other features ('device', 'adjust_args', 'append_args') are still TBD.
Sema builds the alternative forms of the associated statement
that the clauses select at run time, and stores them as children of
OMPDispatchDirective: one with the target-call replaced by a call to the
base function ('novariants'), and one with it replaced by the variant
selected without 'dispatch' ('nocontext'). Codegen emits the dispatch
region inline and selects between them:
[9 lines not shown]
[CIR] Reject the empty fenv attribute
`#cir.fenv<>` with no parameter set was accepted, printed as `fenv<>` and
lowered to a constrained intrinsic, so an unconstrained operation had two
spellings. Give `#cir.fenv` a verifier that requires at least one
parameter, leaving a missing `fenv` attribute as the only way to say an
operation is unconstrained. An absent parameter takes its value in the
default FP environment (tonearest, masked, non-strict). Speculation,
lowering and VecFCmpOp::fold share one FenvAttr::canIgnoreExceptions()
check (masked and not strict): such ops are speculatable, lower to
fpexcept.ignore and fold, and a strict op stays fpexcept.strict even when
masked. Drop FPEnvConstrainedOpInterface, whose only user was FenvOpTrait,
and let the trait read the attribute from the concrete op. Add a
CIR_FenvOp base class carrying the fenv traits and argument, which the
fenv ops prepend their operands to.
Assisted-by: Claude Code (Opus 5.5).
[MLIR][OpenACC] Add acc-loop-collapse pass (#245448)
Collapse each multi-dimensional scf.parallel inside an
acc.compute_region into a one-dimensional scf.parallel. The original
induction variables are recovered with remsi and divsi. Reductions are
carried over by mlir::collapseParallelLoops.
The collapsed loop keeps all discardable attributes of the original
loop, such as acc.par_dims, acc.gpu_block_redundant and acc.chunk_size.
The pass sets acc.collapse_count to the number of collapsed dimensions,
which remark emission reads. Loops outside an acc.compute_region are
unchanged.
[NFC] Add lit.local.cfg to SPIRV test directory (#245588)
The SPIR-V tests run opt with -mtriple=spirv64, and since #244345 their
checks depend on the SPIR-V TTI. In a build without the SPIR-V target,
opt falls back to the generic expansion and the checks fail. Mark the
tests unsupported in that case, as the other target directories here do.
Assisted by: Cursor
Co-authored-by: Cursor <cursoragent at cursor.com>
[CIR] Shorten the #cir.fenv parameter names
Rename the #cir.fenv parameters dynamic_rounding_mode, except_mode and
strict_except to rounding, except and strict, so a constrained op prints as
fenv<rounding = tonearest, except = unknown, strict = true>. The fields stay
optional with the same meaning and defaults; the OrDefault helpers follow the
new getter names. No functional change.
Assisted-by: Claude Code (Opus 5.5).
[mlir][cf] Reject duplicate case values in cf.switch (#245483)
The verifier of cf.switch accepted case values that compare equal as
integers of the flag's width, such as 255 and -1 for an i8 flag. Such an
op has no single destination for that value, and it converts to an
llvm.switch whose translation is rejected by the LLVM IR verifier
("Duplicate integer as switch case").
Report the first repeated value instead, with its signed and, when
different, unsigned spelling and the indices of both cases. Add an
invalid test where 255 and -1 collide for i8, and a test that 1 and -1
remain distinct cases.
AI-assisted: this patch was prepared with Claude Code; I have reviewed
and tested the change and take responsibility for it.
[AMDGPU][GlobalISel] Look through copies for every GCNPat pattern (#231763)
Set GIIgnoreCopies = 1 by default for GCNPat and delete
AMDGPUPatIgnoreCopies and use GCNPat instead. This change allows
GlobalISel to match several patterns it was unable to match before,
therefore closing the gap against SelectionDAG.
Resolves #231524
[CIR] Give complex FP add/sub the fenv memory effects
cir.complex.fadd and cir.complex.fsub were Pure even with a constrained
fenv attribute, so they could be speculated or erased like unconstrained
ops. Derive them from CIR_FenvOp, as the other fenv ops are: constrained
ops read and write the FP environment and are only conditionally
speculatable, unconstrained ops stay effect-free.
Assisted-by: Claude Code (Opus 5.5).
[CIR] Reject the empty fenv attribute
`#cir.fenv<>` with no parameter set was accepted, printed as `fenv<>` and
lowered to a constrained intrinsic, so an unconstrained operation had two
spellings. Give `#cir.fenv` a verifier that requires at least one
parameter, leaving a missing `fenv` attribute as the only way to say an
operation is unconstrained. An absent parameter takes its value in the
default FP environment (tonearest, masked, non-strict). Speculation and
lowering share one FenvAttr::canIgnoreExceptions() check (masked and not
strict, lowered to fpexcept.ignore), so a strict op stays fpexcept.strict
even when masked. Drop FPEnvConstrainedOpInterface, whose only user was
FenvOpTrait, and let the trait read the attribute from the concrete op.
Add a CIR_FenvOp base class carrying the fenv traits and argument, which
the fenv ops prepend their operands to.
Assisted-by: Claude Code (Opus 5.5).
[CIR] Give complex FP add/sub the fenv memory effects
cir.complex.fadd and cir.complex.fsub were Pure even with a constrained
fenv attribute, so they could be speculated or erased like unconstrained
ops. Derive them from CIR_FenvOp, as the other fenv ops are: constrained
ops read and write the FP environment and are only conditionally
speculatable, unconstrained ops stay effect-free.
Assisted-by: Claude Code (Opus 5.5).
[CIR] Reject the empty fenv attribute
`#cir.fenv<>` with no parameter set was accepted, printed as `fenv<>` and
lowered to a constrained intrinsic, so an unconstrained operation had two
spellings. Give `#cir.fenv` a verifier that requires at least one
parameter, leaving a missing `fenv` attribute as the only way to say an
operation is unconstrained. An absent parameter takes its value in the
default FP environment (tonearest, masked, non-strict). Speculation and
lowering share one FenvAttr::canIgnoreExceptions() check (masked and not
strict, lowered to fpexcept.ignore), so a strict op stays fpexcept.strict
even when masked. Drop FPEnvConstrainedOpInterface, whose only user was
FenvOpTrait, and let the trait read the attribute from the concrete op.
Add a CIR_FenvOp base class carrying the fenv traits and argument, which
the fenv ops prepend their operands to.
Assisted-by: Claude Code (Opus 5.5).
[SLP] NFC: make candidate state ownership explicit (#229846)
BoUpSLP contains a mixture of state which relates to the current
candidate and state which persists beyond its lifetime. Gather this
state onto a new CandidateState object which belongs to BoUpSLP.
[C23] Issue 1033 is Not a Defect rather than Fixed (#245581)
I verified offline that this went from Review to Closed and not from
Review to Fixed status; no impact on Clang as this is a library issue.
[SPIRV] Enable NSDI features by default for AMD
Enable -spirv-debug-lexical-block-discriminator-scope,
-spirv-debug-scope-forward-refs and -spirv-debug-declare-untyped-variable
when the target vendor is AMD.
[StackColoring] Don't merge slots into zero-sized allocas (#239612)
StackColoring merges AllocaInst on basis of stack object size. But a 1
byte AllocaInst and a 0 byte AllocaInst will both have stack object size
of 1 byte. If StackColoring merges the two AllocaInsts such that the
surviving alloca has size 0, the accesses of the AllocaInst which had 1
byte size are then described by a 0 byte object, so BasicAA reports
NoAlias, and the machine scheduler can reorder accesses which break
program behaviour.
This change fixes the issue by preventing merging into slots with
zero-sized AllocaInst
Assisted-by: Opus 5.5
---------
Co-authored-by: Nathan Corbyn <n_corbyn at apple.com>
[offload][debug] Add REPORT_WARN and REPORT_FATAL macros
Add two new macros in the same style as REPORT(). REPORT_WARN prints a warning,
while REPORT_FATAL prints a fatal error and exits the program with status 1.
Assisted-by: Claude Sonnet 5.5