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