[llvm] r259695 - Address NDEBUG-related linkage issues for Value::assertModuleIsMaterialized()

xiuli pan via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 3 20:30:16 PST 2016

Hi Hans,
I think this should be merged in release 3.8 to avoid linkage fails on release version.
Request to merge in release 3.8


-----Original Message-----
From: llvm-commits [mailto:llvm-commits-bounces at lists.llvm.org] On Behalf Of Todd Fiala via llvm-commits
Sent: Thursday, February 4, 2016 5:13 AM
To: llvm-commits at lists.llvm.org
Subject: [llvm] r259695 - Address NDEBUG-related linkage issues for Value::assertModuleIsMaterialized()

Author: tfiala
Date: Wed Feb  3 15:13:23 2016
New Revision: 259695

URL: http://llvm.org/viewvc/llvm-project?rev=259695&view=rev
Address NDEBUG-related linkage issues for Value::assertModuleIsMaterialized()

The IR/Value class had a linkage issue present when LLVM was built
as a library, and the LLVM library build time had different settings
for NDEBUG than the client of the LLVM library.  Clients could get
into a state where the LLVM lib expected
Value::assertModuleIsMaterialized() to be inline-defined in the header
but clients expected that method to be defined in the LLVM library.

See this llvm-commits thread for more details:


Modified: llvm/trunk/include/llvm/IR/Value.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/Value.h?rev=259695&r1=259694&r2=259695&view=diff
--- llvm/trunk/include/llvm/IR/Value.h (original)
+++ llvm/trunk/include/llvm/IR/Value.h Wed Feb  3 15:13:23 2016
@@ -280,11 +280,7 @@ 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.
-#ifdef NDEBUG
-  void assertModuleIsMaterialized() const {}
   void assertModuleIsMaterialized() const;
   bool use_empty() const {

Modified: llvm/trunk/lib/IR/Value.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Value.cpp?rev=259695&r1=259694&r2=259695&view=diff
--- llvm/trunk/lib/IR/Value.cpp (original)
+++ llvm/trunk/lib/IR/Value.cpp Wed Feb  3 15:13:23 2016
@@ -314,8 +314,8 @@ void Value::takeName(Value *V) {
-#ifndef NDEBUG
 void Value::assertModuleIsMaterialized() const {
+#ifndef NDEBUG
   const GlobalValue *GV = dyn_cast<GlobalValue>(this);
   if (!GV)
@@ -323,8 +323,10 @@ void Value::assertModuleIsMaterialized()
   if (!M)
+#ifndef NDEBUG
 static bool contains(SmallPtrSetImpl<ConstantExpr *> &Cache, ConstantExpr *Expr,
                      Constant *C) {
   if (!Cache.insert(Expr).second)

llvm-commits mailing list
llvm-commits at lists.llvm.org

More information about the llvm-commits mailing list