[PATCH] D38832: [X86][SelectionDAG] Add support for simplifying demanded bits of target nodes. Use it to simplify demanded bits of CMOV

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 30 11:09:27 PDT 2017


craig.topper added inline comments.


================
Comment at: lib/Target/X86/X86ISelLowering.cpp:27322
+  return TargetLowering::SimplifyDemandedBitsForTargetNode(Op, DemandedMask,
+                                                           Known, TLO, Depth);
+}
----------------
RKSimon wrote:
> craig.topper wrote:
> > RKSimon wrote:
> > > craig.topper wrote:
> > > > RKSimon wrote:
> > > > > For the other 'ForTargetNode' style calls we don't do a 'drop through' to the base class - should we match that approach here?
> > > > The default implementation was less trivial than the other 2 cases so I wasn't sure if we wanted to replicate that code.
> > > If you drop the early break after the SimplifyDemandedBitsForTargetNode call in TargetLowering::SimplifyDemandedBits then you should be able to remove this and the extra code in TargetLowering::SimplifyDemandedBitsForTargetNode?
> > But doesn't that mean we'd effectively compute the known bits and do the recursion twice when it doesn't simplify?
> Does it? I thought it'd just mean that we go through computeKnownBits to rediscover that its a target node instead of directly to computeKnownBitsForTargetNode.
But SimplifyDemandedBitsForTarget node would have recursed and calculated known bits regardless of whether it returned true or false.  If it returned false we already have the known its. If I remove the early break we'll throw that information away and recurse again through computeKnownBits right?


https://reviews.llvm.org/D38832





More information about the llvm-commits mailing list