From 8e0c53a018feae745c24f7898367088903f8dd3d Mon Sep 17 00:00:00 2001 From: Tim Northover Date: Thu, 11 Aug 2016 21:40:55 +0000 Subject: 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 --- llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'llvm/lib/CodeGen/GlobalISel') 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(C)) EntryBuilder.buildInstr(TargetOpcode::IMPLICIT_DEF).addDef(Reg); + else if (isa(C)) + EntryBuilder.buildInstr(TargetOpcode::G_CONSTANT, LLT{*C.getType()}) + .addDef(Reg) + .addImm(0); else if (auto CE = dyn_cast(&C)) { switch(CE->getOpcode()) { #define HANDLE_INST(NUM, OPCODE, CLASS) \ -- cgit v1.2.3