1; RUN: llc -verify-machineinstrs -mcpu=pwr7 < %s | FileCheck %s 2target datalayout = "E-m:e-p:32:32-i64:64-n32" 3target triple = "powerpc-unknown-linux-gnu" 4 5; This code would cause code generation like this after PPCCTRLoops ran: 6; %indvar = phi i32 [ 0, %for.body ], [ %indvar.next, %if.then6 ] 7; %j.1.ph13 = phi i32 [ %j.110, %if.then6 ], [ 0, %for.body ], [ 0, %for.body ] 8; %c.0.ph12 = phi i32 [ %dec, %if.then6 ], [ %2, %for.body ], [ %2, %for.body ] 9; which would fail verification because the created induction variable does not 10; have as many predecessor entries as the other PHIs. 11; CHECK-LABEL: @fn1 12; CHECK: mtctr 13 14%struct.anon = type { i32 } 15%struct.anon.0 = type { i32 } 16 17@b = common global ptr null, align 4 18@a = common global ptr null, align 4 19 20; Function Attrs: nounwind readonly uwtable 21define i32 @fn1() #0 { 22entry: 23 %0 = load ptr, ptr @b, align 4 24 %1 = ptrtoint ptr %0 to i32 25 %cmp = icmp sgt ptr %0, null 26 %2 = load ptr, ptr @a, align 4 27 br i1 %cmp, label %for.bodythread-pre-split, label %if.end8 28 29for.bodythread-pre-split: ; preds = %entry 30 %.pr = load i32, ptr %2, align 4 31 br label %for.body 32 33for.body: ; preds = %for.bodythread-pre-split, %for.body 34 switch i32 %.pr, label %for.body [ 35 i32 0, label %while.body.lr.ph.preheader 36 i32 2, label %while.body.lr.ph.preheader 37 ] 38 39while.body.lr.ph.preheader: ; preds = %for.body, %for.body 40 br label %while.body.lr.ph 41 42while.body.lr.ph: ; preds = %while.body.lr.ph.preheader, %if.then6 43 %j.1.ph13 = phi i32 [ %j.110.lcssa, %if.then6 ], [ 0, %while.body.lr.ph.preheader ] 44 %c.0.ph12 = phi i32 [ %dec, %if.then6 ], [ %1, %while.body.lr.ph.preheader ] 45 br label %while.body 46 47while.cond: ; preds = %while.body 48 %cmp2 = icmp slt i32 %inc7, %c.0.ph12 49 br i1 %cmp2, label %while.body, label %if.end8.loopexit 50 51while.body: ; preds = %while.body.lr.ph, %while.cond 52 %j.110 = phi i32 [ %j.1.ph13, %while.body.lr.ph ], [ %inc7, %while.cond ] 53 %aclass_index = getelementptr inbounds %struct.anon, ptr %0, i32 %j.110, i32 0 54 %3 = load i32, ptr %aclass_index, align 4 55 %aclass5 = getelementptr inbounds %struct.anon.0, ptr %2, i32 %3, i32 0 56 %4 = load i32, ptr %aclass5, align 4 57 %tobool = icmp eq i32 %4, 0 58 %inc7 = add nsw i32 %j.110, 1 59 br i1 %tobool, label %while.cond, label %if.then6 60 61if.then6: ; preds = %while.body 62 %j.110.lcssa = phi i32 [ %j.110, %while.body ] 63 %dec = add nsw i32 %c.0.ph12, -1 64 %cmp29 = icmp slt i32 %j.110.lcssa, %dec 65 br i1 %cmp29, label %while.body.lr.ph, label %if.end8.loopexit17 66 67if.end8.loopexit: ; preds = %while.cond 68 br label %if.end8 69 70if.end8.loopexit17: ; preds = %if.then6 71 br label %if.end8 72 73if.end8: ; preds = %if.end8.loopexit17, %if.end8.loopexit, %entry 74 ret i32 undef 75} 76 77attributes #0 = { nounwind readonly uwtable } 78 79