alloca.ll 655 B

123456789101112131415161718192021222324252627282930313233
  1. ; RUN: opt < %s -loop-rotate -S | FileCheck %s
  2. ; Test alloca in -loop-rotate.
  3. ; We expect a different value for %ptr each iteration (according to the
  4. ; definition of alloca). I.e. each @use must be paired with an alloca.
  5. ; CHECK: call void @use(i8* %
  6. ; CHECK: %ptr = alloca i8
  7. @e = global i16 10
  8. declare void @use(i8*)
  9. define void @test() {
  10. entry:
  11. %end = load i16, i16* @e
  12. br label %loop
  13. loop:
  14. %n.phi = phi i16 [ %n, %loop.fin ], [ 0, %entry ]
  15. %ptr = alloca i8
  16. %cond = icmp eq i16 %n.phi, %end
  17. br i1 %cond, label %exit, label %loop.fin
  18. loop.fin:
  19. %n = add i16 %n.phi, 1
  20. call void @use(i8* %ptr)
  21. br label %loop
  22. exit:
  23. ret void
  24. }