diff options
author | Nikita Popov <npopov@redhat.com> | 2023-06-16 15:47:39 +0200 |
---|---|---|
committer | Nikita Popov <npopov@redhat.com> | 2023-06-16 15:50:12 +0200 |
commit | b7bd3a734c7c08e1a703a4f23e3e854ba94a1bf2 (patch) | |
tree | 612565e9a42f03173b88d415f07a1eb50734226b /llvm/lib/CodeGen/CodeGenPrepare.cpp | |
parent | 5e73fda53ccb8c1b0fd47eba189fd742256214fb (diff) | |
download | llvm-b7bd3a734c7c08e1a703a4f23e3e854ba94a1bf2.zip llvm-b7bd3a734c7c08e1a703a4f23e3e854ba94a1bf2.tar.gz llvm-b7bd3a734c7c08e1a703a4f23e3e854ba94a1bf2.tar.bz2 |
[CGP] Fix infinite loop in icmp operand swapping
Don't swap the operands if they're the same. Fixes the issue reported
at https://reviews.llvm.org/D152541#4427017.
Diffstat (limited to 'llvm/lib/CodeGen/CodeGenPrepare.cpp')
-rw-r--r-- | llvm/lib/CodeGen/CodeGenPrepare.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/CodeGenPrepare.cpp b/llvm/lib/CodeGen/CodeGenPrepare.cpp index ee4c193..0e2793a 100644 --- a/llvm/lib/CodeGen/CodeGenPrepare.cpp +++ b/llvm/lib/CodeGen/CodeGenPrepare.cpp @@ -1837,7 +1837,7 @@ static bool swapICmpOperandsToExposeCSEOpportunities(CmpInst *Cmp) { Value *Op0 = Cmp->getOperand(0); Value *Op1 = Cmp->getOperand(1); if (!Op0->getType()->isIntegerTy() || isa<Constant>(Op0) || - isa<Constant>(Op1)) + isa<Constant>(Op1) || Op0 == Op1) return false; // If a subtract already has the same operands as a compare, swapping would be |