[PATCH] D25691: [DAGCombiner] Add vector demanded elements support to computeKnownBits

Eli Friedman via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 17 15:56:38 PDT 2016


efriedma added a comment.

Maybe it would make more sense to do this in the IR version of computeKnownBits first?  We should prefer to perform optimizations on IR where possible.

I think this approach makes sense; we don't want to track each individual bit of a very wide vector.



================
Comment at: lib/CodeGen/SelectionDAG/SelectionDAG.cpp:2101
+      SDValue Src = Op.getOperand(0);
+      uint64_t Idx = SubIdx->getZExtValue();
+      unsigned NumSrcElts = Src.getValueType().getVectorNumElements();
----------------
Need to check that SubIdx is less than the number of elements in the vector.


================
Comment at: lib/CodeGen/SelectionDAG/SelectionDAG.cpp:2549
+      APInt DemandedElt = APInt::getOneBitSet(VecVT.getVectorNumElements(),
+                                              ConstEltNo->getZExtValue());
+      computeKnownBits(InVec, KnownZero, KnownOne, DemandedElt, Depth + 1);
----------------
You need to check whether ConstEltNo is less than the number of elements in the vector.


Repository:
  rL LLVM

https://reviews.llvm.org/D25691





More information about the llvm-commits mailing list