tqchen commented on a change in pull request #7084:
URL: https://github.com/apache/tvm/pull/7084#discussion_r558329105
##########
File path: src/target/llvm/codegen_llvm.cc
##########
@@ -927,6 +927,12 @@ llvm::Value* CodeGenLLVM::CreateIntrinsic(const CallNode*
op) {
value->addIncoming(then_value, then_value_block);
value->addIncoming(else_value, else_value_block);
return value;
+ } else if (op->op.same_as(builtin::ret())) {
+ ICHECK_EQ(Downcast<IntImm>(op->args[0])->value, 0);
+ builder_->CreateRet(ConstInt32(0));
+ llvm::BasicBlock* ret_dummy = llvm::BasicBlock::Create(*ctx_, "ret_dummy",
function_);
Review comment:
Please add a comment block on why this is needed, so future readers can
understand what is going on
##########
File path: src/target/llvm/codegen_llvm.cc
##########
@@ -927,6 +927,12 @@ llvm::Value* CodeGenLLVM::CreateIntrinsic(const CallNode*
op) {
value->addIncoming(then_value, then_value_block);
value->addIncoming(else_value, else_value_block);
return value;
+ } else if (op->op.same_as(builtin::ret())) {
+ ICHECK_EQ(Downcast<IntImm>(op->args[0])->value, 0);
Review comment:
I believe we can also safely support other return values as int.
We need to ICHECK op->args is an IntImm of type i32, return that constant
value. Add an error message that we only support returning int value for now.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]