kou commented on code in PR #37867:
URL: https://github.com/apache/arrow/pull/37867#discussion_r1342181374
##########
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:
How about lower case for like others?
```suggestion
llvm::InternalizePass([&used_functions](const llvm::GlobalValue& gv)
-> bool {
return used_functions.find(gv.getName().str()) !=
used_functions.end();
```
Or can we use `variable` instead of `gv` for readability?
--
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]