diff --git a/llvm/lib/VMCore/AsmWriter.cpp b/llvm/lib/VMCore/AsmWriter.cpp index d8a1394497b7..4ba166214304 100644 --- a/llvm/lib/VMCore/AsmWriter.cpp +++ b/llvm/lib/VMCore/AsmWriter.cpp @@ -872,6 +872,13 @@ void Instruction::print(std::ostream &o) const { void Constant::print(std::ostream &o) const { if (this == 0) { o << " constant value\n"; return; } + + // Handle CPR's special, because they have context information... + if (const ConstantPointerRef *CPR = dyn_cast(this)) { + CPR->getValue()->print(o); // Print as a global value, with context info. + return; + } + o << " " << getType()->getDescription() << " "; map TypeTable;