From 9497680067cc5a2e7d4e0bf657b23d57c06e5e97 Mon Sep 17 00:00:00 2001 From: Florian Hahn Date: Fri, 10 Feb 2023 17:12:21 +0000 Subject: [PATCH] [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. --- llvm/include/llvm/Analysis/ConstraintSystem.h | 2 +- llvm/test/Transforms/ConstraintElimination/debug.ll | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/llvm/include/llvm/Analysis/ConstraintSystem.h b/llvm/include/llvm/Analysis/ConstraintSystem.h index 3e1bfbc..e348b38 100644 --- a/llvm/include/llvm/Analysis/ConstraintSystem.h +++ b/llvm/include/llvm/Analysis/ConstraintSystem.h @@ -91,7 +91,7 @@ public: bool isConditionImplied(SmallVector R) const; - ArrayRef getLastConstraint() { return Constraints[0]; } + ArrayRef 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 62f0ed2..580b6d9 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: -- 2.7.4