[llvm] r341252 - [NFC] Check if P is a pass manager on entry to emitInstrCountChangedRemark
Jessica Paquette via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 31 13:51:54 PDT 2018
Author: paquette
Date: Fri Aug 31 13:51:54 2018
New Revision: 341252
URL: http://llvm.org/viewvc/llvm-project?rev=341252&view=rev
Log:
[NFC] Check if P is a pass manager on entry to emitInstrCountChangedRemark
There's no point in finding a function to use for remark output when we're
not going to emit anything.
Modified:
llvm/trunk/lib/IR/LegacyPassManager.cpp
Modified: llvm/trunk/lib/IR/LegacyPassManager.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/LegacyPassManager.cpp?rev=341252&r1=341251&r2=341252&view=diff
==============================================================================
--- llvm/trunk/lib/IR/LegacyPassManager.cpp (original)
+++ llvm/trunk/lib/IR/LegacyPassManager.cpp Fri Aug 31 13:51:54 2018
@@ -144,6 +144,13 @@ unsigned PMDataManager::initSizeRemarkIn
void PMDataManager::emitInstrCountChangedRemark(Pass *P, Module &M,
int64_t Delta,
unsigned CountBefore) {
+ // If it's a pass manager, don't emit a remark. (This hinges on the assumption
+ // that the only passes that return non-null with getAsPMDataManager are pass
+ // managers.) The reason we have to do this is to avoid emitting remarks for
+ // CGSCC passes.
+ if (P->getAsPMDataManager())
+ return;
+
// We need a function containing at least one basic block in order to output
// remarks. Since it's possible that the first function in the module doesn't
// actually contain a basic block, we have to go and find one that's suitable
@@ -157,13 +164,6 @@ void PMDataManager::emitInstrCountChange
// We found a function containing at least one basic block.
Function *F = &*It;
-
- // If it's a pass manager, don't emit a remark. (This hinges on the assumption
- // that the only passes that return non-null with getAsPMDataManager are pass
- // managers.) The reason we have to do this is to avoid emitting remarks for
- // CGSCC passes.
- if (P->getAsPMDataManager())
- return;
int64_t CountAfter = static_cast<int64_t>(CountBefore) + Delta;
BasicBlock &BB = *F->begin();
OptimizationRemarkAnalysis R("size-info", "IRSizeChange",
More information about the llvm-commits
mailing list