xref: /llvm-project/llvm/test/Transforms/LoopRotate/oz-disable.ll (revision 2fef685363e13e0640b624cc3d07b1006f12113c)
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;; Make sure -allow-loop-header-duplication overrides the default behavior at Oz
8; RUN: opt < %s -S -passes='default<Oz>' -enable-loop-header-duplication -debug -debug-only=loop-rotate 2>&1 | FileCheck %s -check-prefix=OS
9
10; Loop should be rotated for -Os but not for -Oz.
11; OS: rotating Loop at depth 1
12; OZ-NOT: rotating Loop at depth 1
13
14@e = global i32 10
15
16declare void @use(i32)
17
18define void @test() {
19entry:
20  %end = load i32, ptr @e
21  br label %loop
22
23loop:
24  %n.phi = phi i32 [ %n, %loop.fin ], [ 0, %entry ]
25  %cond = icmp eq i32 %n.phi, %end
26  br i1 %cond, label %exit, label %loop.fin
27
28loop.fin:
29  %n = add i32 %n.phi, 1
30  call void @use(i32 %n)
31  br label %loop
32
33exit:
34  ret void
35}
36