[PATCH] D157740: [WIP] [InstCombine] Fold icmp into phi beyond the same BB.
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 17 05:12:45 PDT 2023
nikic added inline comments.
================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp:3899
// not, we are just pessimizing the code by making an i1 phi.
- if (LHSI->getParent() == I.getParent())
+ if (LHSI->getParent() == I.getParent() || isa<BinaryOperator>(LHSI->getOperand(0)))
if (Instruction *NV = foldOpIntoPhi(I, cast<PHINode>(LHSI)))
----------------
I don't think this special case make sense. Either we allow this, or we don't. There is no reason to believe that this is beneficial for just binary operators -- it just happens that this allows follow-on folds in your specific example.
I //am// open to dropping the check entirely, if we don't see any significant regressions from that.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D157740/new/
https://reviews.llvm.org/D157740
More information about the llvm-commits
mailing list