Skip to content
This repository has been archived by the owner on Feb 5, 2019. It is now read-only.

Commit

Permalink
[SROA] Clean up a test case a bit prior to adding more testing for
Browse files Browse the repository at this point in the history
nonnull as part of fixing PR32902.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@306353 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
chandlerc committed Jun 27, 2017
1 parent ea254cb commit 477bd75
Showing 1 changed file with 13 additions and 15 deletions.
28 changes: 13 additions & 15 deletions test/Transforms/SROA/preserve-nonnull.ll
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,20 @@
; Make sure that SROA doesn't lose nonnull metadata
; on loads from allocas that get optimized out.

; CHECK-LABEL: define float* @yummy_nonnull
; CHECK: [[RETURN:%(.*)]] = load float*, float** %arg, align 8
; CHECK: [[ASSUME:%(.*)]] = icmp ne float* {{.*}}[[RETURN]], null
; CHECK: call void @llvm.assume(i1 {{.*}}[[ASSUME]])
; CHECK: ret float* {{.*}}[[RETURN]]

define float* @yummy_nonnull(float** %arg) {
entry-block:
%buf = alloca float*

%_arg_i8 = bitcast float** %arg to i8*
%_buf_i8 = bitcast float** %buf to i8*
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %_buf_i8, i8* %_arg_i8, i64 8, i32 8, i1 false)

%ret = load float*, float** %buf, align 8, !nonnull !0
ret float* %ret
; CHECK-LABEL: define float* @yummy_nonnull(
; CHECK-NEXT: entry:
; CHECK-NEXT: %[[RETURN:.*]] = load float*, float** %arg, align 8
; CHECK-NEXT: %[[ASSUME:.*]] = icmp ne float* %[[RETURN]], null
; CHECK-NEXT: call void @llvm.assume(i1 %[[ASSUME]])
; CHECK-NEXT: ret float* %[[RETURN]]
entry:
%buf = alloca float*
%_arg_i8 = bitcast float** %arg to i8*
%_buf_i8 = bitcast float** %buf to i8*
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %_buf_i8, i8* %_arg_i8, i64 8, i32 8, i1 false)
%ret = load float*, float** %buf, align 8, !nonnull !0
ret float* %ret
}

declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture writeonly, i8* nocapture readonly, i64, i32, i1)
Expand Down

0 comments on commit 477bd75

Please sign in to comment.