Skip to content

Commit

Permalink
[EVM] Add merge identical bb pass to opt pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
akiramenai committed Nov 1, 2024
1 parent 022a80b commit fe0f610
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions llvm/lib/Target/EVM/EVMTargetMachine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include "llvm/MC/TargetRegistry.h"
#include "llvm/Passes/PassBuilder.h"
#include "llvm/Transforms/IPO/GlobalDCE.h"
#include "llvm/Transforms/Scalar/MergeIdenticalBB.h"
#include "llvm/Transforms/Utils.h"

using namespace llvm;
Expand Down Expand Up @@ -115,6 +116,11 @@ void EVMTargetMachine::registerPassBuilderCallbacks(PassBuilder &PB) {
PM.addPass(GlobalDCEPass());
PM.addPass(createModuleToFunctionPassAdaptor(EVMAllocaHoistingPass()));
});
PB.registerScalarOptimizerLateEPCallback(
[](FunctionPassManager &PM, OptimizationLevel Level) {
if (Level.getSizeLevel() || Level.getSpeedupLevel() > 1)
PM.addPass(MergeIdenticalBBPass());
});
}

namespace {
Expand Down

0 comments on commit fe0f610

Please sign in to comment.