]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/Transforms/GVN/commute.ll
Vendor import of llvm release_34 branch r197841 (effectively, 3.4 RC3):
[FreeBSD/FreeBSD.git] / test / Transforms / GVN / commute.ll
1 ; RUN: opt -gvn -S < %s | FileCheck %s
2
3 declare void @use(i32, i32)
4
5 define void @foo(i32 %x, i32 %y) {
6   ; CHECK-LABEL: @foo(
7   %add1 = add i32 %x, %y
8   %add2 = add i32 %y, %x
9   call void @use(i32 %add1, i32 %add2)
10   ; CHECK: @use(i32 %add1, i32 %add1)
11   ret void
12 }
13
14 declare void @vse(i1, i1)
15
16 define void @bar(i32 %x, i32 %y) {
17   ; CHECK-LABEL: @bar(
18   %cmp1 = icmp ult i32 %x, %y
19   %cmp2 = icmp ugt i32 %y, %x
20   call void @vse(i1 %cmp1, i1 %cmp2)
21   ; CHECK: @vse(i1 %cmp1, i1 %cmp1)
22   ret void
23 }