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