[llvm] r222142 - [Reassociate] As the expression tree is rewritten make sure the operands are

Chad Rosier mcrosier at codeaurora.org
Mon Nov 17 08:33:51 PST 2014


Author: mcrosier
Date: Mon Nov 17 10:33:50 2014
New Revision: 222142

URL: http://llvm.org/viewvc/llvm-project?rev=222142&view=rev
Log:
[Reassociate] As the expression tree is rewritten make sure the operands are
emitted in canonical form.

Modified:
    llvm/trunk/lib/Transforms/Scalar/Reassociate.cpp
    llvm/trunk/test/Transforms/Reassociate/2002-05-15-MissedTree.ll
    llvm/trunk/test/Transforms/Reassociate/2002-05-15-SubReassociate.ll
    llvm/trunk/test/Transforms/Reassociate/basictest.ll
    llvm/trunk/test/Transforms/Reassociate/canonicalize-neg-const.ll
    llvm/trunk/test/Transforms/Reassociate/commute.ll
    llvm/trunk/test/Transforms/Reassociate/fast-SubReassociate.ll
    llvm/trunk/test/Transforms/Reassociate/fast-basictest.ll
    llvm/trunk/test/Transforms/Reassociate/fast-fp-commute.ll
    llvm/trunk/test/Transforms/Reassociate/fast-multistep.ll
    llvm/trunk/test/Transforms/Reassociate/mixed-fast-nonfast-fp.ll
    llvm/trunk/test/Transforms/Reassociate/multistep.ll
    llvm/trunk/test/Transforms/Reassociate/no-op.ll
    llvm/trunk/test/Transforms/Reassociate/optional-flags.ll
    llvm/trunk/test/Transforms/Reassociate/shift-factor.ll
    llvm/trunk/test/Transforms/Reassociate/subtest.ll
    llvm/trunk/test/Transforms/Reassociate/xor_reassoc.ll

