summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorHans Wennborg <hans@hanshq.net>2012-11-16 20:21:42 +0000
committerHans Wennborg <hans@hanshq.net>2012-11-16 20:21:42 +0000
commit1f7de172b4959bd8001d1bf507d068d96d47c045 (patch)
tree21ce5bb933443016d33952547f9ce686ad68deba /lib
parent21863332ca402263c518840742aee2b126d53007 (diff)
downloadllvm-1f7de172b4959bd8001d1bf507d068d96d47c045.tar.gz
llvm-1f7de172b4959bd8001d1bf507d068d96d47c045.tar.bz2
llvm-1f7de172b4959bd8001d1bf507d068d96d47c045.tar.xz
Merge r168147 from trunk:
Constant::IsThreadDependent(): Use dyn_cast<Constant> instead of cast It turns out that the operands of a Constant are not always themselves Constant. For example, one of the operands of BlockAddress is BasicBlock, which is not a Constant. This should fix the dragonegg-x86_64-linux-gcc-4.6-test build which broke in r168037. git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_32@168193 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/VMCore/Constants.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/VMCore/Constants.cpp b/lib/VMCore/Constants.cpp
index 041fe2eb4f..edd6a73b08 100644
--- a/lib/VMCore/Constants.cpp
+++ b/lib/VMCore/Constants.cpp
@@ -261,7 +261,9 @@ bool Constant::isThreadDependent() const {
}
for (unsigned I = 0, E = C->getNumOperands(); I != E; ++I) {
- const Constant *D = cast<Constant>(C->getOperand(I));
+ const Constant *D = dyn_cast<Constant>(C->getOperand(I));
+ if (!D)
+ continue;
if (Visited.insert(D))
WorkList.push_back(D);
}