Skip to content

Commit dde6fbc

Browse files
committed
fold implem in class
1 parent ad30131 commit dde6fbc

File tree

1 file changed

+9
-13
lines changed

1 file changed

+9
-13
lines changed

llvm/lib/Transforms/Scalar/Reg2Mem.cpp

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ class RegToMemWrapperPass : public FunctionPass {
115115
public:
116116
static char ID;
117117

118-
RegToMemWrapperPass();
118+
RegToMemWrapperPass() : FunctionPass(ID) {}
119119

120120
void getAnalysisUsage(AnalysisUsage &AU) const override {
121121
AU.setPreservesAll();
@@ -127,7 +127,14 @@ class RegToMemWrapperPass : public FunctionPass {
127127
AU.addRequired<LoopInfoWrapperPass>();
128128
}
129129

130-
bool runOnFunction(Function &F) override;
130+
bool runOnFunction(Function &F) override {
131+
DominatorTree *DT = &getAnalysis<DominatorTreeWrapperPass>().getDomTree();
132+
LoopInfo *LI = &getAnalysis<LoopInfoWrapperPass>().getLoopInfo();
133+
134+
unsigned N = SplitAllCriticalEdges(F, CriticalEdgeSplittingOptions(DT, LI));
135+
bool Changed = runPass(F);
136+
return N != 0 || Changed;
137+
}
131138
};
132139

133140
FunctionPass *createRegToMemWrapperPass();
@@ -141,17 +148,6 @@ INITIALIZE_PASS_END(RegToMemWrapperPass, "reg2mem", "", true, true)
141148

142149
char RegToMemWrapperPass::ID = 0;
143150

144-
RegToMemWrapperPass::RegToMemWrapperPass() : FunctionPass(ID) {}
145-
146-
bool RegToMemWrapperPass::runOnFunction(Function &F) {
147-
DominatorTree *DT = &getAnalysis<DominatorTreeWrapperPass>().getDomTree();
148-
LoopInfo *LI = &getAnalysis<LoopInfoWrapperPass>().getLoopInfo();
149-
150-
unsigned N = SplitAllCriticalEdges(F, CriticalEdgeSplittingOptions(DT, LI));
151-
bool Changed = runPass(F);
152-
return N != 0 || Changed;
153-
}
154-
155151
FunctionPass *llvm::createRegToMemWrapperPass() {
156152
return new RegToMemWrapperPass();
157153
}

0 commit comments

Comments
 (0)