
…ntElimination ArgumentPromotion and DeadArgumentElimination passes could change function signatures but the function name remains the same as before the transformation. This makes it hard for tracing with bpf programs where user tends to use function signature in the source. See discussion [1] for details. This patch added suffix to functions whose signatures are changed. The suffix lets users know that function signature has changed and they need to impact the IR or binary to find modified signature before tracing those functions. The suffix for ArgumentPromotion is ".argprom" and the suffixes for DeadArgumentElimination are ".argelim" and ".retelim". The suffix also gives user hints about what kind of transformation has been done. With this patch, I built a recent linux kernel with full LTO enabled. I got 4 functions with only argpromotion like ``` set_track_update.argelim.argprom pmd_trans_huge_lock.argprom ... ``` I got 1058 functions with only deadargelim like ``` process_bit0.argelim pci_io_ecs_init.argelim ... ``` I got 3 functions with both argpromotion and deadargelim ``` set_track_update.argelim.argprom zero_pud_populate.argelim.argprom zero_pmd_populate.argelim.argprom ``` [1] https://github.com/llvm/llvm-project/issues/104678
81 lines
3.3 KiB
LLVM
81 lines
3.3 KiB
LLVM
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature
|
|
; RUN: opt -passes=argpromotion -S %s | FileCheck %s
|
|
|
|
define internal i32 @callee2(ptr noundef %0) {
|
|
; CHECK-LABEL: define {{[^@]+}}@callee2.argprom
|
|
; CHECK-SAME: (i32 [[DOT0_VAL:%.*]], i32 [[DOT4_VAL:%.*]]) {
|
|
; CHECK-NEXT: [[TMP1:%.*]] = add nsw i32 [[DOT0_VAL]], [[DOT4_VAL]]
|
|
; CHECK-NEXT: ret i32 [[TMP1]]
|
|
;
|
|
%2 = load i32, ptr %0, align 4
|
|
%3 = getelementptr inbounds i32, ptr %0, i64 1
|
|
%4 = load i32, ptr %3, align 4
|
|
%5 = add nsw i32 %2, %4
|
|
ret i32 %5
|
|
}
|
|
|
|
define i32 @caller2(i32 %0, i32 %1) {
|
|
; CHECK-LABEL: define {{[^@]+}}@caller2
|
|
; CHECK-SAME: (i32 [[TMP0:%.*]], i32 [[TMP1:%.*]]) {
|
|
; CHECK-NEXT: [[TMP3:%.*]] = alloca [2 x i32], align 4
|
|
; CHECK-NEXT: store i32 [[TMP0]], ptr [[TMP3]], align 4
|
|
; CHECK-NEXT: [[TMP4:%.*]] = getelementptr inbounds i32, ptr [[TMP3]], i64 1
|
|
; CHECK-NEXT: store i32 [[TMP1]], ptr [[TMP4]], align 4
|
|
; CHECK-NEXT: [[DOTVAL:%.*]] = load i32, ptr [[TMP3]], align 4
|
|
; CHECK-NEXT: [[TMP5:%.*]] = getelementptr i8, ptr [[TMP3]], i64 4
|
|
; CHECK-NEXT: [[DOTVAL1:%.*]] = load i32, ptr [[TMP5]], align 4
|
|
; CHECK-NEXT: [[TMP6:%.*]] = call i32 @callee2.argprom(i32 [[DOTVAL]], i32 [[DOTVAL1]])
|
|
; CHECK-NEXT: ret i32 [[TMP6]]
|
|
;
|
|
%3 = alloca [2 x i32], align 4
|
|
store i32 %0, ptr %3, align 4
|
|
%4 = getelementptr inbounds i32, ptr %3, i64 1
|
|
store i32 %1, ptr %4, align 4
|
|
%5 = call i32 @callee2(ptr noundef %3)
|
|
ret i32 %5
|
|
}
|
|
|
|
define internal i32 @callee3(ptr noundef %0) {
|
|
; CHECK-LABEL: define {{[^@]+}}@callee3
|
|
; CHECK-SAME: (ptr noundef [[TMP0:%.*]]) {
|
|
; CHECK-NEXT: [[TMP2:%.*]] = load i32, ptr [[TMP0]], align 4
|
|
; CHECK-NEXT: [[TMP3:%.*]] = getelementptr inbounds i32, ptr [[TMP0]], i64 1
|
|
; CHECK-NEXT: [[TMP4:%.*]] = load i32, ptr [[TMP3]], align 4
|
|
; CHECK-NEXT: [[TMP5:%.*]] = add nsw i32 [[TMP2]], [[TMP4]]
|
|
; CHECK-NEXT: [[TMP6:%.*]] = getelementptr inbounds i32, ptr [[TMP0]], i64 2
|
|
; CHECK-NEXT: [[TMP7:%.*]] = load i32, ptr [[TMP6]], align 4
|
|
; CHECK-NEXT: [[TMP8:%.*]] = add nsw i32 [[TMP5]], [[TMP7]]
|
|
; CHECK-NEXT: ret i32 [[TMP8]]
|
|
;
|
|
%2 = load i32, ptr %0, align 4
|
|
%3 = getelementptr inbounds i32, ptr %0, i64 1
|
|
%4 = load i32, ptr %3, align 4
|
|
%5 = add nsw i32 %2, %4
|
|
%6 = getelementptr inbounds i32, ptr %0, i64 2
|
|
%7 = load i32, ptr %6, align 4
|
|
%8 = add nsw i32 %5, %7
|
|
ret i32 %8
|
|
}
|
|
|
|
define i32 @caller3(i32 %0, i32 %1, i32 %2) {
|
|
; CHECK-LABEL: define {{[^@]+}}@caller3
|
|
; CHECK-SAME: (i32 [[TMP0:%.*]], i32 [[TMP1:%.*]], i32 [[TMP2:%.*]]) {
|
|
; CHECK-NEXT: [[TMP4:%.*]] = alloca [3 x i32], align 4
|
|
; CHECK-NEXT: store i32 [[TMP0]], ptr [[TMP4]], align 4
|
|
; CHECK-NEXT: [[TMP5:%.*]] = getelementptr inbounds i32, ptr [[TMP4]], i64 1
|
|
; CHECK-NEXT: store i32 [[TMP1]], ptr [[TMP5]], align 4
|
|
; CHECK-NEXT: [[TMP6:%.*]] = getelementptr inbounds i32, ptr [[TMP5]], i64 1
|
|
; CHECK-NEXT: store i32 [[TMP2]], ptr [[TMP6]], align 4
|
|
; CHECK-NEXT: [[TMP7:%.*]] = call i32 @callee3(ptr noundef [[TMP4]])
|
|
; CHECK-NEXT: ret i32 [[TMP7]]
|
|
;
|
|
%4 = alloca [3 x i32], align 4
|
|
store i32 %0, ptr %4, align 4
|
|
%5 = getelementptr inbounds i32, ptr %4, i64 1
|
|
store i32 %1, ptr %5, align 4
|
|
%6 = getelementptr inbounds i32, ptr %5, i64 1
|
|
store i32 %2, ptr %6, align 4
|
|
%7 = call i32 @callee3(ptr noundef %4)
|
|
ret i32 %7
|
|
}
|