[Mlir-commits] [mlir] [mlir][scf] Fix trip count signedness and overflow in SCF Utils (PR #178782)
Matthias Springer
llvmlistbot at llvm.org
Fri Jan 30 09:30:31 PST 2026
================
@@ -504,9 +516,13 @@ LogicalResult mlir::loopUnrollFull(scf::ForOp forOp) {
const APInt &tripCount = *mayBeConstantTripCount;
if (tripCount.isZero())
return success();
- if (tripCount.getZExtValue() == 1)
+ // Check for overflow before extracting trip count.
+ if (tripCount.getActiveBits() > 64)
----------------
matthias-springer wrote:
`tripCount.getZExtValue() == 1` ==> `tripCount.isOne()`
https://github.com/llvm/llvm-project/pull/178782
More information about the Mlir-commits
mailing list