Grab the subtarget info off of the MachineFunction rather than
[oota-llvm.git] / lib / CodeGen / MachineInstr.cpp
index d33d4a9d26aff1054ef255adf11cdeb031f9879f..2e59f37182698b32218b1b49cb5560dad9360ab4 100644 (file)
@@ -1643,11 +1643,11 @@ void MachineInstr::print(raw_ostream &OS, const TargetMachine *TM,
     if (isDebugValue() && MO.isMetadata()) {
       // Pretty print DBG_VALUE instructions.
       const MDNode *MD = MO.getMetadata();
-      if (MD->getNumOperands() >= 2)
-        if (const MDString *MDS = dyn_cast<MDString>(MD->getOperand(2)))
-          OS << "!\"" << MDS->getString() << '\"';
-        else
-          MO.print(OS, TM);
+      DIDescriptor DI(MD);
+      DIVariable DIV(MD);
+
+      if (DI.isVariable() && !DIV.getName().empty())
+        OS << "!\"" << DIV.getName() << '\"';
       else
         MO.print(OS, TM);
     } else if (TM && (isInsertSubreg() || isRegSequence()) && MO.isImm()) {