[PATCH] D28191: [IR] Don't call assertModuleIsMaterialized in release builds

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 12 00:22:33 PST 2017


craig.topper updated this revision to Diff 84081.
craig.topper added a comment.

Make the patch less intrusive by renaming the existing method to Impl and putting a inline method around a call to contain the #ifndefs.


https://reviews.llvm.org/D28191

Files:
  include/llvm/IR/Value.h
  lib/IR/Value.cpp


Index: lib/IR/Value.cpp
===================================================================
--- lib/IR/Value.cpp
+++ lib/IR/Value.cpp
@@ -320,7 +320,7 @@
     ST->reinsertValue(this);
 }
 
-void Value::assertModuleIsMaterialized() const {
+void Value::assertModuleIsMaterializedImpl() const {
 #ifndef NDEBUG
   const GlobalValue *GV = dyn_cast<GlobalValue>(this);
   if (!GV)
Index: include/llvm/IR/Value.h
===================================================================
--- include/llvm/IR/Value.h
+++ include/llvm/IR/Value.h
@@ -294,7 +294,15 @@
   // when using them since you might not get all uses.
   // The methods that don't start with materialized_ assert that modules is
   // fully materialized.
-  void assertModuleIsMaterialized() const;
+  void assertModuleIsMaterializedImpl() const;
+  // This indirection exists so we can keep assertModuleIsMaterializedImpl()
+  // around in release builds of Value.cpp to be linked with other code built
+  // in debug mode. But this avoids calling it in any of the release built code.
+  void assertModuleIsMaterialized() const {
+#ifndef NDEBUG
+    assertModuleIsMaterializedImpl();
+#endif
+  }
 
   bool use_empty() const {
     assertModuleIsMaterialized();


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D28191.84081.patch
Type: text/x-patch
Size: 1221 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170112/59284034/attachment.bin>


More information about the llvm-commits mailing list