summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR/AsmWriter.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/IR/AsmWriter.cpp')
-rw-r--r--llvm/lib/IR/AsmWriter.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/llvm/lib/IR/AsmWriter.cpp b/llvm/lib/IR/AsmWriter.cpp
index 4d4ffe93a806..b7106fea2248 100644
--- a/llvm/lib/IR/AsmWriter.cpp
+++ b/llvm/lib/IR/AsmWriter.cpp
@@ -1806,6 +1806,15 @@ static void writeConstantInternal(raw_ostream &Out, const Constant *CV,
}
}
+ // Use zeroinitializer for inttoptr(0) constant expression.
+ if (CE->getOpcode() == Instruction::IntToPtr) {
+ Constant *SrcCI = cast<Constant>(CE->getOperand(0));
+ if (SrcCI->isZeroValue()) {
+ Out << "zeroinitializer";
+ return;
+ }
+ }
+
Out << CE->getOpcodeName();
writeOptimizationInfo(Out, CE);
Out << " (";