diff options
| author | Xin Tong <trent.xin.tong@gmail.com> | 2018-07-22 05:27:41 +0000 |
|---|---|---|
| committer | Xin Tong <trent.xin.tong@gmail.com> | 2018-07-22 05:27:41 +0000 |
| commit | 023e25ad14e529be304136b127c7be19d13dfe9b (patch) | |
| tree | 88e673b957b3d46966d1e621df87bb383c165e75 /llvm/lib/Analysis | |
| parent | cc4ad95c303daf27ba3a1815eb81b2c832383ba2 (diff) | |
| download | bcm5719-llvm-023e25ad14e529be304136b127c7be19d13dfe9b.tar.gz bcm5719-llvm-023e25ad14e529be304136b127c7be19d13dfe9b.zip | |
[ORE] Move loop invariant ORE checks outside the PM loop.
Summary:
This takes 22ms out of ~20s compiling sqlite3.c because we call it
for every unit of compilation and every pass.
Reviewers: paquette, anemet
Subscribers: mehdi_amini, llvm-commits
Differential Revision: https://reviews.llvm.org/D49586
llvm-svn: 337654
Diffstat (limited to 'llvm/lib/Analysis')
| -rw-r--r-- | llvm/lib/Analysis/CallGraphSCCPass.cpp | 8 | ||||
| -rw-r--r-- | llvm/lib/Analysis/LoopPass.cpp | 8 |
2 files changed, 12 insertions, 4 deletions
diff --git a/llvm/lib/Analysis/CallGraphSCCPass.cpp b/llvm/lib/Analysis/CallGraphSCCPass.cpp index ef61c65463f..f2211edba21 100644 --- a/llvm/lib/Analysis/CallGraphSCCPass.cpp +++ b/llvm/lib/Analysis/CallGraphSCCPass.cpp @@ -130,13 +130,17 @@ bool CGPassManager::RunPassOnSCC(Pass *P, CallGraphSCC &CurSCC, } { + unsigned InstrCount = 0; + bool EmitICRemark = M.shouldEmitInstrCountChangedRemark(); TimeRegion PassTimer(getPassTimer(CGSP)); - unsigned InstrCount = initSizeRemarkInfo(M); + if (EmitICRemark) + InstrCount = initSizeRemarkInfo(M); Changed = CGSP->runOnSCC(CurSCC); // If the pass modified the module, it may have modified the instruction // count of the module. Try emitting a remark. - emitInstrCountChangedRemark(P, M, InstrCount); + if (EmitICRemark) + emitInstrCountChangedRemark(P, M, InstrCount); } // After the CGSCCPass is done, when assertions are enabled, use diff --git a/llvm/lib/Analysis/LoopPass.cpp b/llvm/lib/Analysis/LoopPass.cpp index c5ced03cfa8..07a151ce0fc 100644 --- a/llvm/lib/Analysis/LoopPass.cpp +++ b/llvm/lib/Analysis/LoopPass.cpp @@ -193,6 +193,8 @@ bool LPPassManager::runOnFunction(Function &F) { } // Walk Loops + unsigned InstrCount = 0; + bool EmitICRemark = M.shouldEmitInstrCountChangedRemark(); while (!LQ.empty()) { CurrentLoopDeleted = false; CurrentLoop = LQ.back(); @@ -210,9 +212,11 @@ bool LPPassManager::runOnFunction(Function &F) { { PassManagerPrettyStackEntry X(P, *CurrentLoop->getHeader()); TimeRegion PassTimer(getPassTimer(P)); - unsigned InstrCount = initSizeRemarkInfo(M); + if (EmitICRemark) + InstrCount = initSizeRemarkInfo(M); Changed |= P->runOnLoop(CurrentLoop, *this); - emitInstrCountChangedRemark(P, M, InstrCount); + if (EmitICRemark) + emitInstrCountChangedRemark(P, M, InstrCount); } if (Changed) |

