diff options
author | Hans Wennborg <hans@hanshq.net> | 2012-11-16 10:33:25 +0000 |
---|---|---|
committer | Hans Wennborg <hans@hanshq.net> | 2012-11-16 10:33:25 +0000 |
commit | fbeb956876573ae9ec6ddd190eb37e9174489c79 (patch) | |
tree | b62b5f9c17f75b51681ce71451fb9cadb423b9e2 /lib/VMCore | |
parent | 63a450a313a9b0a08622e97b53f5dd83f9266143 (diff) | |
download | external_llvm-fbeb956876573ae9ec6ddd190eb37e9174489c79.zip external_llvm-fbeb956876573ae9ec6ddd190eb37e9174489c79.tar.gz external_llvm-fbeb956876573ae9ec6ddd190eb37e9174489c79.tar.bz2 |
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/trunk@168147 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore')
-rw-r--r-- | lib/VMCore/Constants.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/VMCore/Constants.cpp b/lib/VMCore/Constants.cpp index eae96ef..935f6b2 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); } |