summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR/LegacyPassManager.cpp
diff options
context:
space:
mode:
authorJessica Paquette <jpaquette@apple.com>2018-08-31 20:20:55 +0000
committerJessica Paquette <jpaquette@apple.com>2018-08-31 20:20:55 +0000
commit454d1032e90e7510c6902c957663b76c4ad8563a (patch)
tree2c37f83964c30f80e495ccc888ed1c664dd31e9c /llvm/lib/IR/LegacyPassManager.cpp
parent872a4c92b24d225cd781b9def6f02aa82b8a5da5 (diff)
downloadbcm5719-llvm-454d1032e90e7510c6902c957663b76c4ad8563a.tar.gz
bcm5719-llvm-454d1032e90e7510c6902c957663b76c4ad8563a.zip
[NFC] Pre-calculate module IR counts in size remarks.
Same as the previous NFC commits in the same vein. This one introduces a TODO. I'm going to change emitInstrCountChangedRemark so that it takes in a delta. Since the delta isn't necessary yet, it's not there. For now, this means that we're calculating the size of the module twice. Just done separately to keep the patches small. 4/6 llvm-svn: 341248
Diffstat (limited to 'llvm/lib/IR/LegacyPassManager.cpp')
-rw-r--r--llvm/lib/IR/LegacyPassManager.cpp23
1 files changed, 18 insertions, 5 deletions
diff --git a/llvm/lib/IR/LegacyPassManager.cpp b/llvm/lib/IR/LegacyPassManager.cpp
index efaa66f25ff..4e1d1f5c539 100644
--- a/llvm/lib/IR/LegacyPassManager.cpp
+++ b/llvm/lib/IR/LegacyPassManager.cpp
@@ -1622,8 +1622,14 @@ MPPassManager::runOnModule(Module &M) {
for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index)
Changed |= getContainedPass(Index)->doInitialization(M);
- unsigned InstrCount = 0;
+ unsigned InstrCount, ModuleCount = 0;
bool EmitICRemark = M.shouldEmitInstrCountChangedRemark();
+ // Collect the initial size of the module.
+ if (EmitICRemark) {
+ InstrCount = initSizeRemarkInfo(M);
+ ModuleCount = InstrCount;
+ }
+
for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index) {
ModulePass *MP = getContainedPass(Index);
bool LocalChanged = false;
@@ -1637,11 +1643,18 @@ MPPassManager::runOnModule(Module &M) {
PassManagerPrettyStackEntry X(MP, M);
TimeRegion PassTimer(getPassTimer(MP));
- if (EmitICRemark)
- InstrCount = initSizeRemarkInfo(M);
LocalChanged |= MP->runOnModule(M);
- if (EmitICRemark)
- emitInstrCountChangedRemark(MP, M, InstrCount);
+ if (EmitICRemark) {
+ // Update the size of the module.
+ // TODO: emitInstrCountChangedRemark should take in a delta between
+ // the old count and new count. Right now, we're calculating this
+ // twice.
+ ModuleCount = M.getInstructionCount();
+ if (ModuleCount != InstrCount) {
+ emitInstrCountChangedRemark(MP, M, InstrCount);
+ ModuleCount = InstrCount;
+ }
+ }
}
Changed |= LocalChanged;
OpenPOWER on IntegriCloud