SHOW:
|
|
- or go back to the newest paste.
1 | define i32 @test1(i32 %x, i32 %y) nounwind uwtable readnone ssp { | |
2 | entry: | |
3 | %and = and i32 %y, %x | |
4 | %cmp = icmp eq i32 %and, 0 | |
5 | br i1 %cmp, label %if.then, label %if.end | |
6 | ||
7 | if.then: ; preds = %entry | |
8 | %neg = xor i32 %y, -1 | |
9 | %and4 = and i32 %neg, %x | |
10 | br label %if.end | |
11 | ||
12 | if.end: ; preds = %if.then, %entry | |
13 | %x.addr.0 = phi i32 [ %and4, %if.then ], [ %x, %entry ] | |
14 | ret i32 %x.addr.0 | |
15 | } | |
16 | ||
17 | define i32 @test2(i32 %x, i32 %y) nounwind uwtable readnone ssp { | |
18 | entry: | |
19 | %and = and i32 %y, %x | |
20 | %cmp = icmp eq i32 %and, 0 | |
21 | %neg = xor i32 %y, -1 | |
22 | %and4 = and i32 %neg, %x | |
23 | br i1 %cmp, label %if.then, label %if.end | |
24 | ||
25 | if.then: ; preds = %entry | |
26 | br label %if.end | |
27 | ||
28 | if.end: ; preds = %if.then, %entry | |
29 | %x.addr.0 = select i1 %cmp, i32 %and4, i32 %x | |
30 | ret i32 %x.addr.0 | |
31 | } | |
32 | ||
33 | Try: | |
34 | opt -O2 x.ll -S -o - | |
35 | and | |
36 | opt -O2 x.ll -S -o - | llvm-commit/Debug+Asserts/bin/llc -O2 -o - |