select-load-call.ll 292 B

123456789101112131415
  1. ; RUN: opt < %s -instcombine -S | grep "ret i32 1"
  2. declare void @test2()
  3. define i32 @test(i1 %cond, i32 *%P) {
  4. %A = alloca i32
  5. store i32 1, i32* %P
  6. store i32 1, i32* %A
  7. call void @test2() readonly
  8. %P2 = select i1 %cond, i32 *%P, i32* %A
  9. %V = load i32, i32* %P2
  10. ret i32 %V
  11. }