/// Stack of Module description, enough to print the module after a given
/// pass.
SmallVector<PrintModuleDesc, 2> ModuleDescStack;
- bool StoreModuleDesc = false;
};
class OptNoneInstrumentation {
}
void PrintIRInstrumentation::pushModuleDesc(StringRef PassID, Any IR) {
- assert(StoreModuleDesc);
const Module *M = unwrapModule(IR);
ModuleDescStack.emplace_back(M, getIRName(IR), PassID);
}
// Note: here we rely on a fact that we do not change modules while
// traversing the pipeline, so the latest captured module is good
// for all print operations that has not happen yet.
- if (StoreModuleDesc && shouldPrintAfterPass(PassID))
+ if (shouldPrintAfterPass(PassID))
pushModuleDesc(PassID, IR);
if (!shouldPrintBeforePass(PassID))
if (!shouldPrintAfterPass(PassID))
return;
- if (StoreModuleDesc) {
- const Module *M;
- std::string IRName;
- StringRef StoredPassID;
- std::tie(M, IRName, StoredPassID) = popModuleDesc(PassID);
- assert(StoredPassID == PassID && "mismatched PassID");
- }
+ const Module *M;
+ std::string IRName;
+ StringRef StoredPassID;
+ std::tie(M, IRName, StoredPassID) = popModuleDesc(PassID);
+ assert(StoredPassID == PassID && "mismatched PassID");
if (!shouldPrintIR(IR))
return;
- dbgs() << "*** IR Dump After " << PassID << " on " << getIRName(IR)
- << " ***\n";
+ dbgs() << "*** IR Dump After " << PassID << " on " << IRName << " ***\n";
unwrapAndPrint(dbgs(), IR);
}
void PrintIRInstrumentation::printAfterPassInvalidated(StringRef PassID) {
StringRef PassName = PIC->getPassNameForClassName(PassID);
- if (!StoreModuleDesc || !shouldPrintAfterPass(PassName))
+ if (!shouldPrintAfterPass(PassName))
return;
if (isIgnored(PassID))
// BeforePass callback is not just for printing, it also saves a Module
// for later use in AfterPassInvalidated.
- StoreModuleDesc = forcePrintModuleIR() && shouldPrintAfterSomePass();
- if (shouldPrintBeforeSomePass() || StoreModuleDesc)
+ if (shouldPrintBeforeSomePass() || shouldPrintAfterSomePass())
PIC.registerBeforeNonSkippedPassCallback(
[this](StringRef P, Any IR) { this->printBeforePass(P, IR); });
; RUN: opt < %s -disable-output \
; RUN: -passes=loop-deletion,loop-instsimplify -print-after-all 2>&1 | FileCheck %s -check-prefix=DELETED
; RUN: opt < %s -disable-output \
-; RUN: -passes=loop-deletion,loop-instsimplify -print-after-all -print-module-scope 2>&1 | FileCheck %s -check-prefix=DELETED-BUT-PRINTED
+; RUN: -passes=loop-deletion,loop-instsimplify -print-after-all -print-module-scope 2>&1 | FileCheck %s -check-prefix=DELETED
;
; SIMPLIFY: IR Dump {{.*}} LoopInstSimplifyPass
+; DELETED: IR Dump {{.*}}LoopDeletionPass {{.*}}(invalidated)
; DELETED-NOT: IR Dump {{.*}}LoopInstSimplifyPass
-; DELETED-NOT: IR Dump {{.*}}LoopDeletionPass
-; DELETED-BUT-PRINTED: IR Dump {{.*}}LoopDeletionPass {{.*}}(invalidated)
-; DELETED-BUT-PRINTED-NOT: IR Dump {{.*}}LoopInstSimplifyPass
define void @deleteme() {
entry:
; RUN: opt < %s 2>&1 -disable-output \
-; RUN: -passes=inline -print-before-all -print-after-all | FileCheck %s -check-prefix=INL
+; RUN: -passes=inline -print-before-all -print-after-all | FileCheck %s
; RUN: opt < %s 2>&1 -disable-output \
-; RUN: -passes=inline -print-before-all -print-after-all -print-module-scope | FileCheck %s -check-prefix=INL-MOD
+; RUN: -passes=inline -print-before-all -print-after-all -print-module-scope | FileCheck %s
-; INL: IR Dump Before InlinerPass on (tester, foo)
-; INL-NOT: IR Dump After {{InlinerPass}}
-; INL: IR Dump Before InlinerPass on (tester)
-; INL: IR Dump After InlinerPass on (tester)
-
-; INL-MOD: IR Dump Before InlinerPass on (tester, foo)
-; INL-MOD: IR Dump After InlinerPass on (tester, foo) (invalidated)
-; INL-MOD: IR Dump Before InlinerPass on (tester)
-; INL-MOD: IR Dump After InlinerPass on (tester)
+; CHECK: IR Dump Before InlinerPass on (tester, foo)
+; CHECK: IR Dump After InlinerPass on (tester, foo) (invalidated)
+; CHECK: IR Dump Before InlinerPass on (tester)
+; CHECK: IR Dump After InlinerPass on (tester)
define void @tester() noinline {