[llvm-commits] [llvm] r168196 - in /llvm/trunk/lib: Analysis/InstructionSimplify.cpp Transforms/InstCombine/InstCombineCompares.cpp
Duncan Sands
baldrick at free.fr
Fri Nov 16 12:53:08 PST 2012
Author: baldrick
Date: Fri Nov 16 14:53:08 2012
New Revision: 168196
URL: http://llvm.org/viewvc/llvm-project?rev=168196&view=rev
Log:
Make this easier to understand, as suggested by Chandler.
Modified:
llvm/trunk/lib/Analysis/InstructionSimplify.cpp
llvm/trunk/lib/Transforms/InstCombine/InstCombineCompares.cpp
Modified: llvm/trunk/lib/Analysis/InstructionSimplify.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/InstructionSimplify.cpp?rev=168196&r1=168195&r2=168196&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/InstructionSimplify.cpp (original)
+++ llvm/trunk/lib/Analysis/InstructionSimplify.cpp Fri Nov 16 14:53:08 2012
@@ -2067,15 +2067,20 @@
// 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;
}
Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineCompares.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineCompares.cpp?rev=168196&r1=168195&r2=168196&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/InstCombine/InstCombineCompares.cpp (original)
+++ llvm/trunk/lib/Transforms/InstCombine/InstCombineCompares.cpp Fri Nov 16 14:53:08 2012
@@ -2358,15 +2358,20 @@
// 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;
}
More information about the llvm-commits
mailing list