Skip to content

Commit

Permalink
[llvm] Fix crash caused on ByVal Attribute when switch to llvm 15. (t…
Browse files Browse the repository at this point in the history
…aichi-dev#5745)

ByVal attribute requires type in llvm 15.
  • Loading branch information
python3kgae authored Aug 12, 2022
1 parent 4aee0c3 commit 428a515
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions taichi/codegen/llvm/codegen_llvm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1823,10 +1823,14 @@ std::string TaskCodeGenLLVM::init_offloaded_task_function(OffloadedStmt *stmt,
kernel_args.push_back(&arg);
}
kernel_args[0]->setName("context");

#ifdef TI_LLVM_15
if (kernel_argument_by_val())
func->addParamAttr(
0, llvm::Attribute::getWithByValType(*llvm_context, context_ty));
#else
if (kernel_argument_by_val())
func->addParamAttr(0, llvm::Attribute::ByVal);

#endif
// entry_block has all the allocas
this->entry_block = llvm::BasicBlock::Create(*llvm_context, "entry", func);
this->final_block = llvm::BasicBlock::Create(*llvm_context, "final", func);
Expand Down

0 comments on commit 428a515

Please sign in to comment.