SDDbgValues are apparently not being legalized. Fix a symptom of the problem,
[oota-llvm.git] / lib / CodeGen / SelectionDAG / InstrEmitter.cpp
index 8f406a81746fed33a2cb5aedc236d597a7810042..0112bc1942e0968708e2e84bd6b07cfd6e5e2915 100644 (file)
@@ -583,7 +583,13 @@ InstrEmitter::EmitDbgValue(SDDbgValue *SD,
   } else if (SD->getKind() == SDDbgValue::CONST) {
     const Value *V = SD->getConst();
     if (const ConstantInt *CI = dyn_cast<ConstantInt>(V)) {
-      MIB.addImm(CI->getSExtValue());
+      // FIXME: SDDbgValues aren't updated with legalization, so it's possible
+      // to have i128 values in them at this point. As a crude workaround, just
+      // drop the debug info if this happens.
+      if (!CI->getValue().isSignedIntN(64))
+        MIB.addReg(0U);
+      else
+        MIB.addImm(CI->getSExtValue());
     } else if (const ConstantFP *CF = dyn_cast<ConstantFP>(V)) {
       MIB.addFPImm(CF);
     } else {