[Reassociate] Canonicalize the operands of all binary operators.
[oota-llvm.git] / test / Transforms / Reassociate / commute.ll
1 ; RUN: opt -reassociate -S < %s | FileCheck %s
2
3 declare void @use(i32)
4
5 define void @test1(i32 %x, i32 %y) {
6 ; CHECK-LABEL: test1
7 ; CHECK: mul i32 %y, %x
8 ; CHECK: mul i32 %y, %x
9 ; CHECK: sub i32 %1, %2
10 ; CHECK: call void @use(i32 %{{.*}})
11 ; CHECK: call void @use(i32 %{{.*}})
12
13   %1 = mul i32 %x, %y
14   %2 = mul i32 %y, %x
15   %3 = sub i32 %1, %2
16   call void @use(i32 %1)
17   call void @use(i32 %3)
18   ret void
19 }