Replace %0 in function arguments with descriptive names.

This commit is contained in:
Martin Sebor 2022-04-13 13:49:28 -06:00
parent bbcf11f5af
commit b8bac957d1
3 changed files with 37 additions and 37 deletions

View File

@ -10,25 +10,25 @@ declare i8* @memrchr(i8*, i32, i64)
@a12345 = constant [5 x i8] c"\01\02\03\04\05"
; Fold memrchr(a12345, 1, UINT32_MAX + 1LU) to null (and not to a12345
; Fold memrchr(a12345, C, UINT32_MAX + 1LU) to null (and not to a12345
; as might happen if the size were to be truncated to int32_t).
define i8* @fold_memrchr_a12345_1_ui32max_p1(i32 %0) {
; CHECK-LABEL: @fold_memrchr_a12345_1_ui32max_p1(
define i8* @fold_memrchr_a12345_c_ui32max_p1(i32 %C) {
; CHECK-LABEL: @fold_memrchr_a12345_c_ui32max_p1(
; CHECK-NEXT: [[RET:%.*]] = call i8* @memrchr(i8* noundef nonnull dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @a12345, i64 0, i64 0), i32 [[TMP0:%.*]], i64 4294967296)
; CHECK-NEXT: ret i8* [[RET]]
;
; CHECK : ret i8* null
%ptr = getelementptr [5 x i8], [5 x i8]* @a12345, i64 0, i64 0
%ret = call i8* @memrchr(i8* %ptr, i32 %0, i64 4294967296)
%ret = call i8* @memrchr(i8* %ptr, i32 %C, i64 4294967296)
ret i8* %ret
}
; Fold memrchr(ax1, 1, UINT32_MAX + 2LU) to null (and not to *ax1 == 1).
; Fold memrchr(ax1, C, UINT32_MAX + 2LU) to null (and not to *ax1 == 1).
define i8* @fold_memrchr_ax1_1_ui32max_p2(i32 %0) {
define i8* @fold_memrchr_ax1_1_ui32max_p2(i32 %C) {
; CHECK-LABEL: @fold_memrchr_ax1_1_ui32max_p2(
; CHECK-NEXT: [[RET:%.*]] = call i8* @memrchr(i8* noundef nonnull dereferenceable(1) getelementptr inbounds ([1 x i8], [1 x i8]* @ax1, i64 0, i64 0), i32 [[TMP0:%.*]], i64 4294967297)
; CHECK-NEXT: ret i8* [[RET]]
@ -36,28 +36,28 @@ define i8* @fold_memrchr_ax1_1_ui32max_p2(i32 %0) {
; CHECK : ret i8* null
%ptr = getelementptr [1 x i8], [1 x i8]* @ax1, i64 0, i64 0
%ret = call i8* @memrchr(i8* %ptr, i32 %0, i64 4294967297)
%ret = call i8* @memrchr(i8* %ptr, i32 %C, i64 4294967297)
ret i8* %ret
}
; But don't fold memrchr(ax, 1, UINT32_MAX + 2LU) to *ax == 1.
; But don't fold memrchr(ax, C, UINT32_MAX + 2LU) to *ax == 1.
define i8* @fold_memrchr_ax_1_ui32max_p2(i32 %0) {
define i8* @fold_memrchr_ax_1_ui32max_p2(i32 %C) {
; CHECK-LABEL: @fold_memrchr_ax_1_ui32max_p2(
; CHECK-NEXT: [[RET:%.*]] = call i8* @memrchr(i8* noundef nonnull dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @a12345, i64 0, i64 0), i32 [[TMP0:%.*]], i64 4294967297)
; CHECK-NEXT: ret i8* [[RET]]
;
%ptr = getelementptr [5 x i8], [5 x i8]* @a12345, i64 0, i64 0
%ret = call i8* @memrchr(i8* %ptr, i32 %0, i64 4294967297)
%ret = call i8* @memrchr(i8* %ptr, i32 %C, i64 4294967297)
ret i8* %ret
}
; Fold memrchr(a12345, c, 6) to null.
; Fold memrchr(a12345, C, 6) to null.
define i8* @fold_memrchr_a12345_c_6(i32 %0) {
define i8* @fold_memrchr_a12345_c_6(i32 %C) {
; CHECK-LABEL: @fold_memrchr_a12345_c_6(
; CHECK-NEXT: [[RET:%.*]] = call i8* @memrchr(i8* noundef nonnull dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @a12345, i64 0, i64 0), i32 [[TMP0:%.*]], i64 6)
; CHECK-NEXT: ret i8* [[RET]]
@ -65,14 +65,14 @@ define i8* @fold_memrchr_a12345_c_6(i32 %0) {
; CHECK : ret i8* null
%ptr = getelementptr [5 x i8], [5 x i8]* @a12345, i64 0, i64 0
%ret = call i8* @memrchr(i8* %ptr, i32 %0, i64 6)
%ret = call i8* @memrchr(i8* %ptr, i32 %C, i64 6)
ret i8* %ret
}
; Fold memrchr(a12345, c, SIZE_MAX) to null.
; Fold memrchr(a12345, C, SIZE_MAX) to null.
define i8* @fold_memrchr_a12345_c_szmax(i32 %0) {
define i8* @fold_memrchr_a12345_c_szmax(i32 %C) {
; CHECK-LABEL: @fold_memrchr_a12345_c_szmax(
; CHECK-NEXT: [[RET:%.*]] = call i8* @memrchr(i8* noundef nonnull dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @a12345, i64 0, i64 0), i32 [[TMP0:%.*]], i64 -1)
; CHECK-NEXT: ret i8* [[RET]]
@ -80,6 +80,6 @@ define i8* @fold_memrchr_a12345_c_szmax(i32 %0) {
; CHECK : ret i8* null
%ptr = getelementptr [5 x i8], [5 x i8]* @a12345, i64 0, i64 0
%ret = call i8* @memrchr(i8* %ptr, i32 %0, i64 18446744073709551615)
%ret = call i8* @memrchr(i8* %ptr, i32 %C, i64 18446744073709551615)
ret i8* %ret
}

View File

@ -11,16 +11,16 @@ declare i8* @memrchr(i8*, i32, i64)
@a123123 = constant [6 x i8] c"\01\02\03\01\02\03"
; Fold memrchr(ax, c, 0) to null.
; Fold memrchr(ax, C, 0) to null.
define i8* @fold_memrchr_ax_c_0(i32 %0) {
define i8* @fold_memrchr_ax_c_0(i32 %C) {
; CHECK-LABEL: @fold_memrchr_ax_c_0(
; CHECK-NEXT: [[RET:%.*]] = call i8* @memrchr(i8* getelementptr inbounds ([0 x i8], [0 x i8]* @ax, i64 0, i64 0), i32 [[TMP0:%.*]], i64 0)
; CHECK-NEXT: ret i8* [[RET]]
;
%ptr = getelementptr [0 x i8], [0 x i8]* @ax, i32 0, i32 0
%ret = call i8* @memrchr(i8* %ptr, i32 %0, i64 0)
%ret = call i8* @memrchr(i8* %ptr, i32 %C, i64 0)
ret i8* %ret
}
@ -91,15 +91,15 @@ define i8* @fold_memrchr_a123123_3_1() {
}
; Fold memrchr(ax, c, 1) to *ax == c ? ax : null.
; Fold memrchr(ax, C, 1) to *ax == C ? ax : null.
define i8* @fold_memrchr_ax_c_1(i32 %0) {
define i8* @fold_memrchr_ax_c_1(i32 %C) {
; CHECK-LABEL: @fold_memrchr_ax_c_1(
; CHECK-NEXT: [[RET:%.*]] = call i8* @memrchr(i8* noundef nonnull dereferenceable(1) getelementptr inbounds ([0 x i8], [0 x i8]* @ax, i64 0, i64 0), i32 [[TMP0:%.*]], i64 1)
; CHECK-NEXT: ret i8* [[RET]]
;
%ptr = getelementptr [0 x i8], [0 x i8]* @ax, i32 0, i32 0
%ret = call i8* @memrchr(i8* %ptr, i32 %0, i64 1)
%ret = call i8* @memrchr(i8* %ptr, i32 %C, i64 1)
ret i8* %ret
}
@ -174,16 +174,16 @@ define i8* @fold_memrchr_a12345_2_5() {
}
; Fold memrchr(a12345, 0, %0) to null.
; Fold memrchr(a12345, 0, %N) to null.
define i8* @fold_memrchr_a12345_0_n(i64 %0) {
define i8* @fold_memrchr_a12345_0_n(i64 %N) {
; CHECK-LABEL: @fold_memrchr_a12345_0_n(
; CHECK-NEXT: [[RET:%.*]] = call i8* @memrchr(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @a12345, i64 0, i64 0), i32 0, i64 [[TMP0:%.*]])
; CHECK-NEXT: ret i8* [[RET]]
;
%ptr = getelementptr [5 x i8], [5 x i8]* @a12345, i32 0, i32 0
%ret = call i8* @memrchr(i8* %ptr, i32 0, i64 %0)
%ret = call i8* @memrchr(i8* %ptr, i32 0, i64 %N)
ret i8* %ret
}

View File

@ -10,57 +10,57 @@ declare i8* @memrchr(i8*, i32, i64)
@a1110111 = constant [7 x i8] c"\01\01\01\00\01\01\01"
; Fold memrchr(a11111, c, 5) to *a11111 == c ? a11111 + 5 - 1 : null.
; Fold memrchr(a11111, C, 5) to *a11111 == C ? a11111 + 5 - 1 : null.
define i8* @fold_memrchr_a11111_c_5(i32 %0) {
define i8* @fold_memrchr_a11111_c_5(i32 %C) {
; CHECK-LABEL: @fold_memrchr_a11111_c_5(
; CHECK-NEXT: [[RET:%.*]] = call i8* @memrchr(i8* noundef nonnull dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @a11111, i64 0, i64 0), i32 [[TMP0:%.*]], i64 5)
; CHECK-NEXT: ret i8* [[RET]]
;
%ptr = getelementptr [5 x i8], [5 x i8]* @a11111, i64 0, i64 0
%ret = call i8* @memrchr(i8* %ptr, i32 %0, i64 5)
%ret = call i8* @memrchr(i8* %ptr, i32 %C, i64 5)
ret i8* %ret
}
; Fold memrchr(a1110111, c, 3) to a1110111[2] == c ? a1110111 + 2 : null.
; Fold memrchr(a1110111, C, 3) to a1110111[2] == C ? a1110111 + 2 : null.
define i8* @fold_memrchr_a1110111_c_3(i32 %0) {
define i8* @fold_memrchr_a1110111_c_3(i32 %C) {
; CHECK-LABEL: @fold_memrchr_a1110111_c_3(
; CHECK-NEXT: [[RET:%.*]] = call i8* @memrchr(i8* noundef nonnull dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @a1110111, i64 0, i64 0), i32 [[TMP0:%.*]], i64 3)
; CHECK-NEXT: ret i8* [[RET]]
;
%ptr = getelementptr [7 x i8], [7 x i8]* @a1110111, i64 0, i64 0
%ret = call i8* @memrchr(i8* %ptr, i32 %0, i64 3)
%ret = call i8* @memrchr(i8* %ptr, i32 %C, i64 3)
ret i8* %ret
}
; Don't fold memrchr(a1110111, c, 4).
; Don't fold memrchr(a1110111, C, 4).
define i8* @call_memrchr_a1110111_c_4(i32 %0) {
define i8* @call_memrchr_a1110111_c_4(i32 %C) {
; CHECK-LABEL: @call_memrchr_a1110111_c_4(
; CHECK-NEXT: [[RET:%.*]] = call i8* @memrchr(i8* noundef nonnull dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @a1110111, i64 0, i64 0), i32 [[TMP0:%.*]], i64 4)
; CHECK-NEXT: ret i8* [[RET]]
;
%ptr = getelementptr [7 x i8], [7 x i8]* @a1110111, i64 0, i64 0
%ret = call i8* @memrchr(i8* %ptr, i32 %0, i64 4)
%ret = call i8* @memrchr(i8* %ptr, i32 %C, i64 4)
ret i8* %ret
}
; Don't fold memrchr(a1110111, c, 7).
; Don't fold memrchr(a1110111, C, 7).
define i8* @call_memrchr_a11111_c_7(i32 %0) {
define i8* @call_memrchr_a11111_c_7(i32 %C) {
; CHECK-LABEL: @call_memrchr_a11111_c_7(
; CHECK-NEXT: [[RET:%.*]] = call i8* @memrchr(i8* noundef nonnull dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @a1110111, i64 0, i64 0), i32 [[TMP0:%.*]], i64 7)
; CHECK-NEXT: ret i8* [[RET]]
;
%ptr = getelementptr [7 x i8], [7 x i8]* @a1110111, i64 0, i64 0
%ret = call i8* @memrchr(i8* %ptr, i32 %0, i64 7)
%ret = call i8* @memrchr(i8* %ptr, i32 %C, i64 7)
ret i8* %ret
}