2004-02-23-ShiftShiftOverflow.ll 519 B

123456789101112131415
  1. ; RUN: opt < %s -instcombine -S | not grep 34
  2. define i32 @test(i32 %X) {
  3. ; Do not fold into shr X, 34, as this uses undefined behavior!
  4. %Y = ashr i32 %X, 17 ; <i32> [#uses=1]
  5. %Z = ashr i32 %Y, 17 ; <i32> [#uses=1]
  6. ret i32 %Z
  7. }
  8. define i32 @test2(i32 %X) {
  9. ; Do not fold into shl X, 34, as this uses undefined behavior!
  10. %Y = shl i32 %X, 17 ; <i32> [#uses=1]
  11. %Z = shl i32 %Y, 17 ; <i32> [#uses=1]
  12. ret i32 %Z
  13. }