Skip to content

Commit

Permalink
fix opt
Browse files Browse the repository at this point in the history
  • Loading branch information
2over12 committed Oct 3, 2023
1 parent befdfcb commit 9844784
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions lib/BC/Optimizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,18 @@ void OptimizeModule(const remill::Arch *arch, llvm::Module *module,
llvm::LoopAnalysisManager lam;
llvm::CGSCCAnalysisManager cam;


llvm::PassBuilder pb;
llvm::PipelineTuningOptions opts;
opts.InlinerThreshold = 250;
llvm::PassBuilder pb(nullptr, opts);

pb.registerModuleAnalyses(mam);
pb.registerFunctionAnalyses(fam);
pb.registerLoopAnalyses(lam);
pb.registerCGSCCAnalyses(cam);
pb.crossRegisterProxies(lam, fam, cam, mam);
auto fpm = pb.buildFunctionSimplificationPipeline(
llvm::OptimizationLevel::O3, llvm::ThinOrFullLTOPhase::None);
llvm::OptimizationLevel::O0, llvm::ThinOrFullLTOPhase::None);

llvm::Function *func = nullptr;
while (nullptr != (func = generator())) {
fpm.run(*func, fam);
Expand All @@ -86,14 +88,16 @@ void OptimizeBareModule(llvm::Module *module, OptimizationGuide guide) {
llvm::CGSCCAnalysisManager cam;


llvm::PassBuilder pb;
llvm::PipelineTuningOptions opts;
opts.InlinerThreshold = 250;
llvm::PassBuilder pb(nullptr, opts);

pb.registerModuleAnalyses(mam);
pb.registerFunctionAnalyses(fam);
pb.registerLoopAnalyses(lam);
pb.registerCGSCCAnalyses(cam);
pb.crossRegisterProxies(lam, fam, cam, mam);
auto mpm = pb.buildPerModuleDefaultPipeline(llvm::OptimizationLevel::O3);
auto mpm = pb.buildPerModuleDefaultPipeline(llvm::OptimizationLevel::O0);
mpm.run(*module, mam);


Expand Down

0 comments on commit 9844784

Please sign in to comment.