summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen/Generic/addr-label.ll
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-03-15 20:39:00 +0000
committerChris Lattner <sabre@nondot.org>2010-03-15 20:39:00 +0000
commit561334a81fc14a15388e94d05aea3c6232620374 (patch)
treebf74c8b5b057cc4cd0685a025cec1c35c520c876 /llvm/test/CodeGen/Generic/addr-label.ll
parentc116a8707a0cd1e2acb65a8368961305acf7c290 (diff)
downloadbcm5719-llvm-561334a81fc14a15388e94d05aea3c6232620374.tar.gz
bcm5719-llvm-561334a81fc14a15388e94d05aea3c6232620374.zip
Implement support for the case when a reference to a addr-of-bb
label is generated, but then the block is deleted. Since the value is undefined, we just emit the label right after the entry label of the function. It might matter that the label is in the same section as the function was afterall. llvm-svn: 98579
Diffstat (limited to 'llvm/test/CodeGen/Generic/addr-label.ll')
-rw-r--r--llvm/test/CodeGen/Generic/addr-label.ll39
1 files changed, 39 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/Generic/addr-label.ll b/llvm/test/CodeGen/Generic/addr-label.ll
new file mode 100644
index 00000000000..49f3cbfe7c7
--- /dev/null
+++ b/llvm/test/CodeGen/Generic/addr-label.ll
@@ -0,0 +1,39 @@
+; RUN: llc %s -o -
+
+;; Reference to a label that gets deleted.
+define i8* @test1() nounwind {
+entry:
+ ret i8* blockaddress(@test1b, %test_label)
+}
+
+define i32 @test1b() nounwind {
+entry:
+ ret i32 -1
+test_label:
+ br label %ret
+ret:
+ ret i32 -1
+}
+
+
+;; Issues with referring to a label that gets RAUW'd later.
+define i32 @test2a() nounwind {
+entry:
+ %target = bitcast i8* blockaddress(@test2b, %test_label) to i8*
+
+ call i32 @test2b(i8* %target)
+
+ ret i32 0
+}
+
+define i32 @test2b(i8* %target) nounwind {
+entry:
+ indirectbr i8* %target, [label %test_label]
+
+test_label:
+; assume some code here...
+ br label %ret
+
+ret:
+ ret i32 -1
+}
OpenPOWER on IntegriCloud