summaryrefslogtreecommitdiffstats
path: root/llvm/test
diff options
context:
space:
mode:
authorHans Wennborg <hans@hanshq.net>2012-11-16 10:33:25 +0000
committerHans Wennborg <hans@hanshq.net>2012-11-16 10:33:25 +0000
commit18aa124075859c5b1fd97cf39bd5bef1763acc4b (patch)
treea5eab930d41215bb2df60875d4dc7d4dfc20eb0a /llvm/test
parent038e3489d9669ba05dae613ddd3b573740b49b49 (diff)
downloadbcm5719-llvm-18aa124075859c5b1fd97cf39bd5bef1763acc4b.tar.gz
bcm5719-llvm-18aa124075859c5b1fd97cf39bd5bef1763acc4b.zip
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. llvm-svn: 168147
Diffstat (limited to 'llvm/test')
-rw-r--r--llvm/test/Transforms/GlobalOpt/blockaddress.ll20
1 files changed, 20 insertions, 0 deletions
diff --git a/llvm/test/Transforms/GlobalOpt/blockaddress.ll b/llvm/test/Transforms/GlobalOpt/blockaddress.ll
new file mode 100644
index 00000000000..13da76299d5
--- /dev/null
+++ b/llvm/test/Transforms/GlobalOpt/blockaddress.ll
@@ -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
+}
OpenPOWER on IntegriCloud