MCPcopy Create free account
hub / github.com/apache/impala / PruneModule

Method PruneModule

be/src/codegen/llvm-codegen.cc:1245–1263  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1243}
1244
1245void LlvmCodeGen::PruneModule() {
1246 SCOPED_TIMER(function_prune_timer_);
1247 // Before running any other optimization passes, run the internalize pass, giving it
1248 // the names of all functions registered by AddFunctionToJit(), followed by the
1249 // global dead code elimination pass. This causes all functions not registered to be
1250 // JIT'd to be marked as internal, and any internal functions that are not used are
1251 // deleted by DCE pass. This greatly decreases compile time by removing unused code.
1252 llvm::ModuleAnalysisManager module_analysis_manager;
1253 llvm::PassBuilder pass_builder(execution_engine()->getTargetMachine());
1254 pass_builder.registerModuleAnalyses(module_analysis_manager);
1255
1256 llvm::ModulePassManager module_pass_manager;
1257 module_pass_manager.addPass(
1258 llvm::InternalizePass([this](const llvm::GlobalValue& gv) {
1259 return fns_to_jit_compile_.count(gv.getName()) > 0;
1260 }));
1261 module_pass_manager.addPass(llvm::GlobalDCEPass());
1262 module_pass_manager.run(*module_, module_analysis_manager);
1263}
1264
1265Status LlvmCodeGen::FinalizeModule(string* module_id) {
1266 DCHECK(!is_compiled_);

Callers 1

CreateObjCacheMethod · 0.80

Calls 3

getNameMethod · 0.65
countMethod · 0.45
runMethod · 0.45

Tested by 1

CreateObjCacheMethod · 0.64