Modified: llvm/trunk/lib/Transforms/Scalar/Reassociate.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/Reassociate.cpp?rev=222142&r1=222141&r2=222142&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/Reassociate.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/Reassociate.cpp Mon Nov 17 10:33:50 2014
@@ -791,14 +791,11 @@ void Reassociate::RewriteExprTree(Binary
       Value *OldLHS = Op->getOperand(0);
       Value *OldRHS = Op->getOperand(1);
 
-      if (NewLHS == OldLHS && NewRHS == OldRHS)
-        // Nothing changed, leave it alone.
-        break;
-
-      if (NewLHS == OldRHS && NewRHS == OldLHS) {
-        // The order of the operands was reversed.  Swap them.
+      // The new operation differs trivially from the original.
+      if ((NewLHS == OldLHS && NewRHS == OldRHS) ||
+          (NewLHS == OldRHS && NewRHS == OldLHS)) {
         DEBUG(dbgs() << "RA: " << *Op << '\n');
-        Op->swapOperands();
+        canonicalizeOperands(Op);
         DEBUG(dbgs() << "TO: " << *Op << '\n');
         MadeChange = true;
         ++NumChanged;
@@ -820,6 +817,8 @@ void Reassociate::RewriteExprTree(Binary
           NodesToRewrite.push_back(BO);
         Op->setOperand(1, NewRHS);
       }
+      // Put the operands in canonical form.
+      canonicalizeOperands(Op);
       DEBUG(dbgs() << "TO: " << *Op << '\n');
 
       ExpressionChanged = Op;
@@ -856,6 +855,7 @@ void Reassociate::RewriteExprTree(Binary
     // into it.
     BinaryOperator *BO = isReassociableOp(Op->getOperand(0), Opcode);
     if (BO && !NotRewritable.count(BO)) {
+      canonicalizeOperands(Op);
       Op = BO;
       continue;
     }
@@ -880,6 +880,7 @@ void Reassociate::RewriteExprTree(Binary
 
     DEBUG(dbgs() << "RA: " << *Op << '\n');
     Op->setOperand(0, NewOp);
+    canonicalizeOperands(Op);
     DEBUG(dbgs() << "TO: " << *Op << '\n');
     ExpressionChanged = Op;
     MadeChange = true;

Modified: llvm/trunk/test/Transforms/Reassociate/2002-05-15-MissedTree.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/Reassociate/2002-05-15-MissedTree.ll?rev=222142&r1=222141&r2=222142&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/Reassociate/2002-05-15-MissedTree.ll (original)
+++ llvm/trunk/test/Transforms/Reassociate/2002-05-15-MissedTree.ll Mon Nov 17 10:33:50 2014
@@ -2,7 +2,7 @@
 
 define i32 @test1(i32 %A, i32 %B) {
 ; CHECK-LABEL: test1
-; CHECK: %Z = add i32 %B, %A
+; CHECK: %Z = add i32 %A, %B
 ; CHECK: ret i32 %Z
 	%W = add i32 %B, -5
 	%Y = add i32 %A, 5

Modified: llvm/trunk/test/Transforms/Reassociate/2002-05-15-SubReassociate.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/Reassociate/2002-05-15-SubReassociate.ll?rev=222142&r1=222141&r2=222142&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/Reassociate/2002-05-15-SubReassociate.ll (original)
+++ llvm/trunk/test/Transforms/Reassociate/2002-05-15-SubReassociate.ll Mon Nov 17 10:33:50 2014
@@ -16,7 +16,7 @@ define i32 @test1(i32 %A, i32 %B) {
 ; With sub reassociation, constant folding can eliminate the two 12 constants.
 define i32 @test2(i32 %A, i32 %B, i32 %C, i32 %D) {
 ; CHECK-LABEL: test2
-; CHECK-NEXT: %sum = add i32 %B, %A
+; CHECK-NEXT: %sum = add i32 %A, %B
 ; CHECK-NEXT: %sum1 = add i32 %sum, %C
 ; CHECK-NEXT: %Q = sub i32 %D, %sum1
 ; CHECK-NEXT: ret i32 %Q

Modified: llvm/trunk/test/Transforms/Reassociate/basictest.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/Reassociate/basictest.ll?rev=222142&r1=222141&r2=222142&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/Reassociate/basictest.ll (original)
+++ llvm/trunk/test/Transforms/Reassociate/basictest.ll Mon Nov 17 10:33:50 2014
@@ -17,7 +17,7 @@ define i32 @test2(i32 %reg109, i32 %reg1
   ret i32 %reg117
 
 ; CHECK-LABEL: @test2
-; CHECK-NEXT: %reg117 = add i32 %reg1111, %reg109
+; CHECK-NEXT: %reg117 = add i32 %reg109, %reg1111
 ; CHECK-NEXT: ret i32 %reg117
 }
 
@@ -121,7 +121,7 @@ define i32 @test7(i32 %A, i32 %B, i32 %C
   ret i32 %r
 
 ; CHECK-LABEL: @test7
-; CHECK-NEXT: add i32 %C, %B
+; CHECK-NEXT: add i32 %B, %C
 ; CHECK-NEXT: mul i32 
 ; CHECK-NEXT: mul i32 
 ; CHECK-NEXT: ret i32 
@@ -135,7 +135,7 @@ define i32 @test8(i32 %X, i32 %Y, i32 %Z
   ret i32 %C
 
 ; CHECK-LABEL: @test8
-; CHECK-NEXT: %A = mul i32 %Y, %X
+; CHECK-NEXT: %A = mul i32 %X, %Y
 ; CHECK-NEXT: %C = sub i32 %Z, %A
 ; CHECK-NEXT: ret i32 %C
 }

Modified: llvm/trunk/test/Transforms/Reassociate/canonicalize-neg-const.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/Reassociate/canonicalize-neg-const.ll?rev=222142&r1=222141&r2=222142&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/Reassociate/canonicalize-neg-const.ll (original)
+++ llvm/trunk/test/Transforms/Reassociate/canonicalize-neg-const.ll Mon Nov 17 10:33:50 2014
@@ -53,7 +53,7 @@ define double @test3(double %x, double %
 define i64 @test4(i64 %x, i64 %y) {
 ; CHECK-LABEL: @test4
 ; CHECK-NEXT: mul i64 %y, 1234
-; CHECK-NEXT: add i64 %mul, %x
+; CHECK-NEXT: add i64 %x, %mul
 ; CHECK-NEXT: ret i64 %sub
 
   %mul = mul i64 %y, -1234

Modified: llvm/trunk/test/Transforms/Reassociate/commute.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/Reassociate/commute.ll?rev=222142&r1=222141&r2=222142&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/Reassociate/commute.ll (original)
+++ llvm/trunk/test/Transforms/Reassociate/commute.ll Mon Nov 17 10:33:50 2014
@@ -4,8 +4,8 @@ declare void @use(i32)
 
 define void @test1(i32 %x, i32 %y) {
 ; CHECK-LABEL: test1
-; CHECK: mul i32 %y, %x
-; CHECK: mul i32 %y, %x
+; CHECK: mul i32 %x, %y
+; CHECK: mul i32 %x, %y
 ; CHECK: sub i32 %1, %2
 ; CHECK: call void @use(i32 %{{.*}})
 ; CHECK: call void @use(i32 %{{.*}})

Modified: llvm/trunk/test/Transforms/Reassociate/fast-SubReassociate.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/Reassociate/fast-SubReassociate.ll?rev=222142&r1=222141&r2=222142&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/Reassociate/fast-SubReassociate.ll (original)
+++ llvm/trunk/test/Transforms/Reassociate/fast-SubReassociate.ll Mon Nov 17 10:33:50 2014
@@ -49,8 +49,8 @@ define float @test3(float %A, float %B,
 ; With sub reassociation, constant folding can eliminate the two 12 constants.
 define float @test4(float %A, float %B, float %C, float %D) {
 ; CHECK-LABEL: test4
-; CHECK-NEXT: %B.neg = fsub fast float -0.000000e+00, %B
-; CHECK-NEXT: %O.neg = fsub fast float %B.neg, %A
+; CHECK-NEXT: %A.neg = fsub fast float -0.000000e+00, %A
+; CHECK-NEXT: %O.neg = fsub fast float %A.neg, %B
 ; CHECK-NEXT: %P = fsub fast float %O.neg, %C
 ; CHECK-NEXT: %Q = fadd fast float %P, %D
 ; CHECK-NEXT: ret float %Q

Modified: llvm/trunk/test/Transforms/Reassociate/fast-basictest.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/Reassociate/fast-basictest.ll?rev=222142&r1=222141&r2=222142&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/Reassociate/fast-basictest.ll (original)
+++ llvm/trunk/test/Transforms/Reassociate/fast-basictest.ll Mon Nov 17 10:33:50 2014
@@ -26,7 +26,7 @@ define float @test2(float %reg109, float
 
 define float @test3(float %reg109, float %reg1111) {
 ; CHECK-LABEL: @test3
-; CHECK-NEXT: %reg117 = fadd fast float %reg109, %reg1111
+; CHECK-NEXT: %reg117 = fadd fast float %reg1111, %reg109
 ; CHECK-NEXT:  ret float %reg117
 
   %reg115 = fadd fast float %reg109, -3.000000e+01
@@ -106,7 +106,7 @@ define void @test6() {
 
 define float @test7(float %A, float %B, float %C) {
 ; CHECK-LABEL: @test7
-; CHECK-NEXT: fadd fast float %C, %B
+; CHECK-NEXT: fadd fast float %B, %C
 ; CHECK-NEXT: fmul fast float %A, %A
 ; CHECK-NEXT: fmul fast float %1, %tmp2
 ; CHECK-NEXT: ret float
@@ -121,7 +121,7 @@ define float @test7(float %A, float %B,
 
 define float @test8(float %X, float %Y, float %Z) {
 ; CHECK-LABEL: @test8
-; CHECK-NEXT: fmul fast float %Y, %X
+; CHECK-NEXT: fmul fast float %X, %Y
 ; CHECK-NEXT: fsub fast float %Z
 ; CHECK-NEXT: ret float
 
@@ -269,8 +269,8 @@ define float @test19(float %A, float %B)
 ; With sub reassociation, constant folding can eliminate the uses of %a.
 define float @test20(float %a, float %b, float %c) nounwind  {
 ; CHECK-LABEL: @test20
-; CHECK-NEXT: fsub fast float -0.000000e+00, %b
-; CHECK-NEXT: fsub fast float %b.neg, %c
+; CHECK-NEXT: fsub fast float -0.000000e+00, %c
+; CHECK-NEXT: fsub fast float %c.neg, %b
 ; CHECK-NEXT: ret float
 
 ; FIXME: Should be able to generate the below, which may expose more

Modified: llvm/trunk/test/Transforms/Reassociate/fast-fp-commute.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/Reassociate/fast-fp-commute.ll?rev=222142&r1=222141&r2=222142&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/Reassociate/fast-fp-commute.ll (original)
+++ llvm/trunk/test/Transforms/Reassociate/fast-fp-commute.ll Mon Nov 17 10:33:50 2014
@@ -4,8 +4,8 @@ declare void @use(float)
 
 define void @test1(float %x, float %y) {
 ; CHECK-LABEL: test1
-; CHECK: fmul fast float %y, %x
-; CHECK: fmul fast float %y, %x
+; CHECK: fmul fast float %x, %y
+; CHECK: fmul fast float %x, %y
 ; CHECK: fsub fast float %1, %2
 ; CHECK: call void @use(float %{{.*}})
 ; CHECK: call void @use(float %{{.*}})
@@ -20,8 +20,8 @@ define void @test1(float %x, float %y) {
 
 define float @test2(float %x, float %y) {
 ; CHECK-LABEL: test2
-; CHECK-NEXT: fmul fast float %y, %x
-; CHECK-NEXT: fmul fast float %y, %x
+; CHECK-NEXT: fmul fast float %x, %y
+; CHECK-NEXT: fmul fast float %x, %y
 ; CHECK-NEXT: fsub fast float %1, %2
 ; CHECK-NEXT: ret float %3
 
@@ -33,8 +33,8 @@ define float @test2(float %x, float %y)
 
 define float @test3(float %x, float %y) {
 ; CHECK-LABEL: test3
-; CHECK-NEXT: %factor = fmul fast float %y, 2.000000e+00
-; CHECK-NEXT: %tmp1 = fmul fast float %factor, %x
+; CHECK-NEXT: %factor = fmul fast float %x, 2.000000e+00
+; CHECK-NEXT: %tmp1 = fmul fast float %factor, %y
 ; CHECK-NEXT: ret float %tmp1
 
   %1 = fmul fast float %x, %y

Modified: llvm/trunk/test/Transforms/Reassociate/fast-multistep.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/Reassociate/fast-multistep.ll?rev=222142&r1=222141&r2=222142&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/Reassociate/fast-multistep.ll (original)
+++ llvm/trunk/test/Transforms/Reassociate/fast-multistep.ll Mon Nov 17 10:33:50 2014
@@ -3,9 +3,9 @@
 define float @fmultistep1(float %a, float %b, float %c) {
 ; Check that a*a*b+a*a*c is turned into a*(a*(b+c)).
 ; CHECK-LABEL: @fmultistep1
-; CHECK-NEXT: fadd fast float %c, %b
+; CHECK-NEXT: fadd fast float %b, %c
 ; CHECK-NEXT: fmul fast float %a, %tmp2
-; CHECK-NEXT: fmul fast float %tmp3, %a
+; CHECK-NEXT: fmul fast float %a, %tmp3
 ; CHECK-NEXT: ret float
 
   %t0 = fmul fast float %a, %b
@@ -19,9 +19,9 @@ define float @fmultistep1(float %a, floa
 define float @fmultistep2(float %a, float %b, float %c, float %d) {
 ; Check that a*b+a*c+d is turned into a*(b+c)+d.
 ; CHECK-LABEL: @fmultistep2
-; CHECK-NEXT: fadd fast float %c, %b
-; CHECK-NEXT: fmul fast float %tmp, %a
-; CHECK-NEXT: fadd fast float %tmp1, %d
+; CHECK-NEXT: fadd fast float %b, %c
+; CHECK-NEXT: fmul fast float %a, %tmp
+; CHECK-NEXT: fadd fast float %d, %tmp1
 ; CHECK-NEXT: ret float
 
   %t0 = fmul fast float %a, %b

Modified: llvm/trunk/test/Transforms/Reassociate/mixed-fast-nonfast-fp.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/Reassociate/mixed-fast-nonfast-fp.ll?rev=222142&r1=222141&r2=222142&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/Reassociate/mixed-fast-nonfast-fp.ll (original)
+++ llvm/trunk/test/Transforms/Reassociate/mixed-fast-nonfast-fp.ll Mon Nov 17 10:33:50 2014
@@ -3,9 +3,9 @@
 define float @foo(float %a,float %b, float %c) {
 ; CHECK: %mul3 = fmul float %a, %b
 ; CHECK-NEXT: fmul fast float %c, 2.000000e+00
-; CHECK-NEXT: fadd fast float %factor, %b
-; CHECK-NEXT: fmul fast float %tmp1, %a
-; CHECK-NEXT: fadd fast float %tmp2, %mul3
+; CHECK-NEXT: fadd fast float %b, %factor
+; CHECK-NEXT: fmul fast float %a, %tmp1
+; CHECK-NEXT: fadd fast float %mul3, %tmp2
 ; CHECK-NEXT: ret float
   %mul1 = fmul fast float %a, %c
   %mul2 = fmul fast float %a, %b

Modified: llvm/trunk/test/Transforms/Reassociate/multistep.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/Reassociate/multistep.ll?rev=222142&r1=222141&r2=222142&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/Reassociate/multistep.ll (original)
+++ llvm/trunk/test/Transforms/Reassociate/multistep.ll Mon Nov 17 10:33:50 2014
@@ -8,9 +8,9 @@ define i64 @multistep1(i64 %a, i64 %b, i
   %t2 = mul i64 %a, %c
   %t3 = mul i64 %a, %t2 ; a*(a*c)
   %t4 = add i64 %t1, %t3
-; CHECK-NEXT: add i64 %c, %b
+; CHECK-NEXT: add i64 %b, %c
+; CHECK-NEXT: mul i64 %a, %tmp{{.*}}
 ; CHECK-NEXT: mul i64 %a, %tmp{{.*}}
-; CHECK-NEXT: mul i64 %tmp{{.*}}, %a
 ; CHECK-NEXT: ret
   ret i64 %t4
 }
@@ -22,9 +22,9 @@ define i64 @multistep2(i64 %a, i64 %b, i
   %t1 = mul i64 %a, %c
   %t2 = add i64 %t1, %d ; a*c+d
   %t3 = add i64 %t0, %t2 ; a*b+(a*c+d)
-; CHECK-NEXT: add i64 %c, %b
-; CHECK-NEXT: mul i64 %tmp{{.*}}, %a
-; CHECK-NEXT: add i64 %tmp{{.*}}, %d
+; CHECK-NEXT: add i64 %b, %c
+; CHECK-NEXT: mul i64 %a, %tmp{{.*}}
+; CHECK-NEXT: add i64 %d, %tmp{{.*}}
 ; CHECK-NEXT: ret
   ret i64 %t3
 }

Modified: llvm/trunk/test/Transforms/Reassociate/no-op.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/Reassociate/no-op.ll?rev=222142&r1=222141&r2=222142&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/Reassociate/no-op.ll (original)
+++ llvm/trunk/test/Transforms/Reassociate/no-op.ll Mon Nov 17 10:33:50 2014
@@ -27,11 +27,11 @@ define void @test2(i32 %a, i32 %b, i32 %
 ; The initial add doesn't change so should not lose the nsw flag.
 ; CHECK-LABEL: @test2(
   %a0 = add nsw i32 %b, %a
-; CHECK-NEXT: %a0 = add nsw i32 %b, %a
+; CHECK-NEXT: %a0 = add nsw i32 %a, %b
   %a1 = add nsw i32 %a0, %d
 ; CHECK-NEXT: %a1 = add i32 %a0, %c
   %a2 = add nsw i32 %a1, %c
-; CHECK-NEXT: %a2 = add i32 %a1, %d
+; CHECK-NEXT: %a2 = add i32 %d, %a1
   call void @use(i32 %a2)
 ; CHECK-NEXT: call void @use
   ret void

Modified: llvm/trunk/test/Transforms/Reassociate/optional-flags.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/Reassociate/optional-flags.ll?rev=222142&r1=222141&r2=222142&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/Reassociate/optional-flags.ll (original)
+++ llvm/trunk/test/Transforms/Reassociate/optional-flags.ll Mon Nov 17 10:33:50 2014
@@ -4,8 +4,8 @@
 ; Reassociate should clear optional flags like nsw when reassociating.
 
 ; CHECK-LABEL: @test0(
-; CHECK: %y = add i64 %b, %a
-; CHECK: %z = add i64 %y, %c
+; CHECK: %y = add i64 %a, %b
+; CHECK: %z = add i64 %c, %y
 define i64 @test0(i64 %a, i64 %b, i64 %c) {
   %y = add nsw i64 %c, %b
   %z = add i64 %y, %a
@@ -13,8 +13,8 @@ define i64 @test0(i64 %a, i64 %b, i64 %c
 }
 
 ; CHECK-LABEL: @test1(
-; CHECK: %y = add i64 %b, %a
-; CHECK: %z = add i64 %y, %c
+; CHECK: %y = add i64 %a, %b
+; CHECK: %z = add i64 %c, %y
 define i64 @test1(i64 %a, i64 %b, i64 %c) {
   %y = add i64 %c, %b
   %z = add nsw i64 %y, %a
@@ -22,7 +22,7 @@ define i64 @test1(i64 %a, i64 %b, i64 %c
 }
 
 ; PR9215
-; CHECK: %s = add nsw i32 %y, %x
+; CHECK: %s = add nsw i32 %x, %y
 define i32 @test2(i32 %x, i32 %y) {
   %s = add nsw i32 %x, %y
   ret i32 %s

Modified: llvm/trunk/test/Transforms/Reassociate/shift-factor.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/Reassociate/shift-factor.ll?rev=222142&r1=222141&r2=222142&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/Reassociate/shift-factor.ll (original)
+++ llvm/trunk/test/Transforms/Reassociate/shift-factor.ll Mon Nov 17 10:33:50 2014
@@ -3,7 +3,7 @@
 
 define i32 @test1(i32 %X, i32 %Y) {
 ; CHECK-LABEL: test1
-; CHECK-NEXT: %tmp = add i32 %Y, %X
+; CHECK-NEXT: %tmp = add i32 %X, %Y
 ; CHECK-NEXT: %tmp1 = shl i32 %tmp, 1
 ; CHECK-NEXT: ret i32 %tmp1
 

Modified: llvm/trunk/test/Transforms/Reassociate/subtest.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/Reassociate/subtest.ll?rev=222142&r1=222141&r2=222142&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/Reassociate/subtest.ll (original)
+++ llvm/trunk/test/Transforms/Reassociate/subtest.ll Mon Nov 17 10:33:50 2014
@@ -15,7 +15,7 @@ define i32 @test1(i32 %A, i32 %B) {
 ; With sub reassociation, constant folding can eliminate the uses of %a.
 define i32 @test2(i32 %a, i32 %b, i32 %c) nounwind  {
 ; CHECK-LABEL: @test2
-; CHECK-NEXT: %sum = add i32 %c, %b
+; CHECK-NEXT: %sum = add i32 %b, %c
 ; CHECK-NEXT: %tmp7 = sub i32 0, %sum
 ; CHECK-NEXT: ret i32 %tmp7
 

Modified: llvm/trunk/test/Transforms/Reassociate/xor_reassoc.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/Reassociate/xor_reassoc.ll?rev=222142&r1=222141&r2=222142&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/Reassociate/xor_reassoc.ll (original)
+++ llvm/trunk/test/Transforms/Reassociate/xor_reassoc.ll Mon Nov 17 10:33:50 2014
@@ -45,7 +45,7 @@ define i32 @xor3(i32 %x, i32 %y) {
 ;CHECK-LABEL: @xor3(
 ;CHECK: %and.ra = and i32 %x, -436
 ;CHECK: %xor = xor i32 %y, 123
-;CHECK: %xor1 = xor i32 %xor, %and.ra
+;CHECK: %xor1 = xor i32 %and.ra, %xor
 }
 
 ; Test rule: (x | c1) ^ c2 = (x & ~c1) ^ (c1 ^ c2)
@@ -57,7 +57,7 @@ define i32 @xor4(i32 %x, i32 %y) {
 ; CHECK-LABEL: @xor4(
 ; CHECK: %and = and i32 %x, -124
 ; CHECK: %xor = xor i32 %y, 435
-; CHECK: %xor1 = xor i32 %xor, %and
+; CHECK: %xor1 = xor i32 %and, %xor
 }
 
 ; ==========================================================================
@@ -89,7 +89,7 @@ define i32 @xor_special2(i32 %x, i32 %y)
   ret i32 %xor1
 ; CHECK-LABEL: @xor_special2(
 ; CHECK: %xor = xor i32 %y, 123
-; CHECK: %xor1 = xor i32 %xor, %x
+; CHECK: %xor1 = xor i32 %x, %xor
 ; CHECK: ret i32 %xor1
 }
 





More information about the llvm-commits mailing list