diff --git a/IDEHelper/Backend/BeIRCodeGen.cpp b/IDEHelper/Backend/BeIRCodeGen.cpp index b417b7db..3190a2e8 100644 --- a/IDEHelper/Backend/BeIRCodeGen.cpp +++ b/IDEHelper/Backend/BeIRCodeGen.cpp @@ -874,6 +874,12 @@ void BeIRCodeGen::Read(BeValue*& beValue) beValue = beConst; return; } + else if (constType == BfConstType_Undef) + { + CMD_PARAM(BeType*, type); + beValue = mBeModule->CreateUndefValue(type); + return; + } bool isSigned = false; BeType* llvmConstType = GetBeType(typeCode, isSigned); diff --git a/IDEHelper/Compiler/BfIRBuilder.cpp b/IDEHelper/Compiler/BfIRBuilder.cpp index 2429812b..ef688514 100644 --- a/IDEHelper/Compiler/BfIRBuilder.cpp +++ b/IDEHelper/Compiler/BfIRBuilder.cpp @@ -1950,6 +1950,12 @@ void BfIRBuilder::Write(const BfIRValue& irValue) Write(constant->mInt64); } break; + case (int)BfConstType_Undef: + { + auto undefConst = (BfConstantUndef*)constant; + Write(undefConst->mType); + } + break; default: { BF_FATAL("Unhandled"); diff --git a/IDEHelper/Compiler/BfIRCodeGen.cpp b/IDEHelper/Compiler/BfIRCodeGen.cpp index 79ca27c1..7f0cb2f0 100644 --- a/IDEHelper/Compiler/BfIRCodeGen.cpp +++ b/IDEHelper/Compiler/BfIRCodeGen.cpp @@ -935,6 +935,12 @@ void BfIRCodeGen::Read(llvm::Value*& llvmValue, BfIRCodeGenEntry** codeGenEntry) return; } + else if (constType == BfConstType_Undef) + { + CMD_PARAM(llvm::Type*, type); + llvmValue = llvm::UndefValue::get(type); + return; + } bool isSigned; llvm::Type* llvmConstType = GetLLVMType(typeCode, isSigned);