[llvm] c2b4767 - [ArgPromotion] Test dereferenceable annotation on callee (NFC)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 8 01:31:56 PST 2022


Author: Nikita Popov
Date: 2022-02-08T10:27:17+01:00
New Revision: c2b476767ef327396868050a08aa1192d3e4ba81

URL: https://github.com/llvm/llvm-project/commit/c2b476767ef327396868050a08aa1192d3e4ba81
DIFF: https://github.com/llvm/llvm-project/commit/c2b476767ef327396868050a08aa1192d3e4ba81.diff

LOG: [ArgPromotion] Test dereferenceable annotation on callee (NFC)

While we check dereferenceability of all callers, we don't check
dereferenceability annotations on the callee.

Added: 
    

Modified: 
    llvm/test/Transforms/ArgumentPromotion/align.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/Transforms/ArgumentPromotion/align.ll b/llvm/test/Transforms/ArgumentPromotion/align.ll
index 5d8ceee285294..45c9d64865684 100644
--- a/llvm/test/Transforms/ArgumentPromotion/align.ll
+++ b/llvm/test/Transforms/ArgumentPromotion/align.ll
@@ -21,8 +21,8 @@ define void @caller_must_exec(i32* %p) {
   ret void
 }
 
-define internal i32 @callee_guaranteed_aligned(i1 %c, i32* %p) {
-; CHECK-LABEL: define {{[^@]+}}@callee_guaranteed_aligned
+define internal i32 @callee_guaranteed_aligned_1(i1 %c, i32* %p) {
+; CHECK-LABEL: define {{[^@]+}}@callee_guaranteed_aligned_1
 ; CHECK-SAME: (i1 [[C:%.*]], i32 [[P_VAL:%.*]]) {
 ; CHECK-NEXT:    br i1 [[C]], label [[IF:%.*]], label [[ELSE:%.*]]
 ; CHECK:       if:
@@ -40,14 +40,44 @@ else:
   ret i32 -1
 }
 
-define void @caller_guaranteed_aligned(i1 %c, i32* align 16 dereferenceable(4) %p) {
-; CHECK-LABEL: define {{[^@]+}}@caller_guaranteed_aligned
+define void @caller_guaranteed_aligned_1(i1 %c, i32* align 16 dereferenceable(4) %p) {
+; CHECK-LABEL: define {{[^@]+}}@caller_guaranteed_aligned_1
 ; CHECK-SAME: (i1 [[C:%.*]], i32* align 16 dereferenceable(4) [[P:%.*]]) {
 ; CHECK-NEXT:    [[P_VAL:%.*]] = load i32, i32* [[P]], align 16
-; CHECK-NEXT:    [[TMP1:%.*]] = call i32 @callee_guaranteed_aligned(i1 [[C]], i32 [[P_VAL]])
+; CHECK-NEXT:    [[TMP1:%.*]] = call i32 @callee_guaranteed_aligned_1(i1 [[C]], i32 [[P_VAL]])
 ; CHECK-NEXT:    ret void
 ;
-  call i32 @callee_guaranteed_aligned(i1 %c, i32* %p)
+  call i32 @callee_guaranteed_aligned_1(i1 %c, i32* %p)
+  ret void
+}
+
+define internal i32 @callee_guaranteed_aligned_2(i1 %c, i32* align 16 dereferenceable(4) %p) {
+; CHECK-LABEL: define {{[^@]+}}@callee_guaranteed_aligned_2
+; CHECK-SAME: (i1 [[C:%.*]], i32* align 16 dereferenceable(4) [[P:%.*]]) {
+; CHECK-NEXT:    br i1 [[C]], label [[IF:%.*]], label [[ELSE:%.*]]
+; CHECK:       if:
+; CHECK-NEXT:    [[X:%.*]] = load i32, i32* [[P]], align 16
+; CHECK-NEXT:    ret i32 [[X]]
+; CHECK:       else:
+; CHECK-NEXT:    ret i32 -1
+;
+  br i1 %c, label %if, label %else
+
+if:
+  %x = load i32, i32* %p, align 16
+  ret i32 %x
+
+else:
+  ret i32 -1
+}
+
+define void @caller_guaranteed_aligned_2(i1 %c, i32* %p) {
+; CHECK-LABEL: define {{[^@]+}}@caller_guaranteed_aligned_2
+; CHECK-SAME: (i1 [[C:%.*]], i32* [[P:%.*]]) {
+; CHECK-NEXT:    [[TMP1:%.*]] = call i32 @callee_guaranteed_aligned_2(i1 [[C]], i32* [[P]])
+; CHECK-NEXT:    ret void
+;
+  call i32 @callee_guaranteed_aligned_2(i1 %c, i32* %p)
   ret void
 }
 


        


More information about the llvm-commits mailing list