• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; REQUIRES: asserts
2; RUN: opt < %s -S -Os -debug -debug-only=loop-rotate 2>&1 | FileCheck %s -check-prefix=OS
3; RUN: opt < %s -S -Oz -debug -debug-only=loop-rotate 2>&1 | FileCheck %s -check-prefix=OZ
4; RUN: opt < %s -S -passes='default<Os>' -debug -debug-only=loop-rotate 2>&1 | FileCheck %s -check-prefix=OS
5; RUN: opt < %s -S -passes='default<Oz>' -debug -debug-only=loop-rotate 2>&1 | FileCheck %s -check-prefix=OZ
6
7; Loop should be rotated for -Os but not for -Oz.
8; OS: rotating Loop at depth 1
9; OZ-NOT: rotating Loop at depth 1
10
11@e = global i32 10
12
13declare void @use(i32)
14
15define void @test() {
16entry:
17  %end = load i32, i32* @e
18  br label %loop
19
20loop:
21  %n.phi = phi i32 [ %n, %loop.fin ], [ 0, %entry ]
22  %cond = icmp eq i32 %n.phi, %end
23  br i1 %cond, label %exit, label %loop.fin
24
25loop.fin:
26  %n = add i32 %n.phi, 1
27  call void @use(i32 %n)
28  br label %loop
29
30exit:
31  ret void
32}
33