From 19107563af7568713193c60be24503446556bff2 Mon Sep 17 00:00:00 2001 From: Evan Cheng Date: Wed, 9 Jan 2008 23:01:55 +0000 Subject: [PATCH] Special copy SUnit's do not have SDNode's. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45787 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../SelectionDAG/ScheduleDAGRRList.cpp | 4 +-- test/CodeGen/X86/2008-01-08-SchedulerCrash.ll | 32 +++++++++++++++++++ 2 files changed, 34 insertions(+), 2 deletions(-) create mode 100644 test/CodeGen/X86/2008-01-08-SchedulerCrash.ll diff --git a/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp b/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp index 4cd4577715d..05ba46d6ac6 100644 --- a/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp +++ b/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp @@ -1208,13 +1208,13 @@ static unsigned calcMaxScratches(const SUnit *SU) { for (SUnit::const_pred_iterator I = SU->Preds.begin(), E = SU->Preds.end(); I != E; ++I) { if (I->isCtrl) continue; // ignore chain preds - if (I->Dep->Node->getOpcode() != ISD::CopyFromReg) + if (!I->Dep->Node || I->Dep->Node->getOpcode() != ISD::CopyFromReg) Scratches++; } for (SUnit::const_succ_iterator I = SU->Succs.begin(), E = SU->Succs.end(); I != E; ++I) { if (I->isCtrl) continue; // ignore chain succs - if (I->Dep->Node->getOpcode() != ISD::CopyToReg) + if (!I->Dep->Node || I->Dep->Node->getOpcode() != ISD::CopyToReg) Scratches += 10; } return Scratches; diff --git a/test/CodeGen/X86/2008-01-08-SchedulerCrash.ll b/test/CodeGen/X86/2008-01-08-SchedulerCrash.ll new file mode 100644 index 00000000000..f31a38e28b3 --- /dev/null +++ b/test/CodeGen/X86/2008-01-08-SchedulerCrash.ll @@ -0,0 +1,32 @@ +; RUN: llvm-as < %s | llc -march=x86 + + %struct.indexentry = type { i32, i8*, i8*, i8*, i8*, i8* } + +define i32 @_bfd_stab_section_find_nearest_line(i32 %offset) nounwind { +entry: + %tmp910 = add i32 0, %offset ; [#uses=1] + br i1 true, label %bb951, label %bb917 + +bb917: ; preds = %entry + ret i32 0 + +bb951: ; preds = %bb986, %entry + %tmp955 = sdiv i32 0, 2 ; [#uses=3] + %tmp961 = getelementptr %struct.indexentry* null, i32 %tmp955, i32 0 ; [#uses=1] + br i1 true, label %bb986, label %bb967 + +bb967: ; preds = %bb951 + ret i32 0 + +bb986: ; preds = %bb951 + %tmp993 = load i32* %tmp961, align 4 ; [#uses=1] + %tmp995 = icmp ugt i32 %tmp993, %tmp910 ; [#uses=2] + %tmp1002 = add i32 %tmp955, 1 ; [#uses=1] + %low.0 = select i1 %tmp995, i32 0, i32 %tmp1002 ; [#uses=1] + %high.0 = select i1 %tmp995, i32 %tmp955, i32 0 ; [#uses=1] + %tmp1006 = icmp eq i32 %low.0, %high.0 ; [#uses=1] + br i1 %tmp1006, label %UnifiedReturnBlock, label %bb951 + +UnifiedReturnBlock: ; preds = %bb986 + ret i32 1 +}