[Mlir-commits] [mlir] [ mlir][scf] Allow 'ult'/'ugt' in uplift (PR #139911)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Wed May 14 10:52:23 PDT 2025


================
@@ -91,9 +91,10 @@ FailureOr<scf::ForOp> mlir::scf::upliftWhileToForLoop(RewriterBase &rewriter,
 
   using Pred = arith::CmpIPredicate;
   Pred predicate = cmp.getPredicate();
-  if (predicate != Pred::slt && predicate != Pred::sgt)
+  if (predicate != Pred::slt && predicate != Pred::sgt &&
+      predicate != Pred::ult && predicate != Pred::ugt)
----------------
darkbuck wrote:

> why is ult/ugt correct? scf::for will do a signed comparison so the new IR is not equivalent.

Sorry, I may misread that. But, for `scf.for`, it reads that

```
 151     The `scf.for` operation represents a loop taking 3 SSA value as operands
 152     that represent the lower bound, upper bound and step respectively. The
 153     operation defines an SSA value for its induction variable. It has one
 154     region capturing the loop body. The induction variable is represented as an
 155     argument of this region. This SSA value is a signless integer or index.
```

Is that indvar signless integer?


https://github.com/llvm/llvm-project/pull/139911


More information about the Mlir-commits mailing list