kou commented on code in PR #37867:
URL: https://github.com/apache/arrow/pull/37867#discussion_r1343524120
##########
cpp/src/gandiva/engine.cc:
##########
@@ -268,49 +283,104 @@ Status Engine::LoadPreCompiledIR() {
// a pass for dead code elimination.
Status Engine::RemoveUnusedFunctions() {
// Setup an optimiser pipeline
- std::unique_ptr<llvm::legacy::PassManager> pass_manager(
- new llvm::legacy::PassManager());
+ llvm::PassBuilder pass_builder;
+ llvm::ModuleAnalysisManager module_am;
+
+ pass_builder.registerModuleAnalyses(module_am);
+ llvm::ModulePassManager module_pm;
std::unordered_set<std::string> used_functions;
used_functions.insert(functions_to_compile_.begin(),
functions_to_compile_.end());
- pass_manager->add(
- llvm::createInternalizePass([&used_functions](const llvm::GlobalValue&
func) {
- return (used_functions.find(func.getName().str()) !=
used_functions.end());
+ module_pm.addPass(
+ llvm::InternalizePass([&used_functions](const llvm::GlobalValue& GV) ->
bool {
+ return used_functions.find(GV.getName().str()) != used_functions.end();
Review Comment:
I'll use `variable` and merge this to fix CI failures for now:
```suggestion
llvm::InternalizePass([&used_functions](const llvm::GlobalValue&
variable) -> bool {
return used_functions.find(variable.getName().str()) !=
used_functions.end();
```
We can improve this later in a follow-up PR if it's need.
--
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]