udiv-simplify-bug-1.ll 490 B

1234567891011121314151617181920
  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. ; The udiv instructions shouldn't be optimized away, and the
  6. ; sext instructions should be optimized to zext.
  7. define i64 @bar(i32 %x, i32 %g) nounwind {
  8. %y = lshr i32 %x, 30
  9. %r = udiv i32 %y, %g
  10. %z = sext i32 %r to i64
  11. ret i64 %z
  12. }
  13. define i64 @qux(i32 %x, i32 %v) nounwind {
  14. %y = lshr i32 %x, 31
  15. %r = udiv i32 %y, %v
  16. %z = sext i32 %r to i64
  17. ret i64 %z
  18. }