From 736423af53d707e097a174c3a91b75132b8dc6b1 Mon Sep 17 00:00:00 2001 From: Jon Roelofs Date: Mon, 27 Jul 2020 12:34:36 -0600 Subject: [PATCH] [OldPM] Print out a bit more when passes lie about changing IR https://reviews.llvm.org/D84686 --- llvm/lib/IR/LegacyPassManager.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/llvm/lib/IR/LegacyPassManager.cpp b/llvm/lib/IR/LegacyPassManager.cpp index c01696e..96434ae 100644 --- a/llvm/lib/IR/LegacyPassManager.cpp +++ b/llvm/lib/IR/LegacyPassManager.cpp @@ -1586,9 +1586,12 @@ bool FPPassManager::runOnFunction(Function &F) { #endif LocalChanged |= FP->runOnFunction(F); -#ifdef EXPENSIVE_CHECKS - assert((LocalChanged || (RefHash == StructuralHash(F))) && - "Pass modifies its input and doesn't report it."); +#if defined(EXPENSIVE_CHECKS) && !defined(NDEBUG) + if (!LocalChanged && (RefHash != StructuralHash(F))) { + llvm::errs() << "Pass modifies its input and doesn't report it: " + << FP->getPassName() << "\n"; + assert(false && "Pass modifies its input and doesn't report it."); + } #endif if (EmitICRemark) { -- 2.7.4