If loop induction variable's start value is less then its exit value then do not...
[oota-llvm.git] / test / Transforms / InstCombine / udiv-simplify-bug-1.ll
1 ; RUN: llvm-as < %s | opt -instcombine | llvm-dis > %t1.ll
2 ; RUN: grep udiv %t1.ll | count 3
3 ; RUN: grep zext %t1.ll | count 3
4 ; PR2274
5
6 ; The udiv instructions shouldn't be optimized away, and the
7 ; sext instructions should be optimized to zext.
8
9 define i64 @foo(i32 %x) nounwind {
10   %r = udiv i32 %x, -1
11   %z = sext i32 %r to i64
12   ret i64 %z
13 }
14 define i64 @bar(i32 %x) nounwind {
15   %y = lshr i32 %x, 30
16   %r = udiv i32 %y, 3
17   %z = sext i32 %r to i64
18   ret i64 %z
19 }
20 define i64 @qux(i32 %x, i32 %v) nounwind {
21   %y = lshr i32 %x, 31
22   %r = udiv i32 %y, %v
23   %z = sext i32 %r to i64
24   ret i64 %z
25 }