[PATCH] D83198: [CodeGen] Fix warnings in DAGTypeLegalizer::SplitVecOp_EXTRACT_SUBVECTOR

David Sherwood via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 6 12:53:26 PDT 2020


david-arm created this revision.
Herald added subscribers: llvm-commits, hiraditya.
Herald added a reviewer: rengolin.
Herald added a project: LLVM.

Fixes warnings in this test:

  sve-sext-zext.ll


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D83198

Files:
  llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp


Index: llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp
===================================================================
--- llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp
+++ llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp
@@ -2179,13 +2179,18 @@
   SDValue Idx = N->getOperand(1);
   SDLoc dl(N);
   SDValue Lo, Hi;
+
+  assert(SubVT.isScalableVector() ==
+             N->getOperand(0).getValueType().isScalableVector() &&
+         "We only support extracting fixed length vectors from legal scalable "
+         "vector types");
   GetSplitVector(N->getOperand(0), Lo, Hi);
 
-  uint64_t LoElts = Lo.getValueType().getVectorNumElements();
+  uint64_t LoElts = Lo.getValueType().getVectorMinNumElements();
   uint64_t IdxVal = cast<ConstantSDNode>(Idx)->getZExtValue();
 
   if (IdxVal < LoElts) {
-    assert(IdxVal + SubVT.getVectorNumElements() <= LoElts &&
+    assert(IdxVal + SubVT.getVectorMinNumElements() <= LoElts &&
            "Extracted subvector crosses vector split!");
     return DAG.getNode(ISD::EXTRACT_SUBVECTOR, dl, SubVT, Lo, Idx);
   } else {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D83198.275609.patch
Type: text/x-patch
Size: 1091 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200706/f7cb7b4c/attachment.bin>


More information about the llvm-commits mailing list