114 lines · plain
1; RUN: opt -loop-reduce -S < %s | FileCheck %s2;3; <rdar://10701050> "Cannot split an edge from an IndirectBrInst" assert.4 5target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"6target triple = "x86_64-apple-darwin10.0.0"7 8; while.cond197 is a dominates the simplified loop while.cond238 but9; has no with no preheader.10;11; CHECK-LABEL: @nopreheader(12; CHECK: %while.cond23813; CHECK: phi i6414; CHECK-NOT: phi15; CHECK: indirectbr16define void @nopreheader(ptr %end) nounwind {17entry:18 br label %while.cond17919 20while.cond179: ; preds = %if.end434, %if.end369, %if.end277, %if.end16521 %s.1 = phi ptr [ undef, %if.end434 ], [ %incdec.ptr356, %if.end348 ], [ undef, %entry ]22 indirectbr ptr undef, [label %land.rhs184, label %while.end453]23 24land.rhs184: ; preds = %while.cond17925 indirectbr ptr undef, [label %while.end453, label %while.cond197]26 27while.cond197: ; preds = %land.rhs202, %land.rhs18428 %0 = phi i64 [ %indvar.next11, %land.rhs202 ], [ 0, %land.rhs184 ]29 indirectbr ptr undef, [label %land.rhs202, label %while.end215]30 31land.rhs202: ; preds = %while.cond19732 %indvar.next11 = add i64 %0, 133 indirectbr ptr undef, [label %while.end215, label %while.cond197]34 35while.end215: ; preds = %land.rhs202, %while.cond19736 indirectbr ptr undef, [label %PREMATURE, label %if.end221]37 38if.end221: ; preds = %while.end21539 indirectbr ptr undef, [label %while.cond238.preheader, label %lor.lhs.false227]40 41lor.lhs.false227: ; preds = %if.end22142 indirectbr ptr undef, [label %while.cond238.preheader, label %if.else]43 44while.cond238.preheader: ; preds = %lor.lhs.false227, %if.end22145 %tmp16 = add i64 %0, 246 indirectbr ptr undef, [label %while.cond238]47 48while.cond238: ; preds = %land.rhs243, %while.cond238.preheader49 %1 = phi i64 [ %indvar.next15, %land.rhs243 ], [ 0, %while.cond238.preheader ]50 %tmp36 = add i64 %tmp16, %151 %s.3 = getelementptr i8, ptr %s.1, i64 %tmp3652 %cmp241 = icmp ult ptr %s.3, %end53 indirectbr ptr undef, [label %land.rhs243, label %while.end256]54 55land.rhs243: ; preds = %while.cond23856 %indvar.next15 = add i64 %1, 157 indirectbr ptr undef, [label %while.end256, label %while.cond238]58 59while.end256: ; preds = %land.rhs243, %while.cond23860 indirectbr ptr undef, [label %PREMATURE]61 62if.else: ; preds = %lor.lhs.false22763 indirectbr ptr undef, [label %if.then297, label %if.else386]64 65if.then297: ; preds = %if.else66 indirectbr ptr undef, [label %PREMATURE, label %if.end307]67 68if.end307: ; preds = %if.then29769 indirectbr ptr undef, [label %if.end314, label %FAIL]70 71if.end314: ; preds = %if.end30772 indirectbr ptr undef, [label %if.end340]73 74if.end340: ; preds = %while.end33475 indirectbr ptr undef, [label %PREMATURE, label %if.end348]76 77if.end348: ; preds = %if.end34078 %incdec.ptr356 = getelementptr inbounds i8, ptr undef, i64 279 indirectbr ptr undef, [label %while.cond179]80 81if.else386: ; preds = %if.else82 indirectbr ptr undef, [label %while.end453, label %if.end434]83 84if.end434: ; preds = %if.then428, %if.end42185 indirectbr ptr undef, [label %while.cond179]86 87while.end453: ; preds = %if.else386, %land.rhs184, %while.cond17988 indirectbr ptr undef, [label %PREMATURE, label %if.end459]89 90if.end459: ; preds = %while.end45391 indirectbr ptr undef, [label %if.then465, label %FAIL]92 93if.then465: ; preds = %if.end45994 indirectbr ptr undef, [label %return, label %if.then479]95 96if.then479: ; preds = %if.then46597 indirectbr ptr undef, [label %return]98 99FAIL: ; preds = %if.end459, %if.end307, %land.lhs.true142, %land.lhs.true131, %while.end100 indirectbr ptr undef, [label %DECL_FAIL]101 102PREMATURE: ; preds = %while.end453, %while.end415, %if.end340, %while.end334, %if.then297, %while.end256, %while.end215103 indirectbr ptr undef, [label %return, label %if.then495]104 105if.then495: ; preds = %PREMATURE106 indirectbr ptr undef, [label %return]107 108DECL_FAIL: ; preds = %if.then488, %FAIL, %land.lhs.true99, %lor.lhs.false, %if.end83, %if.then39, %if.end109 indirectbr ptr undef, [label %return]110 111return: ; preds = %if.then512, %if.end504, %DECL_FAIL, %if.then495, %PREMATURE, %if.then479, %if.then465, %if.then69, %if.end52, %if.end19, %if.then112 ret void113}114