[llvm] r341249 - [NFC] Pre-calculate SCC IR counts in size remarks.
Jessica Paquette via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 31 13:20:56 PDT 2018
Author: paquette
Date: Fri Aug 31 13:20:56 2018
New Revision: 341249
URL: http://llvm.org/viewvc/llvm-project?rev=341249&view=rev
Log:
[NFC] Pre-calculate SCC IR counts in size remarks.
Same vein as the previous commits. Pre-calculate the size of
the module and use that to decide if we're going to emit a
remark.
This one comes with a FIXME and TODO. First off, CallGraphSCC
and CallGraphNode don't have a getInstructionCount function. So,
for now, we do the same thing as in a module pass.
Second off, we're not really saving anything here yet, because
as before, I need to change emitInstrCountChangedRemark to take
in a delta. Keeping the patches small though, so that's coming up
next.
5/6
Modified:
llvm/trunk/lib/Analysis/CallGraphSCCPass.cpp
Modified: llvm/trunk/lib/Analysis/CallGraphSCCPass.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/CallGraphSCCPass.cpp?rev=341249&r1=341248&r2=341249&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/CallGraphSCCPass.cpp (original)
+++ llvm/trunk/lib/Analysis/CallGraphSCCPass.cpp Fri Aug 31 13:20:56 2018
@@ -131,17 +131,25 @@ bool CGPassManager::RunPassOnSCC(Pass *P
}
{
- unsigned InstrCount = 0;
+ unsigned InstrCount, SCCCount = 0;
bool EmitICRemark = M.shouldEmitInstrCountChangedRemark();
TimeRegion PassTimer(getPassTimer(CGSP));
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.
- if (EmitICRemark)
- emitInstrCountChangedRemark(P, M, InstrCount);
+ if (EmitICRemark) {
+ // FIXME: Add getInstructionCount to CallGraphSCC.
+ // TODO: emitInstrCountChangedRemark should take in the delta between
+ // SCCount and InstrCount.
+ SCCCount = M.getInstructionCount();
+ // Is there a difference in the number of instructions in the module?
+ if (SCCCount != InstrCount) {
+ // Yep. Emit a remark and update InstrCount.
+ emitInstrCountChangedRemark(P, M, InstrCount);
+ InstrCount = SCCCount;
+ }
+ }
}
// After the CGSCCPass is done, when assertions are enabled, use
More information about the llvm-commits
mailing list