llvm.org GIT mirror llvm / 077cee5
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_32@168593 91177308-0d34-0410-b5e6-96231b3b80d8 Pawel Wodnicki 6 years ago
2 changed file(s) with 23 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
20642064 if (A && C && (A == C || A == D || B == C || B == D) &&
20652065 NoLHSWrapProblem && NoRHSWrapProblem) {
20662066 // Determine Y and Z in the form icmp (X+Y), (X+Z).
2067 Value *Y = (A == C || A == D) ? B : A;
2068 Value *Z = (C == A || C == B) ? D : C;
2067 Value *Y, *Z;
2068 if (A == C) {
2069 Y = B;
2070 Z = D;
2071 } else if (A == D) {
2072 Y = B;
2073 Z = C;
2074 } else if (B == C) {
2075 Y = A;
2076 Z = D;
2077 } else if (B == D) {
2078 Y = A;
2079 Z = C;
2080 }
20692081 if (Value *V = SimplifyICmpInst(Pred, Y, Z, Q, MaxRecurse-1))
20702082 return V;
20712083 }
265265 ; CHECK: ret i1 true
266266 }
267267
268 define i1 @add6(i64 %A, i64 %B) {
269 ; CHECK: @add6
270 %s1 = add i64 %A, %B
271 %s2 = add i64 %B, %A
272 %cmp = icmp eq i64 %s1, %s2
273 ret i1 %cmp
274 ; CHECK: ret i1 true
275 }
276
268277 define i1 @addpowtwo(i32 %x, i32 %y) {
269278 ; CHECK: @addpowtwo
270279 %l = lshr i32 %x, 1