[llvm] [InstCombine] Improve `(icmp pred (and X, Y), ...)` fold. (PR #66787)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 15 06:33:27 PST 2023
================
@@ -4410,6 +4410,11 @@ Instruction *InstCombinerImpl::foldNot(BinaryOperator &I) {
if (Instruction *NewXor = foldNotXor(I, Builder))
return NewXor;
+ // TODO: Could handle multi-use better by checking if all uses of NotOp (other
+ // than I) can be inverted.
+ if (Value *R = getFreeInverted(NotOp, NotOp->hasOneUse(), &Builder))
+ return replaceInstUsesWith(I, R);
----------------
nikic wrote:
There is a `sinkNotIntoXor()` fold that I think gets obsoleted by this one? Any test changes if you drop it?
https://github.com/llvm/llvm-project/pull/66787
More information about the llvm-commits
mailing list