1 ; RUN: llc %s -o - 2 3 ;; Reference to a label that gets deleted. 4 define i8* @test1() nounwind { 5 entry: 6 ret i8* blockaddress(@test1b, %test_label) 7 } 8 9 define i32 @test1b() nounwind { 10 entry: 11 ret i32 -1 12 test_label: 13 br label %ret 14 ret: 15 ret i32 -1 16 } 17 18 19 ;; Issues with referring to a label that gets RAUW'd later. 20 define i32 @test2a() nounwind { 21 entry: 22 %target = bitcast i8* blockaddress(@test2b, %test_label) to i8* 23 24 call i32 @test2b(i8* %target) 25 26 ret i32 0 27 } 28 29 define i32 @test2b(i8* %target) nounwind { 30 entry: 31 indirectbr i8* %target, [label %test_label] 32 33 test_label: 34 ; assume some code here... 35 br label %ret 36 37 ret: 38 ret i32 -1 39 } 40 41 ; Issues with a BB that gets RAUW'd to another one after references are 42 ; generated. 43 define void @test3(i8** %P, i8** %Q) nounwind { 44 entry: 45 store i8* blockaddress(@test3b, %test_label), i8** %P 46 store i8* blockaddress(@test3b, %ret), i8** %Q 47 ret void 48 } 49 50 define i32 @test3b() nounwind { 51 entry: 52 br label %test_label 53 test_label: 54 br label %ret 55 ret: 56 ret i32 -1 57 } 58 59 60 ; PR6673 61 62 define i64 @test4a() { 63 %target = bitcast i8* blockaddress(@test4b, %usermain) to i8* 64 %ret = call i64 @test4b(i8* %target) 65 66 ret i64 %ret 67 } 68 69 define i64 @test4b(i8* %Code) { 70 entry: 71 indirectbr i8* %Code, [label %usermain] 72 usermain: 73 br label %label_line_0 74 75 label_line_0: 76 br label %label_line_1 77 78 label_line_1: 79 %target = ptrtoint i8* blockaddress(@test4b, %label_line_0) to i64 80 ret i64 %target 81 } 82