diff --git a/src/target/llvm/codegen_amdgpu.cc b/src/target/llvm/codegen_amdgpu.cc index 9cf4d539c1ad9..961ff418e2a53 100644 --- a/src/target/llvm/codegen_amdgpu.cc +++ b/src/target/llvm/codegen_amdgpu.cc @@ -236,7 +236,7 @@ runtime::Module BuildAMDGPU(Array funcs, std::string target) { llvm::SMDiagnostic err; std::unique_ptr mlib = llvm::parseIRFile(path, err, *ctx); if (mlib.get() == nullptr) { - std::string msg = err.getMessage(); + std::string msg(err.getMessage()); LOG(FATAL) << "Fail to load bitcode file " << path << "\n" << "line " << err.getLineNo() << ":" << msg; } diff --git a/src/target/llvm/codegen_nvptx.cc b/src/target/llvm/codegen_nvptx.cc index 555adc9d26ed0..821232ded1705 100644 --- a/src/target/llvm/codegen_nvptx.cc +++ b/src/target/llvm/codegen_nvptx.cc @@ -215,7 +215,7 @@ runtime::Module BuildNVPTX(Array funcs, std::string target) { llvm::SMDiagnostic err; std::unique_ptr mlib = llvm::parseIRFile(path, err, *ctx); if (mlib.get() == nullptr) { - std::string msg = err.getMessage(); + std::string msg(err.getMessage()); LOG(FATAL) << "Fail to load bitcode file " << path << "\n" << "line " << err.getLineNo() << ":" << msg; } diff --git a/src/target/llvm/llvm_module.cc b/src/target/llvm/llvm_module.cc index 30755fcfc1253..2e04920d866b6 100644 --- a/src/target/llvm/llvm_module.cc +++ b/src/target/llvm/llvm_module.cc @@ -239,7 +239,7 @@ class LLVMModuleNode final : public runtime::ModuleNode { if (mtarget != nullptr) { llvm::MDString* pstr = llvm::dyn_cast(mtarget); CHECK(pstr != nullptr); - target_ = pstr->getString(); + target_ = pstr->getString().str(); } else { std::ostringstream os; os << "llvm -target " << module_->getTargetTriple();