@@ -137,17 +137,11 @@ bool PMDataManager::isPassDebuggingExecutionsOrMore() const {
137
137
138
138
unsigned PMDataManager::initSizeRemarkInfo (Module &M) {
139
139
// Only calculate getInstructionCount if the size-info remark is requested.
140
- if (M.getContext ().getDiagHandlerPtr ()->isAnalysisRemarkEnabled (" size-info" ))
141
- return M.getInstructionCount ();
142
- return 0 ;
140
+ return M.getInstructionCount ();
143
141
}
144
142
145
143
void PMDataManager::emitInstrCountChangedRemark (Pass *P, Module &M,
146
144
unsigned CountBefore) {
147
- // Did the user request the remark? If not, quit.
148
- if (!M.getContext ().getDiagHandlerPtr ()->isAnalysisRemarkEnabled (" size-info" ))
149
- return ;
150
-
151
145
// We need a function containing at least one basic block in order to output
152
146
// remarks. Since it's possible that the first function in the module doesn't
153
147
// actually contain a basic block, we have to go and find one that's suitable
@@ -1349,6 +1343,8 @@ bool BBPassManager::runOnFunction(Function &F) {
1349
1343
bool Changed = doInitialization (F);
1350
1344
Module &M = *F.getParent ();
1351
1345
1346
+ unsigned InstrCount = 0 ;
1347
+ bool EmitICRemark = M.shouldEmitInstrCountChangedRemark ();
1352
1348
for (BasicBlock &BB : F)
1353
1349
for (unsigned Index = 0 ; Index < getNumContainedPasses (); ++Index) {
1354
1350
BasicBlockPass *BP = getContainedPass (Index);
@@ -1363,9 +1359,11 @@ bool BBPassManager::runOnFunction(Function &F) {
1363
1359
// If the pass crashes, remember this.
1364
1360
PassManagerPrettyStackEntry X (BP, BB);
1365
1361
TimeRegion PassTimer (getPassTimer (BP));
1366
- unsigned InstrCount = initSizeRemarkInfo (M);
1362
+ if (EmitICRemark)
1363
+ InstrCount = initSizeRemarkInfo (M);
1367
1364
LocalChanged |= BP->runOnBasicBlock (BB);
1368
- emitInstrCountChangedRemark (BP, M, InstrCount);
1365
+ if (EmitICRemark)
1366
+ emitInstrCountChangedRemark (BP, M, InstrCount);
1369
1367
}
1370
1368
1371
1369
Changed |= LocalChanged;
@@ -1569,6 +1567,8 @@ bool FPPassManager::runOnFunction(Function &F) {
1569
1567
// Collect inherited analysis from Module level pass manager.
1570
1568
populateInheritedAnalysis (TPM->activeStack );
1571
1569
1570
+ unsigned InstrCount = 0 ;
1571
+ bool EmitICRemark = M.shouldEmitInstrCountChangedRemark ();
1572
1572
for (unsigned Index = 0 ; Index < getNumContainedPasses (); ++Index) {
1573
1573
FunctionPass *FP = getContainedPass (Index);
1574
1574
bool LocalChanged = false ;
@@ -1581,9 +1581,11 @@ bool FPPassManager::runOnFunction(Function &F) {
1581
1581
{
1582
1582
PassManagerPrettyStackEntry X (FP, F);
1583
1583
TimeRegion PassTimer (getPassTimer (FP));
1584
- unsigned InstrCount = initSizeRemarkInfo (M);
1584
+ if (EmitICRemark)
1585
+ InstrCount = initSizeRemarkInfo (M);
1585
1586
LocalChanged |= FP->runOnFunction (F);
1586
- emitInstrCountChangedRemark (FP, M, InstrCount);
1587
+ if (EmitICRemark)
1588
+ emitInstrCountChangedRemark (FP, M, InstrCount);
1587
1589
}
1588
1590
1589
1591
Changed |= LocalChanged;
@@ -1647,6 +1649,8 @@ MPPassManager::runOnModule(Module &M) {
1647
1649
for (unsigned Index = 0 ; Index < getNumContainedPasses (); ++Index)
1648
1650
Changed |= getContainedPass (Index)->doInitialization (M);
1649
1651
1652
+ unsigned InstrCount = 0 ;
1653
+ bool EmitICRemark = M.shouldEmitInstrCountChangedRemark ();
1650
1654
for (unsigned Index = 0 ; Index < getNumContainedPasses (); ++Index) {
1651
1655
ModulePass *MP = getContainedPass (Index);
1652
1656
bool LocalChanged = false ;
@@ -1660,9 +1664,11 @@ MPPassManager::runOnModule(Module &M) {
1660
1664
PassManagerPrettyStackEntry X (MP, M);
1661
1665
TimeRegion PassTimer (getPassTimer (MP));
1662
1666
1663
- unsigned InstrCount = initSizeRemarkInfo (M);
1667
+ if (EmitICRemark)
1668
+ InstrCount = initSizeRemarkInfo (M);
1664
1669
LocalChanged |= MP->runOnModule (M);
1665
- emitInstrCountChangedRemark (MP, M, InstrCount);
1670
+ if (EmitICRemark)
1671
+ emitInstrCountChangedRemark (MP, M, InstrCount);
1666
1672
}
1667
1673
1668
1674
Changed |= LocalChanged;
0 commit comments