[all-commits] [llvm/llvm-project] da816c: [TTI][BPF] Ensure ArgumentPromotion Not Exceeding ...
yonghong-song via All-commits
all-commits at lists.llvm.org
Wed Apr 19 09:12:16 PDT 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: da816c2985263f108e852adc99c31b6775096010
https://github.com/llvm/llvm-project/commit/da816c2985263f108e852adc99c31b6775096010
Author: Yonghong Song <yhs at fb.com>
Date: 2023-04-19 (Wed, 19 Apr 2023)
Changed paths:
M llvm/include/llvm/Analysis/TargetTransformInfo.h
M llvm/include/llvm/Analysis/TargetTransformInfoImpl.h
M llvm/lib/Analysis/TargetTransformInfo.cpp
M llvm/lib/Target/BPF/BPFTargetTransformInfo.h
M llvm/lib/Transforms/IPO/ArgumentPromotion.cpp
A llvm/test/Transforms/ArgumentPromotion/BPF/argpromotion.ll
A llvm/test/Transforms/ArgumentPromotion/BPF/lit.local.cfg
Log Message:
-----------
[TTI][BPF] Ensure ArgumentPromotion Not Exceeding Target MaxArgs
With LLVM patch https://reviews.llvm.org/D148269, we hit a linux kernel
bpf selftest compilation failure like below:
...
progs/test_xdp_noinline.c:739:8: error: too many args to t8: i64 = GlobalAddress<ptr @encap_v4> 0, progs/test_xdp_noinline.c:739:8
if (!encap_v4(xdp, cval, &pckt, dst, pkt_bytes))
^
...
progs/test_xdp_noinline.c:321:6: error: defined with too many args
bool encap_v4(struct xdp_md *xdp, struct ctl_value *cval,
^
...
Note that bpf selftests are compiled with -O2 which is
the recommended flag for bpf community.
The bpf backend calling convention is only allowing 5
parameters in registers and does not allow pass arguments
through stacks. In the above case, ArgumentPromotionPass
replaced parameter '&pckt' as two parameters, so the total
number of arguments after ArgumentPromotion pass becomes 6
and this caused later compilation failure during instruction
selection phase.
This patch added a TargetTransformInfo hook getMaxNumArgs()
which returns 5 for BPF and UINT_MAX for other targets.
Differential Revision: https://reviews.llvm.org/D148551
More information about the All-commits
mailing list