forked from OSchip/llvm-project
[NFC][SROA] Add more tests for non-capturing pointer-escaping calls
This commit is contained in:
parent
0e185ceafb
commit
8d35c054e3
|
@ -772,6 +772,68 @@ exit:
|
|||
ret [2 x i32] %i3
|
||||
}
|
||||
|
||||
define i32 @all_uses_of_alloca_are_calls(i32* nocapture nonnull readonly %data, i64 %n) {
|
||||
; CHECK-LABEL: @all_uses_of_alloca_are_calls(
|
||||
; CHECK-NEXT: entry:
|
||||
; CHECK-NEXT: [[RETVAL:%.*]] = alloca i32, align 4
|
||||
; CHECK-NEXT: [[TMP0:%.*]] = call i32 @user_of_alloca(i32* nocapture nonnull [[RETVAL]])
|
||||
; CHECK-NEXT: [[TMP1:%.*]] = call i32 @user_of_alloca(i32* nocapture nonnull [[RETVAL]])
|
||||
; CHECK-NEXT: ret i32 0
|
||||
;
|
||||
; CHECK-OPAQUE-LABEL: @all_uses_of_alloca_are_calls(
|
||||
; CHECK-OPAQUE-NEXT: entry:
|
||||
; CHECK-OPAQUE-NEXT: [[RETVAL:%.*]] = alloca i32, align 4
|
||||
; CHECK-OPAQUE-NEXT: [[TMP0:%.*]] = call i32 @user_of_alloca(ptr nocapture nonnull [[RETVAL]])
|
||||
; CHECK-OPAQUE-NEXT: [[TMP1:%.*]] = call i32 @user_of_alloca(ptr nocapture nonnull [[RETVAL]])
|
||||
; CHECK-OPAQUE-NEXT: ret i32 0
|
||||
;
|
||||
entry:
|
||||
%retval = alloca i32, align 4
|
||||
call i32 @user_of_alloca(i32* nocapture nonnull %retval)
|
||||
call i32 @user_of_alloca(i32* nocapture nonnull %retval)
|
||||
ret i32 0
|
||||
}
|
||||
|
||||
declare void @llvm.lifetime.start.p0i8(i64 immarg, i8* nocapture)
|
||||
|
||||
define i64 @do_schedule_instrs_for_dce_after_fixups() {
|
||||
; CHECK-LABEL: @do_schedule_instrs_for_dce_after_fixups(
|
||||
; CHECK-NEXT: entry:
|
||||
; CHECK-NEXT: [[C:%.*]] = alloca i64, align 2
|
||||
; CHECK-NEXT: [[TMP0:%.*]] = bitcast i64* [[C]] to i8*
|
||||
; CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 1, i8* [[TMP0]])
|
||||
; CHECK-NEXT: [[ARRAYDECAY:%.*]] = bitcast i64* [[C]] to i32*
|
||||
; CHECK-NEXT: br label [[IF_END:%.*]]
|
||||
; CHECK: if.end:
|
||||
; CHECK-NEXT: [[ADD_PTR:%.*]] = getelementptr inbounds i32, i32* [[ARRAYDECAY]], i64 1
|
||||
; CHECK-NEXT: [[TMP1:%.*]] = call i32 @user_of_alloca(i32* [[ADD_PTR]])
|
||||
; CHECK-NEXT: ret i64 0
|
||||
;
|
||||
; CHECK-OPAQUE-LABEL: @do_schedule_instrs_for_dce_after_fixups(
|
||||
; CHECK-OPAQUE-NEXT: entry:
|
||||
; CHECK-OPAQUE-NEXT: [[C:%.*]] = alloca i64, align 2
|
||||
; CHECK-OPAQUE-NEXT: [[TMP0:%.*]] = bitcast ptr [[C]] to ptr
|
||||
; CHECK-OPAQUE-NEXT: call void @llvm.lifetime.start.p0(i64 1, ptr [[TMP0]])
|
||||
; CHECK-OPAQUE-NEXT: [[ARRAYDECAY:%.*]] = bitcast ptr [[C]] to ptr
|
||||
; CHECK-OPAQUE-NEXT: br label [[IF_END:%.*]]
|
||||
; CHECK-OPAQUE: if.end:
|
||||
; CHECK-OPAQUE-NEXT: [[ADD_PTR:%.*]] = getelementptr inbounds i32, ptr [[ARRAYDECAY]], i64 1
|
||||
; CHECK-OPAQUE-NEXT: [[TMP1:%.*]] = call i32 @user_of_alloca(ptr [[ADD_PTR]])
|
||||
; CHECK-OPAQUE-NEXT: ret i64 0
|
||||
;
|
||||
entry:
|
||||
%c = alloca i64, align 2
|
||||
%0 = bitcast i64* %c to i8*
|
||||
call void @llvm.lifetime.start.p0i8(i64 1, i8* %0)
|
||||
%arraydecay = bitcast i64* %c to i32*
|
||||
br label %if.end
|
||||
|
||||
if.end: ; preds = %entry
|
||||
%add.ptr = getelementptr inbounds i32, i32* %arraydecay, i64 1
|
||||
call i32 @user_of_alloca(i32* %add.ptr)
|
||||
ret i64 0
|
||||
}
|
||||
|
||||
declare dso_local i32 @user_of_alloca(i32* nocapture nonnull)
|
||||
declare dso_local i32 @user_of_alloca_with_multiple_args(i32* nocapture nonnull, i32* nocapture nonnull)
|
||||
declare dso_local i32 @capture_of_alloca(i32 *nonnull)
|
||||
|
|
Loading…
Reference in New Issue