[Mlir-commits] [mlir] [MLIR] Fix use-after-move for DEBUG builds, and broken assert logic. (PR #164763)
Mehdi Amini
llvmlistbot at llvm.org
Fri Oct 24 05:51:14 PDT 2025
================
@@ -159,14 +159,19 @@ IterationGraphSorter::IterationGraphSorter(
loop2OutLvl(loop2OutLvl), iterTypes(std::move(iterTypes)),
strategy(strategy) {
// One map per tensor.
- assert(loop2InsLvl.size() == ins.size());
+ assert(this->loop2InsLvl.size() == this->ins.size());
// All the affine maps have the same number of dimensions (loops).
assert(llvm::all_equal(llvm::map_range(
- loop2InsLvl, [](AffineMap m) { return m.getNumDims(); })));
+ this->loop2InsLvl, [](AffineMap m) { return m.getNumDims(); })));
// The number of results of the map should match the rank of the tensor.
- assert(llvm::all_of(llvm::zip(loop2InsLvl, ins), [](auto mvPair) {
+ assert(llvm::all_of(llvm::zip(this->loop2InsLvl, this->ins), [](auto mvPair) {
auto [m, v] = mvPair;
- return m.getNumResults() == cast<ShapedType>(v.getType()).getRank();
+
+ // Tensor-like types may have a rank-0 (scalar tensor) or greater.
+ if (llvm::isa<ShapedType>(v.getType()))
+ return m.getNumResults() == llvm::cast<ShapedType>(v.getType()).getRank();
----------------
joker-eph wrote:
```suggestion
if (auto shapedType = llvm::dyn_cast<ShapedType>(v.getType()))
return m.getNumResults() == shapedType.getRank();
```
https://github.com/llvm/llvm-project/pull/164763
More information about the Mlir-commits
mailing list