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

Jonas Paulsson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 15 05:01:14 PST 2017


jonpa marked 3 inline comments as done.
jonpa added inline comments.


================
Comment at: lib/CodeGen/SelectionDAG/SelectionDAG.cpp:3036
+        unsigned ExtrOpBits = Extr.getOperand(0).getScalarValueSizeInBits();
+        if (ExtrOpBits >= VTBits)
+          Tmp = ComputeNumSignBits(Op.getOperand(i)->getOperand(0), Depth + 1);
----------------
efriedma wrote:
> You aren't handling the case where ExtrOpBits > VTBits correctly (you have to subtract "ExtrOpBits - VTBits" bits from the result).
> 
> Can we avoid making BUILD_VECTORS in the cases where this would be necessary?
Well, we don't have to handle them if we handle the VSELECT early...


================
Comment at: lib/CodeGen/SelectionDAG/SelectionDAG.cpp:3049
+  case ISD::BITCAST:
+    return ComputeNumSignBits(Op.getOperand(0), Depth + 1);
   }
----------------
efriedma wrote:
> Bitcasts aren't transparent in general: the integer width changes, or the operand might not even be an integer.
Does this look ok now?


https://reviews.llvm.org/D29489





More information about the llvm-commits mailing list