[PATCH] D47156: [DAGCombiner] isAllOnesConstantOrAllOnesSplatConstant(): look through bitcasts

Simon Pilgrim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 21 13:10:02 PDT 2018


RKSimon added inline comments.


================
Comment at: lib/CodeGen/SelectionDAG/DAGCombiner.cpp:917
+  if (N.getOpcode() == ISD::BITCAST)
+    return isAllOnesConstantOrAllOnesSplatConstant(N.getOperand(0));
   unsigned BitWidth = N.getScalarValueSizeInBits();
----------------
lebedev.ri wrote:
> RKSimon wrote:
> > Don't make it recursive:
> > ```
> > while (N.getOpcode() == ISD::BITCAST)
> >   N = N->getOperand(0);
> > ```
> > 
> > 
> Oh, i can do that?
> I was under impression that would change the the N itself (in IR/DAG), not just the variable N here.
No, it;s fine - see ISD::isBuildVectorAllZeros - it might have been a problem if you weren't just interested in ALL bits being set.


Repository:
  rL LLVM

https://reviews.llvm.org/D47156





More information about the llvm-commits mailing list