[PATCH] D86268: [DAGTypeLegalizer] Handle ZERO_EXTEND of promoted integer in WidenVecRes_Convert.

Ulrich Weigand via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 28 06:17:56 PDT 2020


uweigand added inline comments.


================
Comment at: llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp:3317
+      Opcode = ISD::TRUNCATE;
+  }
+
----------------
jonpa wrote:
> Does this assume that the final (unroll) part of the method will always be reached? In that case, should that be made explicit with an extra "else" wrapping the cases for Widening/Legal, and alsomaybe  an assert that the promoted  InVT does then not need Widening or is legal?
> 
> 
The result of ZExtPromotedInteger is guaranteed to always have legal type, so afterwards getTypeAction(InVT) will always be TypeWidenLegal.

However, I'm no longer sure all cases are covered here.  The situation is that we have a vector zero-extend operation from a type vNiA to another type vNiB (same number of elements, B > A).  We know vNiB is not legal, and the preferred legal type is vMiB (with some M > N).  If we enter the if, we also know that vNiA is not legal, and the preferred legal type is vNiC (with some C > A).

Therefore, we want to transform the initial operation vNiA -> vNiB into an operation vNiC -> vMiB.

But we do not know anything about the relationship between C and B necessarily.  If C is still smaller than B, the operation remains an extension.  If C is now larger than B, the operation becomes a truncation.  Both these cases are handled.  But C could now also be equal to B on some platforms (this cannot happen on Z since all legal vector types have the same total size, but in theory it could happen on a platform that supports multiple legal vector widths).  In this case the operation should be neither an extension nor a truncation, just a vector widening.  I don't see this handled.


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

https://reviews.llvm.org/D86268



More information about the llvm-commits mailing list