[PATCH] D28191: [IR] Don't call assertModuleIsMaterialized in release builds
Craig Topper via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 30 22:54:07 PST 2016
craig.topper created this revision.
craig.topper added a reviewer: rafael.
craig.topper added a subscriber: llvm-commits.
To fix a release vs debug build linking error, r259695 made the body of assertModuleIsMaterialized empty if Value.cpp gets compiled in a release build. This way any code compiled as a debug build can still link against a release version of the function.
This patch takes this a step farther and removes all calls to it from Value.h in any code that includes it in a relase build.
This shrinks the opt binary on my macbook build by 17240 bytes.
https://reviews.llvm.org/D28191
Files:
include/llvm/IR/Value.h
Index: include/llvm/IR/Value.h
===================================================================
--- include/llvm/IR/Value.h
+++ include/llvm/IR/Value.h
@@ -297,7 +297,9 @@
void assertModuleIsMaterialized() const;
bool use_empty() const {
+#ifndef NDEBUG
assertModuleIsMaterialized();
+#endif
return UseList == nullptr;
}
@@ -308,11 +310,15 @@
return const_use_iterator(UseList);
}
use_iterator use_begin() {
+#ifndef NDEBUG
assertModuleIsMaterialized();
+#endif
return materialized_use_begin();
}
const_use_iterator use_begin() const {
+#ifndef NDEBUG
assertModuleIsMaterialized();
+#endif
return materialized_use_begin();
}
use_iterator use_end() { return use_iterator(); }
@@ -324,16 +330,22 @@
return make_range(materialized_use_begin(), use_end());
}
iterator_range<use_iterator> uses() {
+#ifndef NDEBUG
assertModuleIsMaterialized();
+#endif
return materialized_uses();
}
iterator_range<const_use_iterator> uses() const {
+#ifndef NDEBUG
assertModuleIsMaterialized();
+#endif
return materialized_uses();
}
bool user_empty() const {
+#ifndef NDEBUG
assertModuleIsMaterialized();
+#endif
return UseList == nullptr;
}
@@ -344,21 +356,29 @@
return const_user_iterator(UseList);
}
user_iterator user_begin() {
+#ifndef NDEBUG
assertModuleIsMaterialized();
+#endif
return materialized_user_begin();
}
const_user_iterator user_begin() const {
+#ifndef NDEBUG
assertModuleIsMaterialized();
+#endif
return materialized_user_begin();
}
user_iterator user_end() { return user_iterator(); }
const_user_iterator user_end() const { return const_user_iterator(); }
User *user_back() {
+#ifndef NDEBUG
assertModuleIsMaterialized();
+#endif
return *materialized_user_begin();
}
const User *user_back() const {
+#ifndef NDEBUG
assertModuleIsMaterialized();
+#endif
return *materialized_user_begin();
}
iterator_range<user_iterator> materialized_users() {
@@ -368,11 +388,15 @@
return make_range(materialized_user_begin(), user_end());
}
iterator_range<user_iterator> users() {
+#ifndef NDEBUG
assertModuleIsMaterialized();
+#endif
return materialized_users();
}
iterator_range<const_user_iterator> users() const {
+#ifndef NDEBUG
assertModuleIsMaterialized();
+#endif
return materialized_users();
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D28191.82756.patch
Type: text/x-patch
Size: 2438 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161231/71605e32/attachment.bin>
More information about the llvm-commits
mailing list