hoist_instr.ll 498 B

123456789101112131415161718
  1. ; RUN: opt < %s -instcombine -S | FileCheck %s
  2. ;; This tests that the div is hoisted into the then block.
  3. define i32 @foo(i1 %C, i32 %A, i32 %B) {
  4. entry:
  5. br i1 %C, label %then, label %endif
  6. then: ; preds = %entry
  7. ; CHECK: then:
  8. ; CHECK-NEXT: sdiv i32
  9. br label %endif
  10. endif: ; preds = %then, %entry
  11. %X = phi i32 [ %A, %then ], [ 15, %entry ] ; <i32> [#uses=1]
  12. %Y = sdiv i32 %X, 42 ; <i32> [#uses=1]
  13. ret i32 %Y
  14. }