79 lines · plain
1; RUN: llc -verify-machineinstrs -mcpu=pwr7 < %s | FileCheck %s2target 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 not10; have as many predecessor entries as the other PHIs.11; CHECK-LABEL: @fn112; CHECK: mtctr13 14%struct.anon = type { i32 }15%struct.anon.0 = type { i32 }16 17@b = common global ptr null, align 418@a = common global ptr null, align 419 20; Function Attrs: nounwind readonly uwtable21define i32 @fn1() #0 {22entry:23 %0 = load ptr, ptr @b, align 424 %1 = ptrtoint ptr %0 to i3225 %cmp = icmp sgt ptr %0, null26 %2 = load ptr, ptr @a, align 427 br i1 %cmp, label %for.bodythread-pre-split, label %if.end828 29for.bodythread-pre-split: ; preds = %entry30 %.pr = load i32, ptr %2, align 431 br label %for.body32 33for.body: ; preds = %for.bodythread-pre-split, %for.body34 switch i32 %.pr, label %for.body [35 i32 0, label %while.body.lr.ph.preheader36 i32 2, label %while.body.lr.ph.preheader37 ]38 39while.body.lr.ph.preheader: ; preds = %for.body, %for.body40 br label %while.body.lr.ph41 42while.body.lr.ph: ; preds = %while.body.lr.ph.preheader, %if.then643 %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.body46 47while.cond: ; preds = %while.body48 %cmp2 = icmp slt i32 %inc7, %c.0.ph1249 br i1 %cmp2, label %while.body, label %if.end8.loopexit50 51while.body: ; preds = %while.body.lr.ph, %while.cond52 %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 054 %3 = load i32, ptr %aclass_index, align 455 %aclass5 = getelementptr inbounds %struct.anon.0, ptr %2, i32 %3, i32 056 %4 = load i32, ptr %aclass5, align 457 %tobool = icmp eq i32 %4, 058 %inc7 = add nsw i32 %j.110, 159 br i1 %tobool, label %while.cond, label %if.then660 61if.then6: ; preds = %while.body62 %j.110.lcssa = phi i32 [ %j.110, %while.body ]63 %dec = add nsw i32 %c.0.ph12, -164 %cmp29 = icmp slt i32 %j.110.lcssa, %dec65 br i1 %cmp29, label %while.body.lr.ph, label %if.end8.loopexit1766 67if.end8.loopexit: ; preds = %while.cond68 br label %if.end869 70if.end8.loopexit17: ; preds = %if.then671 br label %if.end872 73if.end8: ; preds = %if.end8.loopexit17, %if.end8.loopexit, %entry74 ret i32 undef75}76 77attributes #0 = { nounwind readonly uwtable }78 79