37 lines · plain
1; RUN: opt < %s -passes='function(loop-simplify),loop-extract' -S | FileCheck %s2 3@label = common local_unnamed_addr global ptr null4 5; CHECK: define6; no outlined function7; CHECK-NOT: define8define i32 @sterix(i32 %n) {9entry:10 %tobool = icmp ne i32 %n, 011 ; this blockaddress references a basic block that goes in the extracted loop12 %cond = select i1 %tobool, ptr blockaddress(@sterix, %for.cond), ptr blockaddress(@sterix, %exit)13 store ptr %cond, ptr @label14 %cmp5 = icmp sgt i32 %n, 015 br i1 %cmp5, label %for.body, label %exit16 17for.cond:18 %mul = shl nsw i32 %s.06, 119 %exitcond = icmp eq i32 %inc, %n20 br i1 %exitcond, label %exit.loopexit, label %for.body21 22for.body:23 %i.07 = phi i32 [ %inc, %for.cond ], [ 0, %entry ]24 %s.06 = phi i32 [ %mul, %for.cond ], [ 1, %entry ]25 %inc = add nuw nsw i32 %i.07, 126 br label %for.cond27 28exit.loopexit:29 %phitmp = icmp ne i32 %s.06, 230 %phitmp8 = zext i1 %phitmp to i3231 br label %exit32 33exit:34 %s.1 = phi i32 [ 1, %entry ], [ %phitmp8, %exit.loopexit ]35 ret i32 %s.136}37