summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-11-01 18:11:50 +0000
committerChris Lattner <sabre@nondot.org>2009-11-01 18:11:50 +0000
commit253bc77513c9e7f334ea8c9f95d072a5cf97cd14 (patch)
tree2a57de066fdcc83aa0de6d78f07d635f3725746a /llvm/lib
parent5897e097a606a8ce5f6eb54b72fce2baab09eaa1 (diff)
downloadbcm5719-llvm-253bc77513c9e7f334ea8c9f95d072a5cf97cd14.tar.gz
bcm5719-llvm-253bc77513c9e7f334ea8c9f95d072a5cf97cd14.zip
the verifier shouldn't modify the IR.
llvm-svn: 85722
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/VMCore/Constants.cpp15
-rw-r--r--llvm/lib/VMCore/Globals.cpp7
-rw-r--r--llvm/lib/VMCore/Verifier.cpp3
3 files changed, 16 insertions, 9 deletions
diff --git a/llvm/lib/VMCore/Constants.cpp b/llvm/lib/VMCore/Constants.cpp
index fe4f90af06d..e2e5396da5f 100644
--- a/llvm/lib/VMCore/Constants.cpp
+++ b/llvm/lib/VMCore/Constants.cpp
@@ -160,6 +160,21 @@ bool Constant::canTrap() const {
}
}
+/// isConstantUsed - Return true if the constant has users other than constant
+/// exprs and other dangling things.
+bool Constant::isConstantUsed() const {
+ for (use_const_iterator UI = use_begin(), E = use_end(); UI != E; ++UI) {
+ const Constant *UC = dyn_cast<Constant>(*UI);
+ if (UC == 0 || isa<GlobalValue>(UC))
+ return true;
+
+ if (UC->isConstantUsed())
+ return true;
+ }
+ return false;
+}
+
+
/// getRelocationInfo - This method classifies the entry according to
/// whether or not it may generate a relocation entry. This must be
diff --git a/llvm/lib/VMCore/Globals.cpp b/llvm/lib/VMCore/Globals.cpp
index 763fc721e09..03ceecb6f1a 100644
--- a/llvm/lib/VMCore/Globals.cpp
+++ b/llvm/lib/VMCore/Globals.cpp
@@ -75,13 +75,6 @@ void GlobalValue::removeDeadConstantUsers() const {
}
}
-/// removeDeadBlockAddress - If there is a blockaddress node for this basic
-/// block, try to remove it and any dead constant users of it.
-void BasicBlock::removeDeadBlockAddress() {
- if (!hasAddressTaken()) return;
- removeDeadUsersOfConstant(BlockAddress::get(this));
-}
-
/// Override destroyConstant to make sure it doesn't get called on
/// GlobalValue's because they shouldn't be treated like other constants.
diff --git a/llvm/lib/VMCore/Verifier.cpp b/llvm/lib/VMCore/Verifier.cpp
index 6b10d69ac5e..5990e481686 100644
--- a/llvm/lib/VMCore/Verifier.cpp
+++ b/llvm/lib/VMCore/Verifier.cpp
@@ -661,8 +661,7 @@ void Verifier::visitFunction(Function &F) {
// The address of the entry block cannot be taken, unless it is dead.
if (Entry->hasAddressTaken()) {
- Entry->removeDeadBlockAddress();
- Assert1(!Entry->hasAddressTaken(),
+ Assert1(!BlockAddress::get(Entry)->isConstantUsed(),
"blockaddress may not be used with the entry block!", Entry);
}
}
OpenPOWER on IntegriCloud