optimize strstr, PR5783
[oota-llvm.git] / lib / CodeGen / MachineInstr.cpp
index 2cafbd418f337fb188b318dfa2f0b9eb1fef535c..12b974d30be9a1ebc35ab8039fca802dc601dd8c 100644 (file)
@@ -1064,8 +1064,8 @@ bool MachineInstr::isInvariantLoad(AliasAnalysis *AA) const {
 unsigned MachineInstr::isConstantValuePHI() const {
   if (getOpcode() != TargetInstrInfo::PHI)
     return 0;
-  if (getNumOperands() <= 1)
-    return 0;
+  assert(getNumOperands() >= 3 &&
+         "It's illegal to have a PHI without source operands");
 
   unsigned Reg = getOperand(1).getReg();
   for (unsigned i = 3, e = getNumOperands(); i < e; i += 2)
@@ -1166,9 +1166,14 @@ void MachineInstr::print(raw_ostream &OS, const TargetMachine *TM) const {
     DebugLocTuple DLT = MF->getDebugLocTuple(debugLoc);
     DIScope Scope(DLT.Scope);
     OS << " dbg:";
+    // Omit the directory, since it's usually long and uninteresting.
     if (!Scope.isNull())
-      OS << Scope.getDirectory() << ':' << Scope.getFilename() << ':';
-    OS << DLT.Line << ":" << DLT.Col;
+      OS << Scope.getFilename();
+    else
+      OS << "<unknown>";
+    OS << ':' << DLT.Line;
+    if (DLT.Col != 0)
+      OS << ':' << DLT.Col;
   }
 
   OS << "\n";