[OldPM] Print out a bit more when passes lie about changing IR
authorJon Roelofs <jonathan_roelofs@apple.com>
Mon, 27 Jul 2020 18:34:36 +0000 (12:34 -0600)
committerJon Roelofs <jonathan_roelofs@apple.com>
Tue, 28 Jul 2020 16:01:24 +0000 (10:01 -0600)
https://reviews.llvm.org/D84686

llvm/lib/IR/LegacyPassManager.cpp

index c01696e..96434ae 100644 (file)
@@ -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) {