[ConstraintElim] Update getLastConstraint to return to last row. (NFC)
authorFlorian Hahn <flo@fhahn.com>
Fri, 10 Feb 2023 17:12:21 +0000 (17:12 +0000)
committerFlorian Hahn <flo@fhahn.com>
Fri, 10 Feb 2023 17:12:21 +0000 (17:12 +0000)
The current code incorrectly returned the first instead of the last row.
This fixes the debug output.

llvm/include/llvm/Analysis/ConstraintSystem.h
llvm/test/Transforms/ConstraintElimination/debug.ll

index 3e1bfbc..e348b38 100644 (file)
@@ -91,7 +91,7 @@ public:
 
   bool isConditionImplied(SmallVector<int64_t, 8> R) const;
 
-  ArrayRef<int64_t> getLastConstraint() { return Constraints[0]; }
+  ArrayRef<int64_t> getLastConstraint() { return Constraints.back(); }
   void popLastConstraint() { Constraints.pop_back(); }
   void popLastNVariables(unsigned N) {
     for (auto &C : Constraints) {
index 62f0ed2..580b6d9 100644 (file)
@@ -16,7 +16,7 @@ define i1 @test_and_ule(i4 %x, i4 %y, i4 %z) {
 ; CHECK: Checking   %t.1 = icmp ule i4 %x, %z
 ; CHECK: Condition   %t.1 = icmp ule i4 %x, %z implied by dominating constraints
 
-; CHECK: Removing %x + -1 * %y <= 0
+; CHECK: Removing %y + -1 * %z <= 0
 ; CHECK: Removing %x + -1 * %y <= 0
 
 entry: