clang: Respect function address space for __builtin_function_start

Fixes assertion.
This commit is contained in:
Matt Arsenault
2022-12-21 08:09:56 -05:00
parent 7191232305
commit 2bb59549e1
2 changed files with 16 additions and 2 deletions

View File

@@ -4170,8 +4170,9 @@ llvm::Constant *CodeGenModule::GetFunctionStart(const ValueDecl *Decl) {
llvm::GlobalValue *F =
cast<llvm::GlobalValue>(GetAddrOfFunction(Decl)->stripPointerCasts());
return llvm::ConstantExpr::getBitCast(llvm::NoCFIValue::get(F),
llvm::Type::getInt8PtrTy(VMContext));
return llvm::ConstantExpr::getBitCast(
llvm::NoCFIValue::get(F),
llvm::Type::getInt8PtrTy(VMContext, F->getAddressSpace()));
}
static const FunctionDecl *