Disengage DEBUG_LOC from non-PPC targets.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24919 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
index d76a89d..6d6aab6 100644
--- a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
+++ b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
@@ -622,18 +622,22 @@
     case TargetLowering::Promote:
     default: assert(0 && "This action is not supported yet!");
     case TargetLowering::Expand: {
-      MachineDebugInfo &DebugInfo = DAG.getMachineFunction().getDebugInfo();
-      std::vector<SDOperand> Ops;
-      Ops.push_back(Tmp1);  // chain
-      Ops.push_back(Node->getOperand(1));  // line #
-      Ops.push_back(Node->getOperand(2));  // col #
-      const std::string &fname =
-        cast<StringSDNode>(Node->getOperand(3))->getValue();
-      const std::string &dirname = 
-        cast<StringSDNode>(Node->getOperand(4))->getValue();
-      unsigned id = DebugInfo.RecordSource(fname, dirname);
-      Ops.push_back(DAG.getConstant(id, MVT::i32));  // source file id
-      Result = DAG.getNode(ISD::DEBUG_LOC, MVT::Other, Ops);
+      if (TLI.isOperationLegal(ISD::DEBUG_LOC, MVT::Other)) {
+        MachineDebugInfo &DebugInfo = DAG.getMachineFunction().getDebugInfo();
+        std::vector<SDOperand> Ops;
+        Ops.push_back(Tmp1);  // chain
+        Ops.push_back(Node->getOperand(1));  // line #
+        Ops.push_back(Node->getOperand(2));  // col #
+        const std::string &fname =
+          cast<StringSDNode>(Node->getOperand(3))->getValue();
+        const std::string &dirname = 
+          cast<StringSDNode>(Node->getOperand(4))->getValue();
+        unsigned id = DebugInfo.RecordSource(fname, dirname);
+        Ops.push_back(DAG.getConstant(id, MVT::i32));  // source file id
+        Result = DAG.getNode(ISD::DEBUG_LOC, MVT::Other, Ops);
+      } else {
+        Result = Tmp1;  // chain
+      }
       Result = LegalizeOp(Result);  // Relegalize new nodes.
       break;
     }
diff --git a/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp b/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp
index 49977b2..c39f0cd 100644
--- a/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp
+++ b/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp
@@ -691,7 +691,7 @@
   } else {
     Ordering.push_back(NI);
   }
-  
+
   // Iterate through all nodes that have been added
   for (unsigned i = 0; i < Ordering.size(); i++) { // note: size() varies
     // Visit all operands