10ca8ddd8SRoman Lebedev; RUN: opt < %s -passes='function(loop-simplify),loop-extract' -S | FileCheck %s 2cee313d2SEric Christopher 3*bbbbbfbdSNikita Popov@label = common local_unnamed_addr global ptr null 4cee313d2SEric Christopher 5cee313d2SEric Christopher; CHECK: define 6cee313d2SEric Christopher; no outlined function 7cee313d2SEric Christopher; CHECK-NOT: define 8cee313d2SEric Christopherdefine i32 @sterix(i32 %n) { 9cee313d2SEric Christopherentry: 10cee313d2SEric Christopher %tobool = icmp ne i32 %n, 0 11cee313d2SEric Christopher ; this blockaddress references a basic block that goes in the extracted loop 12*bbbbbfbdSNikita Popov %cond = select i1 %tobool, ptr blockaddress(@sterix, %for.cond), ptr blockaddress(@sterix, %exit) 13*bbbbbfbdSNikita Popov store ptr %cond, ptr @label 14cee313d2SEric Christopher %cmp5 = icmp sgt i32 %n, 0 15cee313d2SEric Christopher br i1 %cmp5, label %for.body, label %exit 16cee313d2SEric Christopher 17cee313d2SEric Christopherfor.cond: 18cee313d2SEric Christopher %mul = shl nsw i32 %s.06, 1 19cee313d2SEric Christopher %exitcond = icmp eq i32 %inc, %n 20cee313d2SEric Christopher br i1 %exitcond, label %exit.loopexit, label %for.body 21cee313d2SEric Christopher 22cee313d2SEric Christopherfor.body: 23cee313d2SEric Christopher %i.07 = phi i32 [ %inc, %for.cond ], [ 0, %entry ] 24cee313d2SEric Christopher %s.06 = phi i32 [ %mul, %for.cond ], [ 1, %entry ] 25cee313d2SEric Christopher %inc = add nuw nsw i32 %i.07, 1 26cee313d2SEric Christopher br label %for.cond 27cee313d2SEric Christopher 28cee313d2SEric Christopherexit.loopexit: 29cee313d2SEric Christopher %phitmp = icmp ne i32 %s.06, 2 30cee313d2SEric Christopher %phitmp8 = zext i1 %phitmp to i32 31cee313d2SEric Christopher br label %exit 32cee313d2SEric Christopher 33cee313d2SEric Christopherexit: 34cee313d2SEric Christopher %s.1 = phi i32 [ 1, %entry ], [ %phitmp8, %exit.loopexit ] 35cee313d2SEric Christopher ret i32 %s.1 36cee313d2SEric Christopher} 37