[PATCH] D124930: [DagCombine] Fold (X & ~Y) | Y with truncated not
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu May 5 00:52:56 PDT 2022
nikic added inline comments.
================
Comment at: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:4688
// Only bits set in Mask must be negated, other bits may be arbitrary.
-static SDValue getBitwiseNotOperand(SDValue V, SDValue Mask) {
- if (isBitwiseNot(V, true))
+SDValue llvm::getBitwiseNotOperand(SDValue V, SDValue Mask, bool AllowUndefs) {
+ if (isBitwiseNot(V, AllowUndefs))
----------------
RKSimon wrote:
> Would this be more generally useful if we replaced Mask with a APInt DemandedBits?
Yes -- though it would make the current callers, which all have the mask as an SDValue, more complicated. Would have to extract the isConstOrConstSplat part plus a fallback to an all-ones mask to each caller. I'd personally delay that until we have a use-case that requires passing an APInt.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D124930/new/
https://reviews.llvm.org/D124930
More information about the llvm-commits
mailing list