summaryrefslogtreecommitdiff
path: root/test/CodeGen
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
commit9cc0da9c29302e9463a6f31ba705c8e1b6f4cea1 (patch)
treeaa37edad2cd662e312e33b4a6be5c2eef99b14e1 /test/CodeGen
parent034721eb6a1787b3d5ebf760de067cb622555bae (diff)
downloadllvm-9cc0da9c29302e9463a6f31ba705c8e1b6f4cea1.tar.gz
llvm-9cc0da9c29302e9463a6f31ba705c8e1b6f4cea1.tar.bz2
llvm-9cc0da9c29302e9463a6f31ba705c8e1b6f4cea1.tar.xz
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98579 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen')
-rw-r--r--test/CodeGen/Generic/addr-label.ll39
-rw-r--r--test/CodeGen/X86/crash.ll23
2 files changed, 39 insertions, 23 deletions
diff --git a/test/CodeGen/Generic/addr-label.ll b/test/CodeGen/Generic/addr-label.ll
new file mode 100644
index 0000000000..49f3cbfe7c
--- /dev/null
+++ b/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
+}
diff --git a/test/CodeGen/X86/crash.ll b/test/CodeGen/X86/crash.ll
index 8ce9e6c248..4b7c850993 100644
--- a/test/CodeGen/X86/crash.ll
+++ b/test/CodeGen/X86/crash.ll
@@ -92,26 +92,3 @@ foo:
}
-;; Issues with referring to a label that gets RAUW'd later.
-define i32 @test6a() nounwind {
-entry:
- %target = bitcast i8* blockaddress(@test6b, %test_label) to i8*
-
- call i32 @test6b(i8* %target)
-
- ret i32 0
-}
-
-define i32 @test6b(i8* %target) nounwind {
-entry:
- indirectbr i8* %target, [label %test_label]
-
-test_label:
-; assume some code here...
- br label %ret
-
-ret:
- ret i32 -1
-}
-
-