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
This commit is contained in:
Chris Lattner
2010-03-15 20:39:00 +00:00
parent 034721eb6a
commit 9cc0da9c29
5 changed files with 116 additions and 29 deletions

View File

@@ -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
}