[llvm] [mlir] Do not trigger UB during AffineExpr parsing. (PR #96896)
Adrian Kuegel via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 27 04:16:28 PDT 2024
================
@@ -849,10 +859,16 @@ static AffineExpr simplifyFloorDiv(AffineExpr lhs, AffineExpr rhs) {
if (!rhsConst || rhsConst.getValue() < 1)
return nullptr;
- if (lhsConst)
+ if (lhsConst) {
+ // divideFloorSigned can only overflow in this case:
+ if (lhsConst.getValue() == std::numeric_limits<int64_t>::min() &&
+ rhsConst.getValue() == -1) {
----------------
akuegel wrote:
Already covered above in line 859
https://github.com/llvm/llvm-project/pull/96896
More information about the llvm-commits
mailing list