Hi Chad,<div><br></div><div>It looks like this change has broken down one of our internal GPU-related tests.</div><div>Are you 100% sure it's correct? If not, can you please revert and fix offline?</div><div><br></div><div>--</div><div>Tim<br><br><div class="gmail_quote">On Mon Nov 17 2014 at 7:40:00 PM Chad Rosier <<a href="mailto:mcrosier@codeaurora.org">mcrosier@codeaurora.org</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: mcrosier<br>
Date: Mon Nov 17 10:33:50 2014<br>
New Revision: 222142<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=222142&view=rev" target="_blank" class="cremed">http://llvm.org/viewvc/llvm-<u></u>project?rev=222142&view=rev</a><br>
Log:<br>
[Reassociate] As the expression tree is rewritten make sure the operands are<br>
emitted in canonical form.<br>
<br>
Modified:<br>
llvm/trunk/lib/Transforms/<u></u>Scalar/Reassociate.cpp<br>
llvm/trunk/test/Transforms/<u></u>Reassociate/2002-05-15-<u></u>MissedTree.ll<br>
llvm/trunk/test/Transforms/<u></u>Reassociate/2002-05-15-<u></u>SubReassociate.ll<br>
llvm/trunk/test/Transforms/<u></u>Reassociate/basictest.ll<br>
llvm/trunk/test/Transforms/<u></u>Reassociate/canonicalize-neg-<u></u>const.ll<br>
llvm/trunk/test/Transforms/<u></u>Reassociate/commute.ll<br>
llvm/trunk/test/Transforms/<u></u>Reassociate/fast-<u></u>SubReassociate.ll<br>
llvm/trunk/test/Transforms/<u></u>Reassociate/fast-basictest.ll<br>
llvm/trunk/test/Transforms/<u></u>Reassociate/fast-fp-commute.ll<br>
llvm/trunk/test/Transforms/<u></u>Reassociate/fast-multistep.ll<br>
llvm/trunk/test/Transforms/<u></u>Reassociate/mixed-fast-<u></u>nonfast-fp.ll<br>
llvm/trunk/test/Transforms/<u></u>Reassociate/multistep.ll<br>
llvm/trunk/test/Transforms/<u></u>Reassociate/no-op.ll<br>
llvm/trunk/test/Transforms/<u></u>Reassociate/optional-flags.ll<br>
llvm/trunk/test/Transforms/<u></u>Reassociate/shift-factor.ll<br>
llvm/trunk/test/Transforms/<u></u>Reassociate/subtest.ll<br>
llvm/trunk/test/Transforms/<u></u>Reassociate/xor_reassoc.ll<br>
<br>
Modified: llvm/trunk/lib/Transforms/<u></u>Scalar/Reassociate.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/Reassociate.cpp?rev=222142&r1=222141&r2=222142&view=diff" target="_blank" class="cremed">http://llvm.org/viewvc/llvm-<u></u>project/llvm/trunk/lib/<u></u>Transforms/Scalar/Reassociate.<u></u>cpp?rev=222142&r1=222141&r2=<u></u>222142&view=diff</a><br>
==============================<u></u>==============================<u></u>==================<br>
--- llvm/trunk/lib/Transforms/<u></u>Scalar/Reassociate.cpp (original)<br>
+++ llvm/trunk/lib/Transforms/<u></u>Scalar/Reassociate.cpp Mon Nov 17 10:33:50 2014<br>
@@ -791,14 +791,11 @@ void Reassociate::RewriteExprTree(<u></u>Binary<br>
Value *OldLHS = Op->getOperand(0);<br>
Value *OldRHS = Op->getOperand(1);<br>
<br>
- if (NewLHS == OldLHS && NewRHS == OldRHS)<br>
- // Nothing changed, leave it alone.<br>
- break;<br>
-<br>
- if (NewLHS == OldRHS && NewRHS == OldLHS) {<br>
- // The order of the operands was reversed. Swap them.<br>
+ // The new operation differs trivially from the original.<br>
+ if ((NewLHS == OldLHS && NewRHS == OldRHS) ||<br>
+ (NewLHS == OldRHS && NewRHS == OldLHS)) {<br>
DEBUG(dbgs() << "RA: " << *Op << '\n');<br>
- Op->swapOperands();<br>
+ canonicalizeOperands(Op);<br>
DEBUG(dbgs() << "TO: " << *Op << '\n');<br>
MadeChange = true;<br>
++NumChanged;<br>
@@ -820,6 +817,8 @@ void Reassociate::RewriteExprTree(<u></u>Binary<br>
NodesToRewrite.push_back(BO);<br>
Op->setOperand(1, NewRHS);<br>
}<br>
+ // Put the operands in canonical form.<br>
+ canonicalizeOperands(Op);<br>
DEBUG(dbgs() << "TO: " << *Op << '\n');<br>
<br>
ExpressionChanged = Op;<br>
@@ -856,6 +855,7 @@ void Reassociate::RewriteExprTree(<u></u>Binary<br>
// into it.<br>
BinaryOperator *BO = isReassociableOp(Op-><u></u>getOperand(0), Opcode);<br>
if (BO && !NotRewritable.count(BO)) {<br>
+ canonicalizeOperands(Op);<br>
Op = BO;<br>
continue;<br>
}<br>
@@ -880,6 +880,7 @@ void Reassociate::RewriteExprTree(<u></u>Binary<br>
<br>
DEBUG(dbgs() << "RA: " << *Op << '\n');<br>
Op->setOperand(0, NewOp);<br>
+ canonicalizeOperands(Op);<br>
DEBUG(dbgs() << "TO: " << *Op << '\n');<br>
ExpressionChanged = Op;<br>
MadeChange = true;<br>
<br>
Modified: llvm/trunk/test/Transforms/<u></u>Reassociate/2002-05-15-<u></u>MissedTree.ll<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/Reassociate/2002-05-15-MissedTree.ll?rev=222142&r1=222141&r2=222142&view=diff" target="_blank" class="cremed">http://llvm.org/viewvc/llvm-<u></u>project/llvm/trunk/test/<u></u>Transforms/Reassociate/2002-<u></u>05-15-MissedTree.ll?rev=<u></u>222142&r1=222141&r2=222142&<u></u>view=diff</a><br>
==============================<u></u>==============================<u></u>==================<br>
--- llvm/trunk/test/Transforms/<u></u>Reassociate/2002-05-15-<u></u>MissedTree.ll (original)<br>
+++ llvm/trunk/test/Transforms/<u></u>Reassociate/2002-05-15-<u></u>MissedTree.ll Mon Nov 17 10:33:50 2014<br>
@@ -2,7 +2,7 @@<br>
<br>
define i32 @test1(i32 %A, i32 %B) {<br>
; CHECK-LABEL: test1<br>
-; CHECK: %Z = add i32 %B, %A<br>
+; CHECK: %Z = add i32 %A, %B<br>
; CHECK: ret i32 %Z<br>
%W = add i32 %B, -5<br>
%Y = add i32 %A, 5<br>
<br>
Modified: llvm/trunk/test/Transforms/<u></u>Reassociate/2002-05-15-<u></u>SubReassociate.ll<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/Reassociate/2002-05-15-SubReassociate.ll?rev=222142&r1=222141&r2=222142&view=diff" target="_blank" class="cremed">http://llvm.org/viewvc/llvm-<u></u>project/llvm/trunk/test/<u></u>Transforms/Reassociate/2002-<u></u>05-15-SubReassociate.ll?rev=<u></u>222142&r1=222141&r2=222142&<u></u>view=diff</a><br>
==============================<u></u>==============================<u></u>==================<br>
--- llvm/trunk/test/Transforms/<u></u>Reassociate/2002-05-15-<u></u>SubReassociate.ll (original)<br>
+++ llvm/trunk/test/Transforms/<u></u>Reassociate/2002-05-15-<u></u>SubReassociate.ll Mon Nov 17 10:33:50 2014<br>
@@ -16,7 +16,7 @@ define i32 @test1(i32 %A, i32 %B) {<br>
; With sub reassociation, constant folding can eliminate the two 12 constants.<br>
define i32 @test2(i32 %A, i32 %B, i32 %C, i32 %D) {<br>
; CHECK-LABEL: test2<br>
-; CHECK-NEXT: %sum = add i32 %B, %A<br>
+; CHECK-NEXT: %sum = add i32 %A, %B<br>
; CHECK-NEXT: %sum1 = add i32 %sum, %C<br>
; CHECK-NEXT: %Q = sub i32 %D, %sum1<br>
; CHECK-NEXT: ret i32 %Q<br>
<br>
Modified: llvm/trunk/test/Transforms/<u></u>Reassociate/basictest.ll<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/Reassociate/basictest.ll?rev=222142&r1=222141&r2=222142&view=diff" target="_blank" class="cremed">http://llvm.org/viewvc/llvm-<u></u>project/llvm/trunk/test/<u></u>Transforms/Reassociate/<u></u>basictest.ll?rev=222142&r1=<u></u>222141&r2=222142&view=diff</a><br>
==============================<u></u>==============================<u></u>==================<br>
--- llvm/trunk/test/Transforms/<u></u>Reassociate/basictest.ll (original)<br>
+++ llvm/trunk/test/Transforms/<u></u>Reassociate/basictest.ll Mon Nov 17 10:33:50 2014<br>
@@ -17,7 +17,7 @@ define i32 @test2(i32 %reg109, i32 %reg1<br>
ret i32 %reg117<br>
<br>
; CHECK-LABEL: @test2<br>
-; CHECK-NEXT: %reg117 = add i32 %reg1111, %reg109<br>
+; CHECK-NEXT: %reg117 = add i32 %reg109, %reg1111<br>
; CHECK-NEXT: ret i32 %reg117<br>
}<br>
<br>
@@ -121,7 +121,7 @@ define i32 @test7(i32 %A, i32 %B, i32 %C<br>
ret i32 %r<br>
<br>
; CHECK-LABEL: @test7<br>
-; CHECK-NEXT: add i32 %C, %B<br>
+; CHECK-NEXT: add i32 %B, %C<br>
; CHECK-NEXT: mul i32<br>
; CHECK-NEXT: mul i32<br>
; CHECK-NEXT: ret i32<br>
@@ -135,7 +135,7 @@ define i32 @test8(i32 %X, i32 %Y, i32 %Z<br>
ret i32 %C<br>
<br>
; CHECK-LABEL: @test8<br>
-; CHECK-NEXT: %A = mul i32 %Y, %X<br>
+; CHECK-NEXT: %A = mul i32 %X, %Y<br>
; CHECK-NEXT: %C = sub i32 %Z, %A<br>
; CHECK-NEXT: ret i32 %C<br>
}<br>
<br>
Modified: llvm/trunk/test/Transforms/<u></u>Reassociate/canonicalize-neg-<u></u>const.ll<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/Reassociate/canonicalize-neg-const.ll?rev=222142&r1=222141&r2=222142&view=diff" target="_blank" class="cremed">http://llvm.org/viewvc/llvm-<u></u>project/llvm/trunk/test/<u></u>Transforms/Reassociate/<u></u>canonicalize-neg-const.ll?rev=<u></u>222142&r1=222141&r2=222142&<u></u>view=diff</a><br>
==============================<u></u>==============================<u></u>==================<br>
--- llvm/trunk/test/Transforms/<u></u>Reassociate/canonicalize-neg-<u></u>const.ll (original)<br>
+++ llvm/trunk/test/Transforms/<u></u>Reassociate/canonicalize-neg-<u></u>const.ll Mon Nov 17 10:33:50 2014<br>
@@ -53,7 +53,7 @@ define double @test3(double %x, double %<br>
define i64 @test4(i64 %x, i64 %y) {<br>
; CHECK-LABEL: @test4<br>
; CHECK-NEXT: mul i64 %y, 1234<br>
-; CHECK-NEXT: add i64 %mul, %x<br>
+; CHECK-NEXT: add i64 %x, %mul<br>
; CHECK-NEXT: ret i64 %sub<br>
<br>
%mul = mul i64 %y, -1234<br>
<br>
Modified: llvm/trunk/test/Transforms/<u></u>Reassociate/commute.ll<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/Reassociate/commute.ll?rev=222142&r1=222141&r2=222142&view=diff" target="_blank" class="cremed">http://llvm.org/viewvc/llvm-<u></u>project/llvm/trunk/test/<u></u>Transforms/Reassociate/<u></u>commute.ll?rev=222142&r1=<u></u>222141&r2=222142&view=diff</a><br>
==============================<u></u>==============================<u></u>==================<br>
--- llvm/trunk/test/Transforms/<u></u>Reassociate/commute.ll (original)<br>
+++ llvm/trunk/test/Transforms/<u></u>Reassociate/commute.ll Mon Nov 17 10:33:50 2014<br>
@@ -4,8 +4,8 @@ declare void @use(i32)<br>
<br>
define void @test1(i32 %x, i32 %y) {<br>
; CHECK-LABEL: test1<br>
-; CHECK: mul i32 %y, %x<br>
-; CHECK: mul i32 %y, %x<br>
+; CHECK: mul i32 %x, %y<br>
+; CHECK: mul i32 %x, %y<br>
; CHECK: sub i32 %1, %2<br>
; CHECK: call void @use(i32 %{{.*}})<br>
; CHECK: call void @use(i32 %{{.*}})<br>
<br>
Modified: llvm/trunk/test/Transforms/<u></u>Reassociate/fast-<u></u>SubReassociate.ll<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/Reassociate/fast-SubReassociate.ll?rev=222142&r1=222141&r2=222142&view=diff" target="_blank" class="cremed">http://llvm.org/viewvc/llvm-<u></u>project/llvm/trunk/test/<u></u>Transforms/Reassociate/fast-<u></u>SubReassociate.ll?rev=222142&<u></u>r1=222141&r2=222142&view=diff</a><br>
==============================<u></u>==============================<u></u>==================<br>
--- llvm/trunk/test/Transforms/<u></u>Reassociate/fast-<u></u>SubReassociate.ll (original)<br>
+++ llvm/trunk/test/Transforms/<u></u>Reassociate/fast-<u></u>SubReassociate.ll Mon Nov 17 10:33:50 2014<br>
@@ -49,8 +49,8 @@ define float @test3(float %A, float %B,<br>
; With sub reassociation, constant folding can eliminate the two 12 constants.<br>
define float @test4(float %A, float %B, float %C, float %D) {<br>
; CHECK-LABEL: test4<br>
-; CHECK-NEXT: %B.neg = fsub fast float -0.000000e+00, %B<br>
-; CHECK-NEXT: %O.neg = fsub fast float %B.neg, %A<br>
+; CHECK-NEXT: %A.neg = fsub fast float -0.000000e+00, %A<br>
+; CHECK-NEXT: %O.neg = fsub fast float %A.neg, %B<br>
; CHECK-NEXT: %P = fsub fast float %O.neg, %C<br>
; CHECK-NEXT: %Q = fadd fast float %P, %D<br>
; CHECK-NEXT: ret float %Q<br>
<br>
Modified: llvm/trunk/test/Transforms/<u></u>Reassociate/fast-basictest.ll<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/Reassociate/fast-basictest.ll?rev=222142&r1=222141&r2=222142&view=diff" target="_blank" class="cremed">http://llvm.org/viewvc/llvm-<u></u>project/llvm/trunk/test/<u></u>Transforms/Reassociate/fast-<u></u>basictest.ll?rev=222142&r1=<u></u>222141&r2=222142&view=diff</a><br>
==============================<u></u>==============================<u></u>==================<br>
--- llvm/trunk/test/Transforms/<u></u>Reassociate/fast-basictest.ll (original)<br>
+++ llvm/trunk/test/Transforms/<u></u>Reassociate/fast-basictest.ll Mon Nov 17 10:33:50 2014<br>
@@ -26,7 +26,7 @@ define float @test2(float %reg109, float<br>
<br>
define float @test3(float %reg109, float %reg1111) {<br>
; CHECK-LABEL: @test3<br>
-; CHECK-NEXT: %reg117 = fadd fast float %reg109, %reg1111<br>
+; CHECK-NEXT: %reg117 = fadd fast float %reg1111, %reg109<br>
; CHECK-NEXT: ret float %reg117<br>
<br>
%reg115 = fadd fast float %reg109, -3.000000e+01<br>
@@ -106,7 +106,7 @@ define void @test6() {<br>
<br>
define float @test7(float %A, float %B, float %C) {<br>
; CHECK-LABEL: @test7<br>
-; CHECK-NEXT: fadd fast float %C, %B<br>
+; CHECK-NEXT: fadd fast float %B, %C<br>
; CHECK-NEXT: fmul fast float %A, %A<br>
; CHECK-NEXT: fmul fast float %1, %tmp2<br>
; CHECK-NEXT: ret float<br>
@@ -121,7 +121,7 @@ define float @test7(float %A, float %B,<br>
<br>
define float @test8(float %X, float %Y, float %Z) {<br>
; CHECK-LABEL: @test8<br>
-; CHECK-NEXT: fmul fast float %Y, %X<br>
+; CHECK-NEXT: fmul fast float %X, %Y<br>
; CHECK-NEXT: fsub fast float %Z<br>
; CHECK-NEXT: ret float<br>
<br>
@@ -269,8 +269,8 @@ define float @test19(float %A, float %B)<br>
; With sub reassociation, constant folding can eliminate the uses of %a.<br>
define float @test20(float %a, float %b, float %c) nounwind {<br>
; CHECK-LABEL: @test20<br>
-; CHECK-NEXT: fsub fast float -0.000000e+00, %b<br>
-; CHECK-NEXT: fsub fast float %b.neg, %c<br>
+; CHECK-NEXT: fsub fast float -0.000000e+00, %c<br>
+; CHECK-NEXT: fsub fast float %c.neg, %b<br>
; CHECK-NEXT: ret float<br>
<br>
; FIXME: Should be able to generate the below, which may expose more<br>
<br>
Modified: llvm/trunk/test/Transforms/<u></u>Reassociate/fast-fp-commute.ll<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/Reassociate/fast-fp-commute.ll?rev=222142&r1=222141&r2=222142&view=diff" target="_blank" class="cremed">http://llvm.org/viewvc/llvm-<u></u>project/llvm/trunk/test/<u></u>Transforms/Reassociate/fast-<u></u>fp-commute.ll?rev=222142&r1=<u></u>222141&r2=222142&view=diff</a><br>
==============================<u></u>==============================<u></u>==================<br>
--- llvm/trunk/test/Transforms/<u></u>Reassociate/fast-fp-commute.ll (original)<br>
+++ llvm/trunk/test/Transforms/<u></u>Reassociate/fast-fp-commute.ll Mon Nov 17 10:33:50 2014<br>
@@ -4,8 +4,8 @@ declare void @use(float)<br>
<br>
define void @test1(float %x, float %y) {<br>
; CHECK-LABEL: test1<br>
-; CHECK: fmul fast float %y, %x<br>
-; CHECK: fmul fast float %y, %x<br>
+; CHECK: fmul fast float %x, %y<br>
+; CHECK: fmul fast float %x, %y<br>
; CHECK: fsub fast float %1, %2<br>
; CHECK: call void @use(float %{{.*}})<br>
; CHECK: call void @use(float %{{.*}})<br>
@@ -20,8 +20,8 @@ define void @test1(float %x, float %y) {<br>
<br>
define float @test2(float %x, float %y) {<br>
; CHECK-LABEL: test2<br>
-; CHECK-NEXT: fmul fast float %y, %x<br>
-; CHECK-NEXT: fmul fast float %y, %x<br>
+; CHECK-NEXT: fmul fast float %x, %y<br>
+; CHECK-NEXT: fmul fast float %x, %y<br>
; CHECK-NEXT: fsub fast float %1, %2<br>
; CHECK-NEXT: ret float %3<br>
<br>
@@ -33,8 +33,8 @@ define float @test2(float %x, float %y)<br>
<br>
define float @test3(float %x, float %y) {<br>
; CHECK-LABEL: test3<br>
-; CHECK-NEXT: %factor = fmul fast float %y, 2.000000e+00<br>
-; CHECK-NEXT: %tmp1 = fmul fast float %factor, %x<br>
+; CHECK-NEXT: %factor = fmul fast float %x, 2.000000e+00<br>
+; CHECK-NEXT: %tmp1 = fmul fast float %factor, %y<br>
; CHECK-NEXT: ret float %tmp1<br>
<br>
%1 = fmul fast float %x, %y<br>
<br>
Modified: llvm/trunk/test/Transforms/<u></u>Reassociate/fast-multistep.ll<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/Reassociate/fast-multistep.ll?rev=222142&r1=222141&r2=222142&view=diff" target="_blank" class="cremed">http://llvm.org/viewvc/llvm-<u></u>project/llvm/trunk/test/<u></u>Transforms/Reassociate/fast-<u></u>multistep.ll?rev=222142&r1=<u></u>222141&r2=222142&view=diff</a><br>
==============================<u></u>==============================<u></u>==================<br>
--- llvm/trunk/test/Transforms/<u></u>Reassociate/fast-multistep.ll (original)<br>
+++ llvm/trunk/test/Transforms/<u></u>Reassociate/fast-multistep.ll Mon Nov 17 10:33:50 2014<br>
@@ -3,9 +3,9 @@<br>
define float @fmultistep1(float %a, float %b, float %c) {<br>
; Check that a*a*b+a*a*c is turned into a*(a*(b+c)).<br>
; CHECK-LABEL: @fmultistep1<br>
-; CHECK-NEXT: fadd fast float %c, %b<br>
+; CHECK-NEXT: fadd fast float %b, %c<br>
; CHECK-NEXT: fmul fast float %a, %tmp2<br>
-; CHECK-NEXT: fmul fast float %tmp3, %a<br>
+; CHECK-NEXT: fmul fast float %a, %tmp3<br>
; CHECK-NEXT: ret float<br>
<br>
%t0 = fmul fast float %a, %b<br>
@@ -19,9 +19,9 @@ define float @fmultistep1(float %a, floa<br>
define float @fmultistep2(float %a, float %b, float %c, float %d) {<br>
; Check that a*b+a*c+d is turned into a*(b+c)+d.<br>
; CHECK-LABEL: @fmultistep2<br>
-; CHECK-NEXT: fadd fast float %c, %b<br>
-; CHECK-NEXT: fmul fast float %tmp, %a<br>
-; CHECK-NEXT: fadd fast float %tmp1, %d<br>
+; CHECK-NEXT: fadd fast float %b, %c<br>
+; CHECK-NEXT: fmul fast float %a, %tmp<br>
+; CHECK-NEXT: fadd fast float %d, %tmp1<br>
; CHECK-NEXT: ret float<br>
<br>
%t0 = fmul fast float %a, %b<br>
<br>
Modified: llvm/trunk/test/Transforms/<u></u>Reassociate/mixed-fast-<u></u>nonfast-fp.ll<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/Reassociate/mixed-fast-nonfast-fp.ll?rev=222142&r1=222141&r2=222142&view=diff" target="_blank" class="cremed">http://llvm.org/viewvc/llvm-<u></u>project/llvm/trunk/test/<u></u>Transforms/Reassociate/mixed-<u></u>fast-nonfast-fp.ll?rev=222142&<u></u>r1=222141&r2=222142&view=diff</a><br>
==============================<u></u>==============================<u></u>==================<br>
--- llvm/trunk/test/Transforms/<u></u>Reassociate/mixed-fast-<u></u>nonfast-fp.ll (original)<br>
+++ llvm/trunk/test/Transforms/<u></u>Reassociate/mixed-fast-<u></u>nonfast-fp.ll Mon Nov 17 10:33:50 2014<br>
@@ -3,9 +3,9 @@<br>
define float @foo(float %a,float %b, float %c) {<br>
; CHECK: %mul3 = fmul float %a, %b<br>
; CHECK-NEXT: fmul fast float %c, 2.000000e+00<br>
-; CHECK-NEXT: fadd fast float %factor, %b<br>
-; CHECK-NEXT: fmul fast float %tmp1, %a<br>
-; CHECK-NEXT: fadd fast float %tmp2, %mul3<br>
+; CHECK-NEXT: fadd fast float %b, %factor<br>
+; CHECK-NEXT: fmul fast float %a, %tmp1<br>
+; CHECK-NEXT: fadd fast float %mul3, %tmp2<br>
; CHECK-NEXT: ret float<br>
%mul1 = fmul fast float %a, %c<br>
%mul2 = fmul fast float %a, %b<br>
<br>
Modified: llvm/trunk/test/Transforms/<u></u>Reassociate/multistep.ll<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/Reassociate/multistep.ll?rev=222142&r1=222141&r2=222142&view=diff" target="_blank" class="cremed">http://llvm.org/viewvc/llvm-<u></u>project/llvm/trunk/test/<u></u>Transforms/Reassociate/<u></u>multistep.ll?rev=222142&r1=<u></u>222141&r2=222142&view=diff</a><br>
==============================<u></u>==============================<u></u>==================<br>
--- llvm/trunk/test/Transforms/<u></u>Reassociate/multistep.ll (original)<br>
+++ llvm/trunk/test/Transforms/<u></u>Reassociate/multistep.ll Mon Nov 17 10:33:50 2014<br>
@@ -8,9 +8,9 @@ define i64 @multistep1(i64 %a, i64 %b, i<br>
%t2 = mul i64 %a, %c<br>
%t3 = mul i64 %a, %t2 ; a*(a*c)<br>
%t4 = add i64 %t1, %t3<br>
-; CHECK-NEXT: add i64 %c, %b<br>
+; CHECK-NEXT: add i64 %b, %c<br>
+; CHECK-NEXT: mul i64 %a, %tmp{{.*}}<br>
; CHECK-NEXT: mul i64 %a, %tmp{{.*}}<br>
-; CHECK-NEXT: mul i64 %tmp{{.*}}, %a<br>
; CHECK-NEXT: ret<br>
ret i64 %t4<br>
}<br>
@@ -22,9 +22,9 @@ define i64 @multistep2(i64 %a, i64 %b, i<br>
%t1 = mul i64 %a, %c<br>
%t2 = add i64 %t1, %d ; a*c+d<br>
%t3 = add i64 %t0, %t2 ; a*b+(a*c+d)<br>
-; CHECK-NEXT: add i64 %c, %b<br>
-; CHECK-NEXT: mul i64 %tmp{{.*}}, %a<br>
-; CHECK-NEXT: add i64 %tmp{{.*}}, %d<br>
+; CHECK-NEXT: add i64 %b, %c<br>
+; CHECK-NEXT: mul i64 %a, %tmp{{.*}}<br>
+; CHECK-NEXT: add i64 %d, %tmp{{.*}}<br>
; CHECK-NEXT: ret<br>
ret i64 %t3<br>
}<br>
<br>
Modified: llvm/trunk/test/Transforms/<u></u>Reassociate/no-op.ll<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/Reassociate/no-op.ll?rev=222142&r1=222141&r2=222142&view=diff" target="_blank" class="cremed">http://llvm.org/viewvc/llvm-<u></u>project/llvm/trunk/test/<u></u>Transforms/Reassociate/no-op.<u></u>ll?rev=222142&r1=222141&r2=<u></u>222142&view=diff</a><br>
==============================<u></u>==============================<u></u>==================<br>
--- llvm/trunk/test/Transforms/<u></u>Reassociate/no-op.ll (original)<br>
+++ llvm/trunk/test/Transforms/<u></u>Reassociate/no-op.ll Mon Nov 17 10:33:50 2014<br>
@@ -27,11 +27,11 @@ define void @test2(i32 %a, i32 %b, i32 %<br>
; The initial add doesn't change so should not lose the nsw flag.<br>
; CHECK-LABEL: @test2(<br>
%a0 = add nsw i32 %b, %a<br>
-; CHECK-NEXT: %a0 = add nsw i32 %b, %a<br>
+; CHECK-NEXT: %a0 = add nsw i32 %a, %b<br>
%a1 = add nsw i32 %a0, %d<br>
; CHECK-NEXT: %a1 = add i32 %a0, %c<br>
%a2 = add nsw i32 %a1, %c<br>
-; CHECK-NEXT: %a2 = add i32 %a1, %d<br>
+; CHECK-NEXT: %a2 = add i32 %d, %a1<br>
call void @use(i32 %a2)<br>
; CHECK-NEXT: call void @use<br>
ret void<br>
<br>
Modified: llvm/trunk/test/Transforms/<u></u>Reassociate/optional-flags.ll<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/Reassociate/optional-flags.ll?rev=222142&r1=222141&r2=222142&view=diff" target="_blank" class="cremed">http://llvm.org/viewvc/llvm-<u></u>project/llvm/trunk/test/<u></u>Transforms/Reassociate/<u></u>optional-flags.ll?rev=222142&<u></u>r1=222141&r2=222142&view=diff</a><br>
==============================<u></u>==============================<u></u>==================<br>
--- llvm/trunk/test/Transforms/<u></u>Reassociate/optional-flags.ll (original)<br>
+++ llvm/trunk/test/Transforms/<u></u>Reassociate/optional-flags.ll Mon Nov 17 10:33:50 2014<br>
@@ -4,8 +4,8 @@<br>
; Reassociate should clear optional flags like nsw when reassociating.<br>
<br>
; CHECK-LABEL: @test0(<br>
-; CHECK: %y = add i64 %b, %a<br>
-; CHECK: %z = add i64 %y, %c<br>
+; CHECK: %y = add i64 %a, %b<br>
+; CHECK: %z = add i64 %c, %y<br>
define i64 @test0(i64 %a, i64 %b, i64 %c) {<br>
%y = add nsw i64 %c, %b<br>
%z = add i64 %y, %a<br>
@@ -13,8 +13,8 @@ define i64 @test0(i64 %a, i64 %b, i64 %c<br>
}<br>
<br>
; CHECK-LABEL: @test1(<br>
-; CHECK: %y = add i64 %b, %a<br>
-; CHECK: %z = add i64 %y, %c<br>
+; CHECK: %y = add i64 %a, %b<br>
+; CHECK: %z = add i64 %c, %y<br>
define i64 @test1(i64 %a, i64 %b, i64 %c) {<br>
%y = add i64 %c, %b<br>
%z = add nsw i64 %y, %a<br>
@@ -22,7 +22,7 @@ define i64 @test1(i64 %a, i64 %b, i64 %c<br>
}<br>
<br>
; PR9215<br>
-; CHECK: %s = add nsw i32 %y, %x<br>
+; CHECK: %s = add nsw i32 %x, %y<br>
define i32 @test2(i32 %x, i32 %y) {<br>
%s = add nsw i32 %x, %y<br>
ret i32 %s<br>
<br>
Modified: llvm/trunk/test/Transforms/<u></u>Reassociate/shift-factor.ll<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/Reassociate/shift-factor.ll?rev=222142&r1=222141&r2=222142&view=diff" target="_blank" class="cremed">http://llvm.org/viewvc/llvm-<u></u>project/llvm/trunk/test/<u></u>Transforms/Reassociate/shift-<u></u>factor.ll?rev=222142&r1=<u></u>222141&r2=222142&view=diff</a><br>
==============================<u></u>==============================<u></u>==================<br>
--- llvm/trunk/test/Transforms/<u></u>Reassociate/shift-factor.ll (original)<br>
+++ llvm/trunk/test/Transforms/<u></u>Reassociate/shift-factor.ll Mon Nov 17 10:33:50 2014<br>
@@ -3,7 +3,7 @@<br>
<br>
define i32 @test1(i32 %X, i32 %Y) {<br>
; CHECK-LABEL: test1<br>
-; CHECK-NEXT: %tmp = add i32 %Y, %X<br>
+; CHECK-NEXT: %tmp = add i32 %X, %Y<br>
; CHECK-NEXT: %tmp1 = shl i32 %tmp, 1<br>
; CHECK-NEXT: ret i32 %tmp1<br>
<br>
<br>
Modified: llvm/trunk/test/Transforms/<u></u>Reassociate/subtest.ll<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/Reassociate/subtest.ll?rev=222142&r1=222141&r2=222142&view=diff" target="_blank" class="cremed">http://llvm.org/viewvc/llvm-<u></u>project/llvm/trunk/test/<u></u>Transforms/Reassociate/<u></u>subtest.ll?rev=222142&r1=<u></u>222141&r2=222142&view=diff</a><br>
==============================<u></u>==============================<u></u>==================<br>
--- llvm/trunk/test/Transforms/<u></u>Reassociate/subtest.ll (original)<br>
+++ llvm/trunk/test/Transforms/<u></u>Reassociate/subtest.ll Mon Nov 17 10:33:50 2014<br>
@@ -15,7 +15,7 @@ define i32 @test1(i32 %A, i32 %B) {<br>
; With sub reassociation, constant folding can eliminate the uses of %a.<br>
define i32 @test2(i32 %a, i32 %b, i32 %c) nounwind {<br>
; CHECK-LABEL: @test2<br>
-; CHECK-NEXT: %sum = add i32 %c, %b<br>
+; CHECK-NEXT: %sum = add i32 %b, %c<br>
; CHECK-NEXT: %tmp7 = sub i32 0, %sum<br>
; CHECK-NEXT: ret i32 %tmp7<br>
<br>
<br>
Modified: llvm/trunk/test/Transforms/<u></u>Reassociate/xor_reassoc.ll<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/Reassociate/xor_reassoc.ll?rev=222142&r1=222141&r2=222142&view=diff" target="_blank" class="cremed">http://llvm.org/viewvc/llvm-<u></u>project/llvm/trunk/test/<u></u>Transforms/Reassociate/xor_<u></u>reassoc.ll?rev=222142&r1=<u></u>222141&r2=222142&view=diff</a><br>
==============================<u></u>==============================<u></u>==================<br>
--- llvm/trunk/test/Transforms/<u></u>Reassociate/xor_reassoc.ll (original)<br>
+++ llvm/trunk/test/Transforms/<u></u>Reassociate/xor_reassoc.ll Mon Nov 17 10:33:50 2014<br>
@@ -45,7 +45,7 @@ define i32 @xor3(i32 %x, i32 %y) {<br>
;CHECK-LABEL: @xor3(<br>
;CHECK: %and.ra = and i32 %x, -436<br>
;CHECK: %xor = xor i32 %y, 123<br>
-;CHECK: %xor1 = xor i32 %xor, %and.ra<br>
+;CHECK: %xor1 = xor i32 %and.ra, %xor<br>
}<br>
<br>
; Test rule: (x | c1) ^ c2 = (x & ~c1) ^ (c1 ^ c2)<br>
@@ -57,7 +57,7 @@ define i32 @xor4(i32 %x, i32 %y) {<br>
; CHECK-LABEL: @xor4(<br>
; CHECK: %and = and i32 %x, -124<br>
; CHECK: %xor = xor i32 %y, 435<br>
-; CHECK: %xor1 = xor i32 %xor, %and<br>
+; CHECK: %xor1 = xor i32 %and, %xor<br>
}<br>
<br>
; ==============================<u></u>==============================<u></u>==============<br>
@@ -89,7 +89,7 @@ define i32 @xor_special2(i32 %x, i32 %y)<br>
ret i32 %xor1<br>
; CHECK-LABEL: @xor_special2(<br>
; CHECK: %xor = xor i32 %y, 123<br>
-; CHECK: %xor1 = xor i32 %xor, %x<br>
+; CHECK: %xor1 = xor i32 %x, %xor<br>
; CHECK: ret i32 %xor1<br>
}<br>
<br>
<br>
<br>
______________________________<u></u>_________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu" target="_blank" class="cremed">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank" class="cremed">http://lists.cs.uiuc.edu/<u></u>mailman/listinfo/llvm-commits</a><br>
</blockquote></div></div>