[llvm] ad9c284 - [Attributor][NFC] Run the verifier only on functions and under EXPENSIVE_CHECKS

Johannes Doerfert via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 15 22:57:37 PDT 2020


Author: Johannes Doerfert
Date: 2020-04-16T00:55:33-05:00
New Revision: ad9c284cc3186f9ca603b1a99a0723b45a07ba09

URL: https://github.com/llvm/llvm-project/commit/ad9c284cc3186f9ca603b1a99a0723b45a07ba09
DIFF: https://github.com/llvm/llvm-project/commit/ad9c284cc3186f9ca603b1a99a0723b45a07ba09.diff

LOG: [Attributor][NFC] Run the verifier only on functions and under EXPENSIVE_CHECKS

Running the verifier is expensive so we want to avoid it even in runs
that enable assertions. As we move closer to enabling the Attributor
this code will be executed by some buildbots but not cause overhead for
most people.

Added: 
    

Modified: 
    llvm/lib/Transforms/IPO/Attributor.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/IPO/Attributor.cpp b/llvm/lib/Transforms/IPO/Attributor.cpp
index 647518522c36..4cf2812d0dcc 100644
--- a/llvm/lib/Transforms/IPO/Attributor.cpp
+++ b/llvm/lib/Transforms/IPO/Attributor.cpp
@@ -1248,6 +1248,14 @@ ChangeStatus Attributor::run() {
                      "specified iterations!");
   }
 
+#ifdef EXPENSIVE_CHECKS
+  for (Function *F : Functions) {
+    if (ToBeDeletedFunctions.count(F))
+      continue;
+    assert(!verifyFunction(*F, &errs()) && "Module verification failed!");
+  }
+#endif
+
   return ManifestChange;
 }
 
@@ -1982,10 +1990,7 @@ static bool runAttributorOnFunctions(InformationCache &InfoCache,
     A.identifyDefaultAbstractAttributes(*F);
   }
 
-  Module &M = *Functions.front()->getParent();
-  (void)M;
   ChangeStatus Changed = A.run();
-  assert(!verifyModule(M, &errs()) && "Module verification failed!");
   LLVM_DEBUG(dbgs() << "[Attributor] Done with " << Functions.size()
                     << " functions, result: " << Changed << ".\n");
   return Changed == ChangeStatus::CHANGED;


        


More information about the llvm-commits mailing list