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) \
%res = ashr i32 %arg1, %arg2
ret i32 %res
}
+
+; CHECK-LABEL: name: test_constant_null
+; CHECK: [[NULL:%[0-9]+]](64) = G_CONSTANT p0 0
+; CHECK: %x0 = COPY [[NULL]]
+define i8* @test_constant_null() {
+ ret i8* null
+}