1cee313d2SEric Christopher; RUN: opt < %s -loop-unroll -S | FileCheck %s 2*a95796a3SArthur Eubanks; RUN: opt < %s -passes='require<opt-remark-emit>,loop-unroll' -S | FileCheck %s 3cee313d2SEric Christopher 4cee313d2SEric Christopher 5cee313d2SEric Christopher; This should not unroll since the address of the loop header is taken. 6cee313d2SEric Christopher 7cee313d2SEric Christopher; CHECK-LABEL: @test1( 8cee313d2SEric Christopher; CHECK: store i8* blockaddress(@test1, %l1), i8** %P 9cee313d2SEric Christopher; CHECK: l1: 10cee313d2SEric Christopher; CHECK-NEXT: phi i32 11cee313d2SEric Christopher; rdar://8287027 12cee313d2SEric Christopherdefine i32 @test1(i8** %P) nounwind ssp { 13cee313d2SEric Christopherentry: 14cee313d2SEric Christopher store i8* blockaddress(@test1, %l1), i8** %P 15cee313d2SEric Christopher br label %l1 16cee313d2SEric Christopher 17cee313d2SEric Christopherl1: ; preds = %l1, %entry 18cee313d2SEric Christopher %x.0 = phi i32 [ 0, %entry ], [ %inc, %l1 ] 19cee313d2SEric Christopher %inc = add nsw i32 %x.0, 1 20cee313d2SEric Christopher %exitcond = icmp eq i32 %inc, 3 21cee313d2SEric Christopher br i1 %exitcond, label %l2, label %l1 22cee313d2SEric Christopher 23cee313d2SEric Christopherl2: ; preds = %l1 24cee313d2SEric Christopher ret i32 0 25cee313d2SEric Christopher} 26cee313d2SEric Christopher 27cee313d2SEric Christopher; This should not unroll since the call is 'noduplicate'. 28cee313d2SEric Christopher 29cee313d2SEric Christopher; CHECK-LABEL: @test2( 30cee313d2SEric Christopherdefine i32 @test2(i8** %P) nounwind ssp { 31cee313d2SEric Christopherentry: 32cee313d2SEric Christopher br label %l1 33cee313d2SEric Christopher 34cee313d2SEric Christopherl1: ; preds = %l1, %entry 35cee313d2SEric Christopher %x.0 = phi i32 [ 0, %entry ], [ %inc, %l1 ] 36cee313d2SEric Christopher; CHECK: call void @f() 37cee313d2SEric Christopher; CHECK-NOT: call void @f() 38cee313d2SEric Christopher call void @f() noduplicate 39cee313d2SEric Christopher %inc = add nsw i32 %x.0, 1 40cee313d2SEric Christopher %exitcond = icmp eq i32 %inc, 3 41cee313d2SEric Christopher br i1 %exitcond, label %l2, label %l1 42cee313d2SEric Christopher 43cee313d2SEric Christopherl2: ; preds = %l1 44cee313d2SEric Christopher ret i32 0 45cee313d2SEric Christopher; CHECK: } 46cee313d2SEric Christopher} 47cee313d2SEric Christopher 48cee313d2SEric Christopherdeclare void @f() 49