[Mlir-commits] [llvm] [mlir] Do not trigger UB during AffineExpr parsing. (PR #96896)

Adrian Kuegel llvmlistbot at llvm.org
Thu Jun 27 04:25:46 PDT 2024


================
@@ -905,10 +921,16 @@ static AffineExpr simplifyCeilDiv(AffineExpr lhs, AffineExpr rhs) {
   if (!rhsConst || rhsConst.getValue() < 1)
     return nullptr;
 
-  if (lhsConst)
+  if (lhsConst) {
+    // divideCeilSigned can only overflow in this case:
+    if (lhsConst.getValue() == std::numeric_limits<int64_t>::min() &&
----------------
akuegel wrote:

sgtm

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


More information about the Mlir-commits mailing list