[PATCH] D80826: [CodeGen][SVE] Replace deprecated calls in getCopyFromPartsVector()

Henry Kao via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 29 12:00:34 PDT 2020


hkao13 created this revision.
hkao13 added reviewers: sdesmalen, kmclaughlin, dancgr, efriedma, each, andwar, rengolin.
Herald added subscribers: llvm-commits, psnobl, rkruppe, hiraditya, kristof.beyls, tschuett.
Herald added a project: LLVM.

Replaced getVectorNumElements() with getVectorElementCount(). Added operator overloads for class ElementCount. Fixes warning in several AArch64 unit tests.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D80826

Files:
  llvm/include/llvm/Support/TypeSize.h
  llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp


Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
===================================================================
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
@@ -438,7 +438,7 @@
     // vector widening case (e.g. <2 x float> -> <4 x float>).  Extract the
     // elements we want.
     if (PartEVT.getVectorElementType() == ValueVT.getVectorElementType()) {
-      assert(PartEVT.getVectorNumElements() > ValueVT.getVectorNumElements() &&
+      assert(PartEVT.getVectorElementCount() > ValueVT.getVectorElementCount() &&
              "Cannot narrow, it would be a lossy transformation");
       return DAG.getNode(ISD::EXTRACT_SUBVECTOR, DL, ValueVT, Val,
                          DAG.getVectorIdxConstant(0, DL));
@@ -448,7 +448,7 @@
     if (ValueVT.getSizeInBits() == PartEVT.getSizeInBits())
       return DAG.getNode(ISD::BITCAST, DL, ValueVT, Val);
 
-    assert(PartEVT.getVectorNumElements() == ValueVT.getVectorNumElements() &&
+    assert(PartEVT.getVectorElementCount() == ValueVT.getVectorElementCount() &&
       "Cannot handle this kind of promotion");
     // Promoted vector extract
     return DAG.getAnyExtOrTrunc(Val, DL, ValueVT);
@@ -461,7 +461,7 @@
       TLI.isTypeLegal(ValueVT))
     return DAG.getNode(ISD::BITCAST, DL, ValueVT, Val);
 
-  if (ValueVT.getVectorNumElements() != 1) {
+  if (ValueVT.getVectorElementCount().Min != 1) {
      // Certain ABIs require that vectors are passed as integers. For vectors
      // are the same size, this is an obvious bitcast.
      if (ValueVT.getSizeInBits() == PartEVT.getSizeInBits()) {
@@ -484,7 +484,7 @@
 
   // Handle cases such as i8 -> <1 x i1>
   EVT ValueSVT = ValueVT.getVectorElementType();
-  if (ValueVT.getVectorNumElements() == 1 && ValueSVT != PartEVT) {
+  if (ValueVT.getVectorElementCount().Min == 1 && ValueSVT != PartEVT) {
     if (ValueSVT.getSizeInBits() == PartEVT.getSizeInBits())
       Val = DAG.getNode(ISD::BITCAST, DL, ValueSVT, Val);
     else
Index: llvm/include/llvm/Support/TypeSize.h
===================================================================
--- llvm/include/llvm/Support/TypeSize.h
+++ llvm/include/llvm/Support/TypeSize.h
@@ -49,6 +49,18 @@
   bool operator!=(const ElementCount& RHS) const {
     return !(*this == RHS);
   }
+  bool operator>(const ElementCount& RHS) const {
+    return Min > RHS.Min && Scalable == RHS.Scalable;
+  }
+  bool operator>=(const ElementCount& RHS) const {
+    return Min >= RHS.Min && Scalable == RHS.Scalable;
+  }
+  bool operator<(const ElementCount& RHS) const {
+    return Min < RHS.Min && Scalable == RHS.Scalable;
+  }
+  bool operator<=(const ElementCount& RHS) const {
+    return Min <= RHS.Min && Scalable == RHS.Scalable;
+  }
 };
 
 // This class is used to represent the size of types. If the type is of fixed


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D80826.267311.patch
Type: text/x-patch
Size: 2869 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200529/e14c8bea/attachment.bin>


More information about the llvm-commits mailing list