aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/Value.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2016-01-15 19:00:20 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2016-01-15 19:00:20 +0000
commit257a35368ff898d9f6f61ca86fa8ca5cc942385c (patch)
tree0baac849283f62ce74bb5c3ceac29bf25212d4d1 /llvm/lib/IR/Value.cpp
parentd4a0d188996d9bd0293b80826bc6fbc2a34d5d5b (diff)
downloadllvm-257a35368ff898d9f6f61ca86fa8ca5cc942385c.zip
llvm-257a35368ff898d9f6f61ca86fa8ca5cc942385c.tar.gz
llvm-257a35368ff898d9f6f61ca86fa8ca5cc942385c.tar.bz2
Bring back "Assert that we have all use/users in the getters."
This reverts commit r257751, bringing back r256105. The problem the assert found was fixed in r257915. Original commit message: Assert that we have all use/users in the getters. An error that is pretty easy to make is to use the lazy bitcode reader and then do something like if (V.use_empty()) The problem is that uses in unmaterialized functions are not accounted for. This patch adds asserts that all uses are known. llvm-svn: 257920
Diffstat (limited to 'llvm/lib/IR/Value.cpp')
-rw-r--r--llvm/lib/IR/Value.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/llvm/lib/IR/Value.cpp b/llvm/lib/IR/Value.cpp
index 925f205..eb9deb6 100644
--- a/llvm/lib/IR/Value.cpp
+++ b/llvm/lib/IR/Value.cpp
@@ -314,6 +314,16 @@ void Value::takeName(Value *V) {
}
#ifndef NDEBUG
+void Value::assertModuleIsMaterialized() const {
+ const GlobalValue *GV = dyn_cast<GlobalValue>(this);
+ if (!GV)
+ return;
+ const Module *M = GV->getParent();
+ if (!M)
+ return;
+ assert(M->isMaterialized());
+}
+
static bool contains(SmallPtrSetImpl<ConstantExpr *> &Cache, ConstantExpr *Expr,
Constant *C) {
if (!Cache.insert(Expr).second)