Use opt -S instead of piping bitcode output through llvm-dis.
[oota-llvm.git] / test / Transforms / InstCombine / preserve-sminmax.ll
1 ; RUN: opt %s -instcombine -S | grep { i32 \[%\]sd, \[\[:alnum:\]\]* \\?1\\>} | count 4
2
3 ; Instcombine normally would fold the sdiv into the comparison,
4 ; making "icmp slt i32 %h, 2", but in this case the sdiv has
5 ; another use, so it wouldn't a big win, and it would also
6 ; obfuscate an otherise obvious smax pattern to the point where
7 ; other analyses wouldn't recognize it.
8
9 define i32 @foo(i32 %h) {
10   %sd = sdiv i32 %h, 2
11   %t = icmp slt i32 %sd, 1
12   %r = select i1 %t, i32 %sd, i32 1
13   ret i32 %r
14 }
15
16 define i32 @bar(i32 %h) {
17   %sd = sdiv i32 %h, 2
18   %t = icmp sgt i32 %sd, 1
19   %r = select i1 %t, i32 %sd, i32 1
20   ret i32 %r
21 }
22