select-gep.ll 496 B

123456789101112131415161718192021
  1. ; RUN: opt -S -simplifycfg < %s | FileCheck %s
  2. %ST = type { i8, i8 }
  3. define i8* @test1(%ST* %x, i8* %y) nounwind {
  4. entry:
  5. %cmp = icmp eq %ST* %x, null
  6. br i1 %cmp, label %if.then, label %if.end
  7. if.then:
  8. %incdec.ptr = getelementptr %ST, %ST* %x, i32 0, i32 1
  9. br label %if.end
  10. if.end:
  11. %x.addr = phi i8* [ %incdec.ptr, %if.then ], [ %y, %entry ]
  12. ret i8* %x.addr
  13. ; CHECK-LABEL: @test1(
  14. ; CHECK: %incdec.ptr.y = select i1 %cmp, i8* %incdec.ptr, i8* %y
  15. ; CHECK: ret i8* %incdec.ptr.y
  16. }