summaryrefslogtreecommitdiff
path: root/lib/Transforms
diff options
context:
space:
mode:
authorDuncan Sands <baldrick@free.fr>2012-11-16 20:53:08 +0000
committerDuncan Sands <baldrick@free.fr>2012-11-16 20:53:08 +0000
commit4f0dfbb454ea8110459e2d1ee5f92e74cb3e8a5c (patch)
tree5615a07355c6eadbf638361b798955a4d39e323f /lib/Transforms
parent2217577fa72288246f71c91bf7ee297a61545112 (diff)
downloadllvm-4f0dfbb454ea8110459e2d1ee5f92e74cb3e8a5c.tar.gz
llvm-4f0dfbb454ea8110459e2d1ee5f92e74cb3e8a5c.tar.bz2
llvm-4f0dfbb454ea8110459e2d1ee5f92e74cb3e8a5c.tar.xz
Make this easier to understand, as suggested by Chandler.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168196 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r--lib/Transforms/InstCombine/InstCombineCompares.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/Transforms/InstCombine/InstCombineCompares.cpp b/lib/Transforms/InstCombine/InstCombineCompares.cpp
index e223a049f0..7c3f8fe15d 100644
--- a/lib/Transforms/InstCombine/InstCombineCompares.cpp
+++ b/lib/Transforms/InstCombine/InstCombineCompares.cpp
@@ -2358,15 +2358,20 @@ Instruction *InstCombiner::visitICmpInst(ICmpInst &I) {
// Determine Y and Z in the form icmp (X+Y), (X+Z).
Value *Y, *Z;
if (A == C) {
+ // C + B == C + D -> B == D
Y = B;
Z = D;
} else if (A == D) {
+ // D + B == C + D -> B == C
Y = B;
Z = C;
} else if (B == C) {
+ // A + C == C + D -> A == D
Y = A;
Z = D;
- } else if (B == D) {
+ } else {
+ assert(B == D);
+ // A + D == C + D -> A == C
Y = A;
Z = C;
}