From 9a23c5592083384aea3494882170488e30138f36 Mon Sep 17 00:00:00 2001 From: Jessica Paquette Date: Fri, 31 Aug 2018 20:20:57 +0000 Subject: [NFC] Pass the instruction delta to emitInstrCountChangedRemark Instead of counting the size of the entire module every time we run a pass, pass along a delta instead and use that to emit the remark. This means we only have to use (on average) smaller IR units to calculate instruction counts. E.g, in a BB pass, we only need to look at the delta of the BB instead of the delta of the entire module. 6/6 (This improved compile time for size remarks on sqlite3 + O2 significantly) llvm-svn: 341250 --- llvm/lib/Analysis/CallGraphSCCPass.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'llvm/lib/Analysis/CallGraphSCCPass.cpp') diff --git a/llvm/lib/Analysis/CallGraphSCCPass.cpp b/llvm/lib/Analysis/CallGraphSCCPass.cpp index d090b5afd2e..24dbda05f4b 100644 --- a/llvm/lib/Analysis/CallGraphSCCPass.cpp +++ b/llvm/lib/Analysis/CallGraphSCCPass.cpp @@ -124,7 +124,7 @@ bool CGPassManager::RunPassOnSCC(Pass *P, CallGraphSCC &CurSCC, Module &M = CG.getModule(); if (!PM) { - CallGraphSCCPass *CGSP = (CallGraphSCCPass*)P; + CallGraphSCCPass *CGSP = (CallGraphSCCPass *)P; if (!CallGraphUpToDate) { DevirtualizedCall |= RefreshCallGraph(CurSCC, CG, false); CallGraphUpToDate = true; @@ -140,13 +140,13 @@ bool CGPassManager::RunPassOnSCC(Pass *P, CallGraphSCC &CurSCC, 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); + int64_t Delta = + static_cast(SCCCount) - static_cast(InstrCount); + emitInstrCountChangedRemark(P, M, Delta, InstrCount); InstrCount = SCCCount; } } -- cgit v1.2.3