callbr-asm-blockplacement.ll
3.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu | FileCheck %s
; This test asserted in MachineBlockPlacement during asm-goto bring up.
%struct.wibble = type { %struct.pluto, i32, i8* }
%struct.pluto = type { i32, i32, i32 }
@global = external global [0 x %struct.wibble]
define i32 @foo(i32 %arg, i32 (i8*)* %arg3) nounwind {
; CHECK-LABEL: foo:
; CHECK: # %bb.0: # %bb
; CHECK-NEXT: pushq %rbp
; CHECK-NEXT: pushq %r15
; CHECK-NEXT: pushq %r14
; CHECK-NEXT: pushq %r13
; CHECK-NEXT: pushq %r12
; CHECK-NEXT: pushq %rbx
; CHECK-NEXT: pushq %rax
; CHECK-NEXT: movabsq $-2305847407260205056, %rbx # imm = 0xDFFFFC0000000000
; CHECK-NEXT: xorl %eax, %eax
; CHECK-NEXT: testb %al, %al
; CHECK-NEXT: jne .LBB0_5
; CHECK-NEXT: # %bb.1: # %bb5
; CHECK-NEXT: movq %rsi, %r14
; CHECK-NEXT: movslq %edi, %rbp
; CHECK-NEXT: leaq (,%rbp,8), %rax
; CHECK-NEXT: leaq global(%rax,%rax,2), %r15
; CHECK-NEXT: leaq global+4(%rax,%rax,2), %r12
; CHECK-NEXT: xorl %r13d, %r13d
; CHECK-NEXT: .p2align 4, 0x90
; CHECK-NEXT: .LBB0_2: # %bb8
; CHECK-NEXT: # =>This Inner Loop Header: Depth=1
; CHECK-NEXT: callq bar
; CHECK-NEXT: movq %rax, %rbx
; CHECK-NEXT: movq %rax, %rdi
; CHECK-NEXT: callq *%r14
; CHECK-NEXT: movq %r15, %rdi
; CHECK-NEXT: callq hoge
; CHECK-NEXT: movq %r12, %rdi
; CHECK-NEXT: callq hoge
; CHECK-NEXT: testb %r13b, %r13b
; CHECK-NEXT: jne .LBB0_2
; CHECK-NEXT: # %bb.3: # %bb15
; CHECK-NEXT: leaq (%rbp,%rbp,2), %rax
; CHECK-NEXT: movq %rbx, global+16(,%rax,8)
; CHECK-NEXT: movabsq $-2305847407260205056, %rbx # imm = 0xDFFFFC0000000000
; CHECK-NEXT: #APP
; CHECK-NEXT: #NO_APP
; CHECK-NEXT: # %bb.4: # %bb17
; CHECK-NEXT: callq widget
; CHECK-NEXT: .Ltmp0: # Block address taken
; CHECK-NEXT: .LBB0_5: # %bb18
; CHECK-NEXT: movw $0, 14(%rbx)
; CHECK-NEXT: addq $8, %rsp
; CHECK-NEXT: popq %rbx
; CHECK-NEXT: popq %r12
; CHECK-NEXT: popq %r13
; CHECK-NEXT: popq %r14
; CHECK-NEXT: popq %r15
; CHECK-NEXT: popq %rbp
; CHECK-NEXT: retq
bb:
%tmp = add i64 0, -2305847407260205056
%tmp4 = sext i32 %arg to i64
br i1 undef, label %bb18, label %bb5
bb5: ; preds = %bb
%tmp6 = getelementptr [0 x %struct.wibble], [0 x %struct.wibble]* @global, i64 0, i64 %tmp4, i32 0, i32 0
%tmp7 = getelementptr [0 x %struct.wibble], [0 x %struct.wibble]* @global, i64 0, i64 %tmp4, i32 0, i32 1
br label %bb8
bb8: ; preds = %bb8, %bb5
%tmp9 = call i8* @bar(i64 undef)
%tmp10 = call i32 %arg3(i8* nonnull %tmp9)
%tmp11 = ptrtoint i32* %tmp6 to i64
call void @hoge(i64 %tmp11)
%tmp12 = ptrtoint i32* %tmp7 to i64
%tmp13 = add i64 undef, -2305847407260205056
call void @hoge(i64 %tmp12)
%tmp14 = icmp eq i32 0, 0
br i1 %tmp14, label %bb15, label %bb8
bb15: ; preds = %bb8
%tmp16 = getelementptr [0 x %struct.wibble], [0 x %struct.wibble]* @global, i64 0, i64 %tmp4, i32 2
store i8* %tmp9, i8** %tmp16
callbr void asm sideeffect "", "X"(i8* blockaddress(@foo, %bb18))
to label %bb17 [label %bb18]
bb17: ; preds = %bb15
call void @widget()
br label %bb18
bb18: ; preds = %bb17, %bb15, %bb
%tmp19 = add i64 %tmp, 14
%tmp20 = inttoptr i64 %tmp19 to i16*
store i16 0, i16* %tmp20
ret i32 undef
}
declare i8* @bar(i64)
declare void @widget()
declare void @hoge(i64)