Skip to content

Commit

Permalink
Fix error when compile tvm with latest llvm14git (apache#8682)
Browse files Browse the repository at this point in the history
  • Loading branch information
Joejiong authored and ylc committed Sep 29, 2021
1 parent 30a07b8 commit ed048b8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/target/llvm/codegen_llvm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -861,7 +861,11 @@ llvm::Value* CodeGenLLVM::CreateIntrinsic(const CallNode* op) {
: llvm::Type::getVoidTy(*ctx_);
llvm::Function* f = GetIntrinsicDecl(id, return_type, arg_type);
ICHECK(f) << "Cannot find intrinsic declaration, possible type mismatch: "
#if TVM_LLVM_VERSION <= 130
<< llvm::Intrinsic::getName(id, {});
#else
<< llvm::Intrinsic::getName(id, return_type, {});
#endif
return builder_->CreateCall(f, arg_value);
} else if (op->op.same_as(builtin::bitwise_and())) {
return builder_->CreateAnd(MakeValue(op->args[0]), MakeValue(op->args[1]));
Expand Down
4 changes: 4 additions & 0 deletions src/target/llvm/llvm_module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,11 @@ class LLVMModuleNode final : public runtime::ModuleNode {
void SaveToFile(const std::string& file_name, const std::string& format) final {
std::string fmt = runtime::GetFileFormat(file_name, format);
std::error_code ecode;
#if TVM_LLVM_VERSION <= 70
llvm::raw_fd_ostream dest(file_name, ecode, llvm::sys::fs::F_None);
#else
llvm::raw_fd_ostream dest(file_name, ecode, llvm::sys::fs::OF_None);
#endif
ICHECK_EQ(ecode.value(), 0) << "Cannot open file: " << file_name << " " << ecode.message();
if (fmt == "o" || fmt == "obj") {
#if TVM_LLVM_VERSION <= 60
Expand Down

0 comments on commit ed048b8

Please sign in to comment.