[llvm-branch-commits] [llvm-branch] r168593 - in /llvm/branches/release_32: ./ lib/Analysis/InstructionSimplify.cpp test/Transforms/InstSimplify/compare.ll
Pawel Wodnicki
pawel at 32bitmicro.com
Mon Nov 26 08:49:57 PST 2012
Author: pawel
Date: Mon Nov 26 10:49:56 2012
New Revision: 168593
URL: http://llvm.org/viewvc/llvm-project?rev=168593&view=rev
Log:
Merging r168186: into the 3.2 release branch.
InstructionSimplify should be able to simplify A+B==B+A to 'true'
but wasn't due to the same logic bug that caused PR14361.
Modified:
llvm/branches/release_32/ (props changed)
llvm/branches/release_32/lib/Analysis/InstructionSimplify.cpp
llvm/branches/release_32/test/Transforms/InstSimplify/compare.ll
Propchange: llvm/branches/release_32/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Nov 26 10:49:56 2012
@@ -1,3 +1,3 @@
/llvm/branches/Apple/Pertwee:110850,110961
/llvm/branches/type-system-rewrite:133420-134817
-/llvm/trunk:155241,167718-167719,167731,167737,167743,167750,167784,167811,167817,167855,167860-167864,167875,167942,167948,167966,168001,168035,168181,168189,168197-168198,168227,168280,168291,168316,168319-168320,168346,168352,168354,168361,168364,168512
+/llvm/trunk:155241,167718-167719,167731,167737,167743,167750,167784,167811,167817,167855,167860-167864,167875,167942,167948,167966,168001,168035,168181,168186,168189,168197-168198,168227,168280,168291,168316,168319-168320,168346,168352,168354,168361,168364,168512
Modified: llvm/branches/release_32/lib/Analysis/InstructionSimplify.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_32/lib/Analysis/InstructionSimplify.cpp?rev=168593&r1=168592&r2=168593&view=diff
==============================================================================
--- llvm/branches/release_32/lib/Analysis/InstructionSimplify.cpp (original)
+++ llvm/branches/release_32/lib/Analysis/InstructionSimplify.cpp Mon Nov 26 10:49:56 2012
@@ -2065,8 +2065,20 @@
if (A && C && (A == C || A == D || B == C || B == D) &&
NoLHSWrapProblem && NoRHSWrapProblem) {
// Determine Y and Z in the form icmp (X+Y), (X+Z).
- Value *Y = (A == C || A == D) ? B : A;
- Value *Z = (C == A || C == B) ? D : C;
+ Value *Y, *Z;
+ if (A == C) {
+ Y = B;
+ Z = D;
+ } else if (A == D) {
+ Y = B;
+ Z = C;
+ } else if (B == C) {
+ Y = A;
+ Z = D;
+ } else if (B == D) {
+ Y = A;
+ Z = C;
+ }
if (Value *V = SimplifyICmpInst(Pred, Y, Z, Q, MaxRecurse-1))
return V;
}
Modified: llvm/branches/release_32/test/Transforms/InstSimplify/compare.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_32/test/Transforms/InstSimplify/compare.ll?rev=168593&r1=168592&r2=168593&view=diff
==============================================================================
--- llvm/branches/release_32/test/Transforms/InstSimplify/compare.ll (original)
+++ llvm/branches/release_32/test/Transforms/InstSimplify/compare.ll Mon Nov 26 10:49:56 2012
@@ -266,6 +266,15 @@
; CHECK: ret i1 true
}
+define i1 @add6(i64 %A, i64 %B) {
+; CHECK: @add6
+ %s1 = add i64 %A, %B
+ %s2 = add i64 %B, %A
+ %cmp = icmp eq i64 %s1, %s2
+ ret i1 %cmp
+; CHECK: ret i1 true
+}
+
define i1 @addpowtwo(i32 %x, i32 %y) {
; CHECK: @addpowtwo
%l = lshr i32 %x, 1
More information about the llvm-branch-commits
mailing list