[PATCH] D147078: [LICM][BPF] Disable hoistMinMax() optimization for BPF target
Andrii Nakryiko via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 29 09:42:56 PDT 2023
anakryiko added a comment.
In D147078#4229618 <https://reviews.llvm.org/D147078#4229618>, @nikic wrote:
> Would it be fair to say that from the perspective of the BPF verifier, `x < y && x < z` is generally preferred over `x < min(y, z)`, because the verifier does not know that `x < min(y, z)` implies `x < y` etc?
Yes. BPF verifier isn't able to track complicated relationships between registers, so such transformations are generally breaking otherwise correct code.
> If so, I think it would make the most sense to add an undo transform in the BPF backend.
Genuine curiosity (and keep in mind I'm no compiler expert at all), but why doing transformation and then customly undoing it in specific BPF backend would be a preferable solution to allowing backends to turn off some known-to-hurt transformations in the first place? It seems more complicated and error-prone to do the dance of undoing, rather than have a generic interface to prevent transformation in the first place.
Note, this is not the only transformation that hurts BPF verification, @yonghong-song previously added "undo transformation" logic, but it seems like a not very sustainable and very convoluted solution. So we are asking if we can have a simpler and more reliable opt-out for some small set of transformations.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D147078/new/
https://reviews.llvm.org/D147078
More information about the llvm-commits
mailing list