You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by tq...@apache.org on 2020/07/10 22:36:26 UTC
[incubator-tvm] branch master updated: [LLVM/CPU] Terminate basic
block after "ret" instruction (#6036)
This is an automated email from the ASF dual-hosted git repository.
tqchen pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-tvm.git
The following commit(s) were added to refs/heads/master by this push:
new c9c77c6 [LLVM/CPU] Terminate basic block after "ret" instruction (#6036)
c9c77c6 is described below
commit c9c77c6b76f7cff3bc6afbf9d3ef2200e3fdbb91
Author: Krzysztof Parzyszek <kp...@quicinc.com>
AuthorDate: Fri Jul 10 17:36:17 2020 -0500
[LLVM/CPU] Terminate basic block after "ret" instruction (#6036)
* [LLVM/CPU] Terminate basic block after "ret" instruction
"Ret" is a terminator in LLVM IR and there should be no instructions
in the basic block following it. When generating a "ret", end the
current block and start a new one.
---
src/target/llvm/codegen_cpu.cc | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/target/llvm/codegen_cpu.cc b/src/target/llvm/codegen_cpu.cc
index f855dd5..41fa3c5 100644
--- a/src/target/llvm/codegen_cpu.cc
+++ b/src/target/llvm/codegen_cpu.cc
@@ -781,6 +781,9 @@ llvm::Value* CodeGenCPU::CreateIntrinsic(const CallNode* op) {
return CreateStaticHandle();
} else if (op->op.same_as(builtin::tvm_throw_last_error())) {
builder_->CreateRet(ConstInt32(-1));
+ auto next_block = std::next(builder_->GetInsertBlock()->getIterator());
+ llvm::BasicBlock* new_bb = llvm::BasicBlock::Create(*ctx_, "cont", function_, &*next_block);
+ builder_->SetInsertPoint(new_bb);
return ConstInt32(-1);
} else if (op->op.same_as(builtin::tvm_struct_get())) {
CHECK_EQ(op->args.size(), 3U);