Rollup merge of #150511 - Sa4dUs:offload-inline, r=ZuseZ4
Allow inline calls to offload intrinsic Removes explicit insertion point handling and recovers the pointer at the end of the saved basic block. r? `@ZuseZ4` fixes: https://github.com/rust-lang/rust/issues/150413
This commit is contained in:
commit
d898dccc21
4 changed files with 39 additions and 37 deletions
|
|
@ -1458,39 +1458,6 @@ extern "C" void LLVMRustPositionAfter(LLVMBuilderRef B, LLVMValueRef Instr) {
|
|||
}
|
||||
}
|
||||
|
||||
extern "C" LLVMValueRef LLVMRustGetInsertPoint(LLVMBuilderRef B) {
|
||||
llvm::IRBuilderBase &IRB = *unwrap(B);
|
||||
|
||||
llvm::IRBuilderBase::InsertPoint ip = IRB.saveIP();
|
||||
llvm::BasicBlock *BB = ip.getBlock();
|
||||
|
||||
if (!BB)
|
||||
return nullptr;
|
||||
|
||||
auto it = ip.getPoint();
|
||||
|
||||
if (it == BB->end())
|
||||
return nullptr;
|
||||
|
||||
llvm::Instruction *I = &*it;
|
||||
return wrap(I);
|
||||
}
|
||||
|
||||
extern "C" void LLVMRustRestoreInsertPoint(LLVMBuilderRef B,
|
||||
LLVMValueRef Instr) {
|
||||
llvm::IRBuilderBase &IRB = *unwrap(B);
|
||||
|
||||
if (!Instr) {
|
||||
llvm::BasicBlock *BB = IRB.GetInsertBlock();
|
||||
if (BB)
|
||||
IRB.SetInsertPoint(BB);
|
||||
return;
|
||||
}
|
||||
|
||||
llvm::Instruction *I = unwrap<llvm::Instruction>(Instr);
|
||||
IRB.SetInsertPoint(I);
|
||||
}
|
||||
|
||||
extern "C" LLVMValueRef
|
||||
LLVMRustGetFunctionCall(LLVMValueRef Fn, const char *Name, size_t NameLen) {
|
||||
auto targetName = StringRef(Name, NameLen);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue