summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorTim Northover <tnorthover@apple.com>2016-08-11 21:40:55 +0000
committerTim Northover <tnorthover@apple.com>2016-08-11 21:40:55 +0000
commit8e0c53a018feae745c24f7898367088903f8dd3d (patch)
treedbb89ba46373382624a9309dfa5e3f1f2b33eb3b /llvm/lib
parentdbcfea98115be723320f405b6e021a555e709b9b (diff)
downloadbcm5719-llvm-8e0c53a018feae745c24f7898367088903f8dd3d.tar.gz
bcm5719-llvm-8e0c53a018feae745c24f7898367088903f8dd3d.zip
GlobalISel: support 'null' constant in translation.
It's sharing the integer G_CONSTANT for now since I don't *think* it creates any ambiguity (even on weird archs). If that turns out wrong we can create a G_PTRCONSTANT or something. llvm-svn: 278423
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp b/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp
index 5e07723bbc4..3f396cce36b 100644
--- a/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp
+++ b/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp
@@ -296,6 +296,10 @@ bool IRTranslator::translate(const Constant &C, unsigned Reg) {
EntryBuilder.buildConstant(LLT{*CI->getType()}, Reg, CI->getZExtValue());
else if (isa<UndefValue>(C))
EntryBuilder.buildInstr(TargetOpcode::IMPLICIT_DEF).addDef(Reg);
+ else if (isa<ConstantPointerNull>(C))
+ EntryBuilder.buildInstr(TargetOpcode::G_CONSTANT, LLT{*C.getType()})
+ .addDef(Reg)
+ .addImm(0);
else if (auto CE = dyn_cast<ConstantExpr>(&C)) {
switch(CE->getOpcode()) {
#define HANDLE_INST(NUM, OPCODE, CLASS) \
OpenPOWER on IntegriCloud