xref: /llvm-project/llvm/test/Transforms/LoopRotate/minsize-disable.ll (revision 91722a4a13d808772edcdd5caad66a598a659655)
1; REQUIRES: asserts
2; RUN: opt < %s -S -passes=loop-rotate -debug -debug-only=loop-rotate 2>&1 | FileCheck %s
3
4; Loop should not be rotated for functions with the minsize attribute.
5; This is mostly useful for LTO which doesn't (yet) understand -Oz.
6; CHECK: LoopRotation: NOT rotating - contains 2 instructions, which is more
7
8@e = global i32 10
9
10declare void @use(i32)
11
12; Function attrs: minsize optsize
13define void @test() #0 {
14entry:
15  %end = load i32, ptr @e
16  br label %loop
17
18loop:
19  %n.phi = phi i32 [ %n, %loop.fin ], [ 0, %entry ]
20  %cond = icmp eq i32 %n.phi, %end
21  br i1 %cond, label %exit, label %loop.fin
22
23loop.fin:
24  %n = add i32 %n.phi, 1
25  call void @use(i32 %n)
26  br label %loop
27
28exit:
29  ret void
30}
31
32attributes #0 = { minsize optsize }
33