_alt.ssa 529 B

12345678910111213141516171819202122232425
  1. # an example with reducible control
  2. # flow graph that exposes poor
  3. # handling of looping constructs
  4. function $test() {
  5. @start
  6. %ten =w copy 10
  7. %dum =w copy 0 # dummy live-through temporary
  8. @loop
  9. %alt =w phi @start 0, @left %alt1, @right %alt1
  10. %cnt =w phi @start 100, @left %cnt, @right %cnt1
  11. %alt1 =w sub 1, %alt
  12. jnz %alt1, @right, @left
  13. @left
  14. %x =w phi @loop 10, @left %x1
  15. %x1 =w sub %x, 1
  16. %z =w copy %x
  17. jnz %z, @left, @loop
  18. @right
  19. %cnt1 =w sub %cnt, %ten
  20. jnz %cnt1, @loop, @end
  21. @end
  22. %ret =w add %cnt, %dum
  23. ret
  24. }