mirror of
https://github.com/RPCS3/llvm.git
synced 2025-01-29 14:42:01 +00:00
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
This commit is contained in:
parent
63a450a313
commit
fbeb956876
@ -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);
|
||||
}
|
||||
|
20
test/Transforms/GlobalOpt/blockaddress.ll
Normal file
20
test/Transforms/GlobalOpt/blockaddress.ll
Normal file
@ -0,0 +1,20 @@
|
||||
; RUN: opt < %s -globalopt -S | FileCheck %s
|
||||
|
||||
@x = internal global i8* zeroinitializer
|
||||
|
||||
define void @f() {
|
||||
; CHECK: @f
|
||||
|
||||
; Check that we don't hit an assert in Constant::IsThreadDependent()
|
||||
; when storing this blockaddress into a global.
|
||||
|
||||
store i8* blockaddress(@g, %here), i8** @x, align 8
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @g() {
|
||||
; CHECK: @g
|
||||
|
||||
here:
|
||||
ret void
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user