cbalint13 commented on code in PR #17547:
URL: https://github.com/apache/tvm/pull/17547#discussion_r1863642432
##########
src/target/llvm/codegen_cpu.cc:
##########
@@ -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();
Review Comment:
* Could it match the original < 200 ?
llvm::DataLayout layout(module_.get()->getDataLayout());
##########
src/target/llvm/codegen_llvm.cc:
##########
@@ -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());
Review Comment:
* Could it match the original < 200
data_layout_.reset(new llvm::DataLayout(module_.get()->getDataLayout()));
##########
src/target/llvm/codegen_cpu.cc:
##########
@@ -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();
Review Comment:
* Could it match the original < 200 ?
llvm::DataLayout layout(module_.get()->getDataLayout());
##########
src/target/llvm/codegen_llvm.cc:
##########
@@ -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());
Review Comment:
* Please also address this warning:
```
src/target/llvm/codegen_llvm.cc:1019:32: warning: 'CreateGlobalStringPtr' is
deprecated: Use CreateGlobalString instead [-Wdeprecated-declarations]
1019 | llvm::Value* str = builder_->CreateGlobalStringPtr(format);
| ^~~~~~~~~~~~~~~~~~~~~
| CreateGlobalString
/usr/lib64/llvm20/include/llvm/IR/IRBuilder.h:2018:3: note:
'CreateGlobalStringPtr' has been explicitly marked deprecated here
2018 | LLVM_DEPRECATED("Use CreateGlobalString instead",
"CreateGlobalString")
| ^
```
Something like:
```
+#if TVM_LLVM_VERSION >= 200
+ llvm::Value* str = builder_->CreateGlobalString(format);
+#else
llvm::Value* str = builder_->CreateGlobalStringPtr(format);
+#endif
```
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]