[Mlir-commits] [mlir] [MLIR][Utils] Fix overflow in constantTripCount for narrow types (PR #179985)
Matthias Springer
llvmlistbot at llvm.org
Fri Feb 6 01:46:39 PST 2026
================
@@ -397,11 +404,28 @@ std::optional<APInt> constantTripCount(
return std::nullopt;
}
+ // Extend stepCst to match the bitwidth of diff if needed (e.g., when diff was
+ // extended to avoid overflow). Step is always positive here, so zero-extend.
+ llvm::APInt extendedStepCst = stepCst;
+ if (extendedStepCst.getBitWidth() < diff.getBitWidth()) {
----------------
matthias-springer wrote:
Bitwidth extension can also be dropped here.
https://github.com/llvm/llvm-project/pull/179985
More information about the Mlir-commits
mailing list