diff options
-rw-r--r-- | llvm/include/llvm/IR/Value.h | 10 | ||||
-rw-r--r-- | llvm/lib/IR/Value.cpp | 2 |
2 files changed, 10 insertions, 2 deletions
diff --git a/llvm/include/llvm/IR/Value.h b/llvm/include/llvm/IR/Value.h index bdafbbf58cc..9c91f4e07e3 100644 --- a/llvm/include/llvm/IR/Value.h +++ b/llvm/include/llvm/IR/Value.h @@ -294,7 +294,15 @@ public: // 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(); diff --git a/llvm/lib/IR/Value.cpp b/llvm/lib/IR/Value.cpp index 91a999b5800..d86d7fc1164 100644 --- a/llvm/lib/IR/Value.cpp +++ b/llvm/lib/IR/Value.cpp @@ -320,7 +320,7 @@ void Value::takeName(Value *V) { ST->reinsertValue(this); } -void Value::assertModuleIsMaterialized() const { +void Value::assertModuleIsMaterializedImpl() const { #ifndef NDEBUG const GlobalValue *GV = dyn_cast<GlobalValue>(this); if (!GV) |