[Mlir-commits] [mlir] [mlir][scf] Fix unsigned narrow type trip count calculation (PR #178060)

Jhalak Patel llvmlistbot at llvm.org
Tue Jan 27 12:06:46 PST 2026


================
@@ -228,6 +228,9 @@ LogicalResult foldDynamicStrideList(SmallVectorImpl<OpFoldResult> &strides);
 /// where %ub is computed as a static offset from %lb.
 /// Note: the matched addition should be nsw/nuw (matching the loop comparison)
 /// to avoid overflow, otherwise an overflow would imply a zero trip count.
+///
+/// For unsigned narrow types, the result is zero-extended to 64 bits to avoid
----------------
jhalakpatel wrote:

are you suggesting it is OK to throw an error when the trip count overflows? Eg. 0xFF would be interpreted as `-1` (unless we fix all the call sites etc.)

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


More information about the Mlir-commits mailing list