49 lines · plain
1; RUN: opt < %s -passes=loop-unroll -S | FileCheck %s2; RUN: opt < %s -passes='require<opt-remark-emit>,loop-unroll' -S | FileCheck %s3 4 5; This should not unroll since the address of the loop header is taken.6 7; CHECK-LABEL: @test1(8; CHECK: store ptr blockaddress(@test1, %l1), ptr %P9; CHECK: l1:10; CHECK-NEXT: phi i3211; rdar://828702712define i32 @test1(ptr %P) nounwind ssp {13entry:14 store ptr blockaddress(@test1, %l1), ptr %P15 br label %l116 17l1: ; preds = %l1, %entry18 %x.0 = phi i32 [ 0, %entry ], [ %inc, %l1 ]19 %inc = add nsw i32 %x.0, 120 %exitcond = icmp eq i32 %inc, 321 br i1 %exitcond, label %l2, label %l122 23l2: ; preds = %l124 ret i32 025}26 27; This should not unroll since the call is 'noduplicate'.28 29; CHECK-LABEL: @test2(30define i32 @test2(ptr %P) nounwind ssp {31entry:32 br label %l133 34l1: ; preds = %l1, %entry35 %x.0 = phi i32 [ 0, %entry ], [ %inc, %l1 ]36; CHECK: call void @f()37; CHECK-NOT: call void @f()38 call void @f() noduplicate39 %inc = add nsw i32 %x.0, 140 %exitcond = icmp eq i32 %inc, 341 br i1 %exitcond, label %l2, label %l142 43l2: ; preds = %l144 ret i32 045; CHECK: }46}47 48declare void @f()49