Skip to content

Commit c2b4767

Browse files
committed
[ArgPromotion] Test dereferenceable annotation on callee (NFC)
While we check dereferenceability of all callers, we don't check dereferenceability annotations on the callee.
1 parent bf17cb2 commit c2b4767

File tree

1 file changed

+36
-6
lines changed
  • llvm/test/Transforms/ArgumentPromotion

1 file changed

+36
-6
lines changed

llvm/test/Transforms/ArgumentPromotion/align.ll

Lines changed: 36 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ define void @caller_must_exec(i32* %p) {
2121
ret void
2222
}
2323

24-
define internal i32 @callee_guaranteed_aligned(i1 %c, i32* %p) {
25-
; CHECK-LABEL: define {{[^@]+}}@callee_guaranteed_aligned
24+
define internal i32 @callee_guaranteed_aligned_1(i1 %c, i32* %p) {
25+
; CHECK-LABEL: define {{[^@]+}}@callee_guaranteed_aligned_1
2626
; CHECK-SAME: (i1 [[C:%.*]], i32 [[P_VAL:%.*]]) {
2727
; CHECK-NEXT: br i1 [[C]], label [[IF:%.*]], label [[ELSE:%.*]]
2828
; CHECK: if:
@@ -40,14 +40,44 @@ else:
4040
ret i32 -1
4141
}
4242

43-
define void @caller_guaranteed_aligned(i1 %c, i32* align 16 dereferenceable(4) %p) {
44-
; CHECK-LABEL: define {{[^@]+}}@caller_guaranteed_aligned
43+
define void @caller_guaranteed_aligned_1(i1 %c, i32* align 16 dereferenceable(4) %p) {
44+
; CHECK-LABEL: define {{[^@]+}}@caller_guaranteed_aligned_1
4545
; CHECK-SAME: (i1 [[C:%.*]], i32* align 16 dereferenceable(4) [[P:%.*]]) {
4646
; CHECK-NEXT: [[P_VAL:%.*]] = load i32, i32* [[P]], align 16
47-
; CHECK-NEXT: [[TMP1:%.*]] = call i32 @callee_guaranteed_aligned(i1 [[C]], i32 [[P_VAL]])
47+
; CHECK-NEXT: [[TMP1:%.*]] = call i32 @callee_guaranteed_aligned_1(i1 [[C]], i32 [[P_VAL]])
4848
; CHECK-NEXT: ret void
4949
;
50-
call i32 @callee_guaranteed_aligned(i1 %c, i32* %p)
50+
call i32 @callee_guaranteed_aligned_1(i1 %c, i32* %p)
51+
ret void
52+
}
53+
54+
define internal i32 @callee_guaranteed_aligned_2(i1 %c, i32* align 16 dereferenceable(4) %p) {
55+
; CHECK-LABEL: define {{[^@]+}}@callee_guaranteed_aligned_2
56+
; CHECK-SAME: (i1 [[C:%.*]], i32* align 16 dereferenceable(4) [[P:%.*]]) {
57+
; CHECK-NEXT: br i1 [[C]], label [[IF:%.*]], label [[ELSE:%.*]]
58+
; CHECK: if:
59+
; CHECK-NEXT: [[X:%.*]] = load i32, i32* [[P]], align 16
60+
; CHECK-NEXT: ret i32 [[X]]
61+
; CHECK: else:
62+
; CHECK-NEXT: ret i32 -1
63+
;
64+
br i1 %c, label %if, label %else
65+
66+
if:
67+
%x = load i32, i32* %p, align 16
68+
ret i32 %x
69+
70+
else:
71+
ret i32 -1
72+
}
73+
74+
define void @caller_guaranteed_aligned_2(i1 %c, i32* %p) {
75+
; CHECK-LABEL: define {{[^@]+}}@caller_guaranteed_aligned_2
76+
; CHECK-SAME: (i1 [[C:%.*]], i32* [[P:%.*]]) {
77+
; CHECK-NEXT: [[TMP1:%.*]] = call i32 @callee_guaranteed_aligned_2(i1 [[C]], i32* [[P]])
78+
; CHECK-NEXT: ret void
79+
;
80+
call i32 @callee_guaranteed_aligned_2(i1 %c, i32* %p)
5181
ret void
5282
}
5383

0 commit comments

Comments
 (0)