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
|
# RUN: llc -mtriple=aarch64-unknown -run-pass branch-relaxation -aarch64-tbz-offset-bits=4 %s -o - | FileCheck %s
--- |
; ModuleID = 'test.ll'
source_filename = "test.ll"
target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"
target triple = "aarch64-unknown"
define void @test_stackmap_length(i32 %in) {
%val = and i32 %in, 1
%tst = icmp eq i32 %val, 0
br i1 %tst, label %true, label %false
true: ; preds = %0
tail call void (i64, i32, ...) @llvm.experimental.stackmap(i64 0, i32 32)
ret void
false: ; preds = %0
ret void
}
declare void @llvm.experimental.stackmap(i64, i32, ...)
...
---
# CHECK-LABEL: name:{{.*}}test_stackmap_length
# If the size of the stackmap is computed correctly, that will push
# the bb.2.false block too far away from the TBNZW, so the branch will
# have to be relaxed (note that we're using -aarch64-tbz-offset-bits to
# constrain the range that can be reached with the TBNZW to something smaller
# than what the stackmap is lowered to).
# CHECK: TBZW killed %w0, 0, %bb.1.true
# CHECK: B %bb.2.false
name: test_stackmap_length
tracksRegLiveness: false
liveins:
- { reg: '%w0' }
frameInfo:
hasStackMap: true
stackSize: 16
offsetAdjustment: 0
maxAlignment: 8
adjustsStack: true
hasCalls: true
stack:
- { id: 0, type: spill-slot, offset: -8, size: 8, alignment: 8, callee-saved-register: '%lr' }
- { id: 1, type: spill-slot, offset: -16, size: 8, alignment: 8, callee-saved-register: '%fp' }
body: |
bb.0 (%ir-block.0):
successors: %bb.1.true, %bb.2.false
liveins: %w0, %lr, %fp
TBNZW killed %w0, 0, %bb.2.false
bb.1.true:
successors: %bb.2.false
liveins: %lr, %fp
STACKMAP 0, 32, implicit-def dead early-clobber %x16, implicit-def dead early-clobber %x17, implicit-def dead early-clobber %lr
bb.2.false:
liveins: %lr, %fp
RET killed %lr
|