[llvm] [ConstraintElim] Drop invalid rows instead of failing the elimination (PR #76299)

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Sat Dec 23 12:13:11 PST 2023


================
@@ -96,27 +98,34 @@ bool ConstraintSystem::eliminateUsingFM() {
           IdxUpper++;
         }
 
-        if (MulOverflow(UpperV, ((-1) * LowerLast / GCD), M1))
-          return false;
+        if (MulOverflow(UpperV, ((-1) * LowerLast / GCD), M1)) {
+          Valid = false;
+          break;
+        }
         if (IdxLower < LowerRow.size() && LowerRow[IdxLower].Id == CurrentId) {
           LowerV = LowerRow[IdxLower].Coefficient;
           IdxLower++;
         }
 
-        if (MulOverflow(LowerV, (UpperLast / GCD), M2))
-          return false;
-        if (AddOverflow(M1, M2, N))
-          return false;
+        if (MulOverflow(LowerV, (UpperLast / GCD), M2)) {
+          Valid = false;
+          break;
+        }
+        if (AddOverflow(M1, M2, N)) {
+          Valid = false;
+          break;
+        }
         if (N == 0)
           continue;
         NR.emplace_back(N, CurrentId);
 
-        NewGCD =
-            APIntOps::GreatestCommonDivisor({32, (uint32_t)N}, {32, NewGCD})
+        NextGCD =
----------------
dtcxzyw wrote:

I am confused about the `GCD` here. It always evaluates to 1 since its initial value is 1.


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


More information about the llvm-commits mailing list