[PATCH] D148551: [TTI][BPF] Ensure ArgumentPromotion Not Exceeding Target MaxArgs
Yonghong Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 17 19:34:00 PDT 2023
yonghong-song added a comment.
> what about combining arguments in the backend (basically undoing this transformation)? that would generalize better to other passes and input IR
I would prefer to use a TTI hook as the hook itself essentially a profitability check. If the number of arguments is greater than the backend specified, the transformation is not profitable.
I suspect any other phases to do similar argument expanding transformation. If this does happen, we can use the same hook in those other transformations.
In our case, if input IR contains more than 5 arguments, the compiler will error out. This is okay and expected in bpf community since it is explicit in BPF specification that maximum 5 arguments are allowed. We do not need to add optimization to cope with such cases. We only need to deal with cases where user code is valid in terms of number of arguments but the compiler transformation makes it invalid.
================
Comment at: llvm/test/CodeGen/BPF/argumentpromotion.ll:1
+; RUN: opt -O2 -mtriple=bpf-pc-linux -S %s | FileCheck %s
+; Source:
----------------
aeubanks wrote:
> this should only run argument promotion, not the entire O2 pipeline
>
> also, this test case needs to be reduced a lot more, there's a lot of unrelated things in the IR here
Good suggestion. Just remove O2 and run argument promotion only for the test. Also simplified the input IR a lot.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D148551/new/
https://reviews.llvm.org/D148551
More information about the llvm-commits
mailing list