[PATCH] D41643: [DAG] Fix for Bug PR34620 - Allow SimplifyDemandedBits to look through bitcasted constants

Sam Conrad via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 1 14:45:26 PST 2018

sameconrad added inline comments.

Comment at: lib/CodeGen/SelectionDAG/TargetLowering.cpp:1225
+    // do this on a recursive call where Known may be useful to the caller.
+    if (Depth > 0 && isConstOrConstSplat(Op.getOperand(0))) {
+      TLO.DAG.computeKnownBits(Op, Known, Depth);
RKSimon wrote:
> craig.topper wrote:
> > RKSimon wrote:
> > > Would this catch more if we used isConstantOrConstantVector from DAGCombiner.cpp (we'd have to move it to SelectionDAG.h or similar)?
> > Why do we need to the constant qualifier at all? Isn't it generally useful to get any known bits from the other side of the bitcast?
> +1 Removing the isConstOrConstSplat condition entirely unearths a number of other improvements to various tests.
I've updated to remove the isConstOrConstSplat condition.  I originally added that because I was worried about hurting build times too much (since computeKnownBits can get pretty expensive), but if it unearths improvements to a lot of tests then it makes sense to remove the check.  I'll work on updating the tests that are affected.


More information about the llvm-commits mailing list