[PATCH] D29489: Optimize SETCC + VSEL of incompatible or illegal types

Simon Pilgrim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 20 05:15:51 PST 2017


RKSimon added inline comments.


================
Comment at: lib/CodeGen/SelectionDAG/SelectionDAG.cpp:3049
+  case ISD::VECTOR_SHUFFLE: {
+    unsigned Min = UINT_MAX;
+    for (unsigned i = 0, e = Op.getNumOperands(); i != e; ++i) {
----------------
This isn't going to work - you need to check through the shuffle mask elements looking for -ve indices (which represent undefs) - if it occurs then NumSignBits = 1.

You also need to determine which of the 2 input operands are actually referenced:
Op0/LHS => 0 <= index < NumElts
Op1/RHS => NumElts <= index < (2*NumElts)

And then determine the minimum NumSignBits of those operand(s).

Look at the SelectionDAG::computeKnownBits ISD::VECTOR_SHUFFLE implementation for reference.


https://reviews.llvm.org/D29489





More information about the llvm-commits mailing list