[PATCH] D101359: [NARY] Don't optimize min/max if there are side uses (part2)
Max Kazantsev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 30 03:51:32 PDT 2021
mkazantsev added inline comments.
================
Comment at: llvm/lib/Transforms/Scalar/NaryReassociate.cpp:620
// In other words LHS should be used (directly or indirectly) by I only.
- for (User *U : LHS->users())
- if (U != I || !(U->hasOneUser() && *U->users().begin() == I))
- continue;
+ if (llvm::any_of(LHS->users(), [&](auto *U) {
+ return U != I && !(U->hasOneUser() && *U->users().begin() == I);
----------------
Please limit capture scope to &I (it doesn'tseem you need anythong else).
================
Comment at: llvm/lib/Transforms/Scalar/NaryReassociate.cpp:621
+ if (llvm::any_of(LHS->users(), [&](auto *U) {
+ return U != I && !(U->hasOneUser() && *U->users().begin() == I);
+ }))
----------------
Is `U != I` even happens to be false? An instruction can only use itself it it's a Phi, and I believe `I` is not a Phi here.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D101359/new/
https://reviews.llvm.org/D101359
More information about the llvm-commits
mailing list