[PATCH] D72524: [X86] Try to avoid casts around logical vector ops recursively.

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Jan 11 04:48:11 PST 2020


fhahn marked 2 inline comments as done.
fhahn added a comment.

In D72524#1814826 <https://reviews.llvm.org/D72524#1814826>, @RKSimon wrote:

> Not sure if its reusable but we already have signExtendBitcastSrcVector which we use for the (i16 bitcast (v16i1 x)) combine


It looks like signExtendBitcastSrcVector does something similar, pushing  extends down through AND/OR/XOR.

However they seem to be specialized for different cases, signExtendBitcastSrcVector focuses on SETCC defs, while in this patch we only consider truncates where we can use the operand without extending it (and constant vectors which are zero-extended). I think we could generalize and combine them, but I am not sure if either use case would benefit from matching more general patterns. I think that would be best evaluated in a potential follow up, what do you think?



================
Comment at: llvm/lib/Target/X86/X86ISelLowering.cpp:39815
+  if (!--Depth)
+    return SDValue();
+
----------------
RKSimon wrote:
> Very minor, but in most depth search cases we start at Depth = 0 and bail once it reaches at maximum.
Thanks, I've changed the code to be in line with what we do in SelectionDAG, including using SelectionDAG::MaxRecursionLimit, which is conveniently exposed.


================
Comment at: llvm/lib/Target/X86/X86ISelLowering.cpp:39881
   // Generate the wide operation.
-  SDValue Op = DAG.getNode(Narrow->getOpcode(), DL, VT, N0, N1);
-  unsigned Opcode = N->getOpcode();
-  switch (Opcode) {
+  SDValue Op = PromoteMaskArithmetic(Narrow.getNode(), VT, DAG, 8);
+  if (!Op)
----------------
RKSimon wrote:
> Does max depth have to be 8 or would we be better using SelectionDAG::MaxRecursionDepth = 6?
8 was arbitrarily chosen, but I agree it makes more sense to re-used SelectionDAG::MaxRecursionDepth 


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72524/new/

https://reviews.llvm.org/D72524





More information about the llvm-commits mailing list