1*9880d681SAndroid Build Coastguard Worker; RUN: opt -S -loop-unroll < %s | FileCheck %s 2*9880d681SAndroid Build Coastguard Worker 3*9880d681SAndroid Build Coastguard Worker; LLVM should not try to fully unroll this loop. 4*9880d681SAndroid Build Coastguard Worker 5*9880d681SAndroid Build Coastguard Workerdeclare void @f() 6*9880d681SAndroid Build Coastguard Workerdeclare void @g() 7*9880d681SAndroid Build Coastguard Workerdeclare void @h() 8*9880d681SAndroid Build Coastguard Worker 9*9880d681SAndroid Build Coastguard Workerdefine void @trivial_loop() { 10*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: @trivial_loop( 11*9880d681SAndroid Build Coastguard Worker entry: 12*9880d681SAndroid Build Coastguard Worker br label %loop 13*9880d681SAndroid Build Coastguard Worker 14*9880d681SAndroid Build Coastguard Worker loop: 15*9880d681SAndroid Build Coastguard Worker %idx = phi i32 [ 0, %entry ], [ %idx.inc, %loop ] 16*9880d681SAndroid Build Coastguard Worker %idx.inc = add i32 %idx, 1 17*9880d681SAndroid Build Coastguard Worker call void @f() 18*9880d681SAndroid Build Coastguard Worker call void @g() 19*9880d681SAndroid Build Coastguard Worker call void @h() 20*9880d681SAndroid Build Coastguard Worker call void @f() 21*9880d681SAndroid Build Coastguard Worker call void @g() 22*9880d681SAndroid Build Coastguard Worker call void @h() 23*9880d681SAndroid Build Coastguard Worker call void @f() 24*9880d681SAndroid Build Coastguard Worker call void @g() 25*9880d681SAndroid Build Coastguard Worker call void @h() 26*9880d681SAndroid Build Coastguard Worker call void @f() 27*9880d681SAndroid Build Coastguard Worker call void @g() 28*9880d681SAndroid Build Coastguard Worker call void @h() 29*9880d681SAndroid Build Coastguard Worker call void @f() 30*9880d681SAndroid Build Coastguard Worker call void @g() 31*9880d681SAndroid Build Coastguard Worker call void @h() 32*9880d681SAndroid Build Coastguard Worker %be = icmp slt i32 %idx, 268435456 33*9880d681SAndroid Build Coastguard Worker br i1 %be, label %loop, label %exit 34*9880d681SAndroid Build Coastguard Worker 35*9880d681SAndroid Build Coastguard Worker; CHECK: loop: 36*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: %idx = phi i32 [ 0, %entry ], [ %idx.inc, %loop ] 37*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: %idx.inc = add i32 %idx, 1 38*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: call void @f() 39*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: call void @g() 40*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: call void @h() 41*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: call void @f() 42*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: call void @g() 43*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: call void @h() 44*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: call void @f() 45*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: call void @g() 46*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: call void @h() 47*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: call void @f() 48*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: call void @g() 49*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: call void @h() 50*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: call void @f() 51*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: call void @g() 52*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: call void @h() 53*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: %be = icmp slt i32 %idx, 268435456 54*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: br i1 %be, label %loop, label %exit 55*9880d681SAndroid Build Coastguard Worker 56*9880d681SAndroid Build Coastguard Worker exit: 57*9880d681SAndroid Build Coastguard Worker ret void 58*9880d681SAndroid Build Coastguard Worker} 59