[DomTree] Make addChild/removeChild private, update NewGVN caller (#218164)
NewGVN's value numbering loop converges more quickly when blocks are
processed in a reverse post order. The code additionally ensures a
property the pass does not need (commit 6658cc9ead67 in 2016): in a
preorder of the dominator tree the instructions dominated by a block are
contiguous.
Use the default RPO and drop addChild/removeChild callers, so that the
two members can be made private. `opt -passes=newgvn` slightly
decreases.
[mlir][xegpu] Lower dynamic high-D nd load/store via base-pointer fold (#215711)
Reworks lowering of >2D (batched)
`xegpu.create_nd_tdesc`/`load_nd`/`store_nd`/ `prefetch_nd` (batched
GEMM, rank-4 flash-attention) to keep the full high-D memref as the
descriptor source and carry the leading (batch) offsets as a row offset
into a flattened 2D plane, instead of slicing a per-batch
`memref.subview` during blocking.
For example, the wg-level IR read a 4d vector out of a dynamic shaped
memref.
```mlir
%0 = vector.transfer_read %source[%i, %j, %k, %l], %c0
{in_bounds = [true, true, true, true]} : memref<?x?x8x16xf32>,
vector<2x4x8x16xf32>
```
This lowers with no subview — the full memref is the descriptor source
and all four offsets stay on the load:
[35 lines not shown]
SelectionDAG: Fix widening of vector addrspacecast results (#217898)
WidenVecRes_ADDRSPACECAST unconditionally called GetWidenedVector on the
source operand, which asserts the operand is itself in the
widened-vector
map. When the source vector type does not require widening (e.g. a
<5 x ptr addrspace(3)> cast to <5 x ptr>, where the source is padded
rather than widened), this asserted or crashed. Handle the non-widened
source by padding it up to the widened element count instead.
Co-authored-by: Claude (Claude-Opus-4.8) <noreply at anthropic.com>
[VPlan] Expand sequential/regular UMin SCEVs in VPSCEVExpander. (#209786)
Add support for expanding SequentialUMinExpr SCEV expressions in
VPSCEVExpander.
For regular UMin expressions, the expansion unconditionally expands &
executes all operands, while the semantics of sequential UMin only
require the first operand to be evaluated unconditionally.
For sequential UMin expressions, we need to make sure potentially
UB/poison generating operands must be accounted for. Matching IR SCEV
expander, make sure that divisors of UDiv are poison-free and non-zero
inside sequential UMin. Similarly, freeze all operands other than the
first, to avoid poison from propagating.
PR: https://github.com/llvm/llvm-project/pull/209786
[InstSimplify] Simplify nonzero comparisons involving X urem Y via X u>= Y (#216072)
This teaches ValueTracking that `X` and `X urem Y` are non-equal when a
dominating condition implies `X u>= Y`.
It also handles cases where `X u>= Y` can be proven structurally, such
as when `X` is an `add nuw` of `A` and `Y`.
For a defined `urem`, let `R = X urem Y`. Then:
```text
R == X <=> X u< Y
R != X <=> X u>= Y
```
This allows InstSimplify's existing nonzero reasoning to simplify
comparisons equivalent to `(X - R) != 0`, including:
- `(X - R) u>= 1` and `(X - R) u< 1`
[8 lines not shown]
[MLIR][Python] Add effect and speculatability specifiers for Python-defined ops (#216773)
This PR adds standalone effect and speculatability specifiers for
Python-defined operations.
`NoMemoryEffect` and `AlwaysSpeculatable`, previously nested under
`Pure`, are now public, and `RecursivelySpeculatable` is added. `Pure`
remains a shorthand for attaching `NoMemoryEffect` and
`AlwaysSpeculatable`.
This also exposes `OpTrait::HasRecursiveMemoryEffects` through the C API
and Python bindings as `ir.RecursiveMemoryEffectsTrait`, allowing
region-bearing Python-defined operations to derive their memory effects
from nested operations:
```python
class LeafOp(
TestDialect.Operation,
name="leaf",
[22 lines not shown]
[clang-tidy] Fix false positives in readability-trailing-comma for designated initializers (#215934)
The problem is that we delete the necessary comma whenever we use
implicit initializer lists. How we solve this is that whenever we see an
implicit initializer list, we do not match ``InitListExpr`` nodes at
all, so that we will not delete the necessary comma. Why we chose this
path is detailed in Alternatives considered.
This produces a fix that breaks valid code (#214087) and one that never
converges (#214086).
<details>
<summary><b>Alternatives considered</b></summary>
### Why not repair the source ranges instead
The synthesized nodes also carry misleading locations - their range is a
snapshot of the designator that caused them to be created, so it need
not cover their own children. The anonymous-struct node in #214087
[38 lines not shown]
[clang-cl] Fix help string output for `/experimental:deterministic` option. NFC (#207083)
The `clang-cl -help` command show the help string for
`/experimental:deterministic` options with the default metavar name
value that should not be:
/experimental:deterministic<value>
This patch fixes this output and omits the `<value>` part for the
option.
[DebugInfo][CodeView] Emit path prefix substitution for COFF object file name. (#205729)
The `S_OBJNAME` field value gets by bypassing `CGDebugInfo` and its path
prefix does not get remapped if requested `fdebug-prefix-map=` option as
the other pathes in the debug info. This patch fixes it and does
remapping for the object file path either.
[SLP] Fix canConvertToFMA fmul costing (#216425)
Price the unfused fmul without a context instruction. Targets that model
fma fusion price a contractable fmul as free, which discounted the
scalar side of the comparison too and fmuladd never looked profitable.
[Clang][OpenMP] Fixed an assertion when `#pragma omp declare simd` or `#pragma omp declare variant` is followed by another OpenMP declarative directive containing a qualified identifier (#217875)
For code
```cpp
void foo();
#pragma omp declare simd
#pragma omp declare target to(foo)
```
Clang currently accepts this without rejection. The underlying cause is
that OpenMP pragma parsing for directives like `declare target to(...)`
performs name lookup without advancing the source location to create a
new declaration. As a result, the parser fetches the existing Decl of
foo and passes it up to declare simd, silently bypassing Sema
diagnostics.
https://godbolt.org/z/szPne5n45
---
[27 lines not shown]
[LAA] ZExt size from deref bundles to widest type. (#217939)
The size in a dereferenceable bundle may have a different bitwidth than
the access size. Both are interpreted as unsigned values. Update
WidestTy to account for possibility of the type for the bundle being
narrower.
Fixes a crash similar to
https://github.com/llvm/llvm-project/pull/217770.
PR: https://github.com/llvm/llvm-project/pull/217939
[SCEV] Avoid overflow in howManyGreaterThans. (#217744)
howManyGreaterThans computes the backedge-taken count as ((Start - End)
+ (Stride - 1)) /u Stride. The addition can overflow, causing incorrect
results.
Instead, use getUDivCeilSCEV if Start >= End, mirroring
howManyLessThans. It also has additional handling for stride being a
power of 2, which allows using the simpler formula in more cases.
I'll check if we can unify the code (as implied by the FIXME I think),
instead of duplicating more logic.
Fixes https://github.com/llvm/llvm-project/issues/217537.
Fixes https://github.com/llvm/llvm-project/issues/187472.
PR: https://github.com/llvm/llvm-project/pull/217744
[clang-tidy] Fix crashes when analyzing unknown exceptions in bugprone-exception-escape (#218067)
`ExceptionAnalyzer` represents exceptions of unknown type with a null
`Type`, but some consumers dereferenced it unconditionally, resulting in
a crash when `TreatFunctionsWithoutSpecificationAsThrowing` is enabled.
This commit fixes the problem by skipping type-dependent processing for
unknown exceptions.
Fixes #217649