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 5 ; Loop should be rotated for -Os but not for -Oz. 6 ; OS: rotating Loop at depth 1 7 ; OZ-NOT: rotating Loop at depth 1 8 9 @e = global i32 10 10 11 declare void @use(i32) 12 13 define void @test() { 14 entry: 15 %end = load i32, i32* @e 16 br label %loop 17 18 loop: 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 23 loop.fin: 24 %n = add i32 %n.phi, 1 25 call void @use(i32 %n) 26 br label %loop 27 28 exit: 29 ret void 30 } 31