[llvm-commits] [llvm] r66501 - in /llvm/branches/Apple/Dib: lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp test/CodeGen/X86/2009-03-05-burr-list-crash.ll

Dan Gohman gohman at apple.com
Mon Mar 9 16:26:10 PDT 2009


Author: djg
Date: Mon Mar  9 18:26:10 2009
New Revision: 66501

URL: http://llvm.org/viewvc/llvm-project?rev=66501&view=rev
Log:
Merge from trunk:

r66240 | djg | 2009-03-05 18:23:01 -0800 (Thu, 05 Mar 2009) | 8 lines

Fix ScheduleDAGRRList::CopyAndMoveSuccessors' handling of nodes
with multiple chain operands. This can occur when the scheduler
has added chain operands to a node that already has a chain
operand, in order to handle physical register dependencies.

This fixes an llvm-gcc bootstrap failure on x86-64 introduced
in r66058.

Added:
    llvm/branches/Apple/Dib/test/CodeGen/X86/2009-03-05-burr-list-crash.ll
Modified:
    llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp

Modified: llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp?rev=66501&r1=66500&r2=66501&view=diff

==============================================================================
--- llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp (original)
+++ llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp Mon Mar  9 18:26:10 2009
@@ -402,7 +402,7 @@
       NewSU->isCommutable = true;
     ComputeLatency(NewSU);
 
-    SDep ChainPred;
+    SmallVector<SDep, 4> ChainPreds;
     SmallVector<SDep, 4> ChainSuccs;
     SmallVector<SDep, 4> LoadPreds;
     SmallVector<SDep, 4> NodePreds;
@@ -410,7 +410,7 @@
     for (SUnit::pred_iterator I = SU->Preds.begin(), E = SU->Preds.end();
          I != E; ++I) {
       if (I->isCtrl())
-        ChainPred = *I;
+        ChainPreds.push_back(*I);
       else if (I->getSUnit()->getNode() &&
                I->getSUnit()->getNode()->isOperandOf(LoadNode))
         LoadPreds.push_back(*I);
@@ -425,17 +425,17 @@
         NodeSuccs.push_back(*I);
     }
 
-    if (ChainPred.getSUnit()) {
-      RemovePred(SU, ChainPred);
+    for (unsigned i = 0, e = ChainPreds.size(); i != e; ++i) {
+      const SDep &Pred = ChainPreds[i];
+      RemovePred(SU, Pred);
       if (isNewLoad)
-        AddPred(LoadSU, ChainPred);
+        AddPred(LoadSU, Pred);
     }
     for (unsigned i = 0, e = LoadPreds.size(); i != e; ++i) {
       const SDep &Pred = LoadPreds[i];
       RemovePred(SU, Pred);
-      if (isNewLoad) {
+      if (isNewLoad)
         AddPred(LoadSU, Pred);
-      }
     }
     for (unsigned i = 0, e = NodePreds.size(); i != e; ++i) {
       const SDep &Pred = NodePreds[i];

Added: llvm/branches/Apple/Dib/test/CodeGen/X86/2009-03-05-burr-list-crash.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/test/CodeGen/X86/2009-03-05-burr-list-crash.ll?rev=66501&view=auto

==============================================================================
--- llvm/branches/Apple/Dib/test/CodeGen/X86/2009-03-05-burr-list-crash.ll (added)
+++ llvm/branches/Apple/Dib/test/CodeGen/X86/2009-03-05-burr-list-crash.ll Mon Mar  9 18:26:10 2009
@@ -0,0 +1,35 @@
+; RUN: llvm-as < %s | llc
+
+target 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"
+target triple = "x86_64-unknown-linux-gnu"
+external global i32		; <i32*>:0 [#uses=1]
+
+declare i64 @strlen(i8* nocapture) nounwind readonly
+
+define fastcc i8* @1(i8*) nounwind {
+	br i1 false, label %3, label %2
+
+; <label>:2		; preds = %1
+	ret i8* %0
+
+; <label>:3		; preds = %1
+	%4 = call i64 @strlen(i8* %0) nounwind readonly		; <i64> [#uses=1]
+	%5 = trunc i64 %4 to i32		; <i32> [#uses=2]
+	%6 = load i32* @0, align 4		; <i32> [#uses=1]
+	%7 = sub i32 %5, %6		; <i32> [#uses=2]
+	%8 = sext i32 %5 to i64		; <i64> [#uses=1]
+	%9 = sext i32 %7 to i64		; <i64> [#uses=1]
+	%10 = sub i64 %8, %9		; <i64> [#uses=1]
+	%11 = getelementptr i8* %0, i64 %10		; <i8*> [#uses=1]
+	%12 = icmp sgt i32 %7, 0		; <i1> [#uses=1]
+	br i1 %12, label %13, label %14
+
+; <label>:13		; preds = %13, %3
+	br label %13
+
+; <label>:14		; preds = %3
+	%15 = call noalias i8* @make_temp_file(i8* %11) nounwind		; <i8*> [#uses=0]
+	unreachable
+}
+
+declare noalias i8* @make_temp_file(i8*)





More information about the llvm-commits mailing list