1 ; RUN: opt < %s -passes=loop-unroll -S | FileCheck %s
2 ; RUN: opt < %s -passes='require<opt-remark-emit>,loop-unroll' -S | FileCheck %s
5 ; This should not unroll since the address of the loop header is taken.
8 ; CHECK: store ptr blockaddress(@test1, %l1), ptr %P
12 define i32 @test1(ptr %P) nounwind ssp {
14 store ptr blockaddress(@test1, %l1), ptr %P
17 l1: ; preds = %l1, %entry
18 %x.0 = phi i32 [ 0, %entry ], [ %inc, %l1 ]
19 %inc = add nsw i32 %x.0, 1
20 %exitcond = icmp eq i32 %inc, 3
21 br i1 %exitcond, label %l2, label %l1
27 ; This should not unroll since the call is 'noduplicate'.
29 ; CHECK-LABEL: @test2(
30 define i32 @test2(ptr %P) nounwind ssp {
34 l1: ; preds = %l1, %entry
35 %x.0 = phi i32 [ 0, %entry ], [ %inc, %l1 ]
36 ; CHECK: call void @f()
37 ; CHECK-NOT: call void @f()
38 call void @f() noduplicate
39 %inc = add nsw i32 %x.0, 1
40 %exitcond = icmp eq i32 %inc, 3
41 br i1 %exitcond, label %l2, label %l1