summaryrefslogtreecommitdiff
path: root/test/Transforms/GlobalOpt
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
commitfbeb956876573ae9ec6ddd190eb37e9174489c79 (patch)
treeb62b5f9c17f75b51681ce71451fb9cadb423b9e2 /test/Transforms/GlobalOpt
parent63a450a313a9b0a08622e97b53f5dd83f9266143 (diff)
downloadllvm-fbeb956876573ae9ec6ddd190eb37e9174489c79.tar.gz
llvm-fbeb956876573ae9ec6ddd190eb37e9174489c79.tar.bz2
llvm-fbeb956876573ae9ec6ddd190eb37e9174489c79.tar.xz
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 'test/Transforms/GlobalOpt')
-rw-r--r--test/Transforms/GlobalOpt/blockaddress.ll20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/Transforms/GlobalOpt/blockaddress.ll b/test/Transforms/GlobalOpt/blockaddress.ll
new file mode 100644
index 0000000000..13da76299d
--- /dev/null
+++ b/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
+}