1; RUN: opt < %s -instcombine -S > %t1.ll
2; RUN: grep udiv %t1.ll | count 2
3; RUN: grep zext %t1.ll | count 2
4; PR2274
5
6; The udiv instructions shouldn't be optimized away, and the
7; sext instructions should be optimized to zext.
8
9define i64 @bar(i32 %x, i32 %g) nounwind {
10  %y = lshr i32 %x, 30
11  %r = udiv i32 %y, %g
12  %z = sext i32 %r to i64
13  ret i64 %z
14}
15define i64 @qux(i32 %x, i32 %v) nounwind {
16  %y = lshr i32 %x, 31
17  %r = udiv i32 %y, %v
18  %z = sext i32 %r to i64
19  ret i64 %z
20}
21