[llvm] 9497680 - [ConstraintElim] Update getLastConstraint to return to last row. (NFC)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 10 09:12:50 PST 2023


Author: Florian Hahn
Date: 2023-02-10T17:12:21Z
New Revision: 9497680067cc5a2e7d4e0bf657b23d57c06e5e97

URL: https://github.com/llvm/llvm-project/commit/9497680067cc5a2e7d4e0bf657b23d57c06e5e97
DIFF: https://github.com/llvm/llvm-project/commit/9497680067cc5a2e7d4e0bf657b23d57c06e5e97.diff

LOG: [ConstraintElim] Update getLastConstraint to return to last row. (NFC)

The current code incorrectly returned the first instead of the last row.
This fixes the debug output.

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/Analysis/ConstraintSystem.h b/llvm/include/llvm/Analysis/ConstraintSystem.h
index 3e1bfbc03aae..e348b38f152a 100644
--- a/llvm/include/llvm/Analysis/ConstraintSystem.h
+++ b/llvm/include/llvm/Analysis/ConstraintSystem.h
@@ -91,7 +91,7 @@ class ConstraintSystem {
 
   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) {

diff  --git a/llvm/test/Transforms/ConstraintElimination/debug.ll b/llvm/test/Transforms/ConstraintElimination/debug.ll
index 62f0ed2e1b9f..580b6d9d0fb5 100644
--- a/llvm/test/Transforms/ConstraintElimination/debug.ll
+++ b/llvm/test/Transforms/ConstraintElimination/debug.ll
@@ -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:


        


More information about the llvm-commits mailing list