duplicate-phis.ll 478 B

123456789101112131415161718192021
  1. ; RUN: opt < %s -instcombine -simplifycfg -S | grep " = phi " | count 1
  2. ; instcombine should sort the PHI operands so that simplifycfg can see the
  3. ; duplicate and remove it.
  4. define i32 @foo(i1 %t) {
  5. entry:
  6. call void @bar()
  7. br i1 %t, label %true, label %false
  8. true:
  9. call void @bar()
  10. br label %false
  11. false:
  12. %a = phi i32 [ 2, %true ], [ 5, %entry ]
  13. %b = phi i32 [ 5, %entry ], [ 2, %true ]
  14. call void @bar()
  15. %c = add i32 %a, %b
  16. ret i32 %c
  17. }
  18. declare void @bar()