Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/target/llvm/codegen_cpu.cc
Original file line number Diff line number Diff line change
Expand Up @@ -731,7 +731,11 @@ void CodeGenCPU::CreateStaticInit(const std::string& init_fname, const Stmt& bod
llvm::Value* CodeGenCPU::GetPackedFuncHandle(const std::string& fname) {
// We will store the packed function handle in global space.
// Initialize it during the first call.
#if TVM_LLVM_VERSION >= 200
llvm::DataLayout layout = module_->getDataLayout();
Comment thread
cbalint13 marked this conversation as resolved.
Outdated
#else
llvm::DataLayout layout(module_.get());
#endif
uint64_t align = layout.getTypeAllocSize(t_tvm_func_handle_);
auto it = func_handle_map_.find(fname);

Expand Down Expand Up @@ -1297,7 +1301,11 @@ void CodeGenCPU::DefineFunctionRegistry(Array<String> func_names) {
}
llvm::ArrayType* t_tvm_crt_func_ptrs =
llvm::ArrayType::get(ftype_tvm_backend_packed_c_func_->getPointerTo(), funcs.size());
#if TVM_LLVM_VERSION >= 200
llvm::DataLayout layout = module_->getDataLayout();
Comment thread
cbalint13 marked this conversation as resolved.
Outdated
#else
llvm::DataLayout layout(module_.get());
#endif

llvm::GlobalVariable* func_registry_ptrs = new llvm::GlobalVariable(
*module_, t_tvm_crt_func_ptrs, true, llvm::GlobalValue::InternalLinkage,
Expand Down
4 changes: 4 additions & 0 deletions src/target/llvm/codegen_llvm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,11 @@ void CodeGenLLVM::InitTarget() {
llvm::TargetMachine* tm = llvm_target_->GetOrCreateTargetMachine();
module_->setTargetTriple(tm->getTargetTriple().str());
module_->setDataLayout(tm->createDataLayout());
#if TVM_LLVM_VERSION >= 200
data_layout_ = std::make_unique<llvm::DataLayout>(module_->getDataLayout());
Comment thread
cbalint13 marked this conversation as resolved.
Outdated
#else
data_layout_.reset(new llvm::DataLayout(module_.get()));
#endif
if (native_vector_bits_ == 0) {
const auto& arch = tm->getTargetTriple().getArch();
if (arch == llvm::Triple::x86_64) {
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 @@ -652,7 +652,11 @@ TVM_REGISTER_GLOBAL("codegen.LLVMModuleCreate")

TVM_REGISTER_GLOBAL("target.llvm_lookup_intrinsic_id")
.set_body_typed([](std::string name) -> int64_t {
#if TVM_LLVM_VERSION >= 200
return static_cast<int64_t>(llvm::Intrinsic::lookupIntrinsicID(name));
#else
return static_cast<int64_t>(llvm::Function::lookupIntrinsicID(name));
#endif
});

TVM_REGISTER_GLOBAL("target.llvm_get_intrinsic_name").set_body_typed([](int64_t id) -> String {
Expand Down