[PATCH] D78967: [SVE] Remove invalid usage of VectorType::getNumElements in Function

Christopher Tetreault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 27 15:07:19 PDT 2020


ctetreau created this revision.
Herald added subscribers: llvm-commits, psnobl, rkruppe, hiraditya, kristof.beyls, tschuett.
Herald added a reviewer: rengolin.
Herald added a reviewer: efriedma.
Herald added a project: LLVM.
ctetreau added reviewers: kmclaughlin, c-rhodes, sdesmalen.

Removes usage of VectorType::getNumElements identified by test located
at CodeGen/aarch64-sve-intrinsics/acle_sve_dot.c. This code explicitly
converts a potentially fixed length vector to scalable vector by
constructing the ElementCount = {getNumElements(), true}


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D78967

Files:
  llvm/lib/IR/Function.cpp


Index: llvm/lib/IR/Function.cpp
===================================================================
--- llvm/lib/IR/Function.cpp
+++ llvm/lib/IR/Function.cpp
@@ -1075,7 +1075,12 @@
     return Tys[D.getOverloadArgNumber()];
   case IITDescriptor::ScalableVecArgument: {
     auto *Ty = cast<VectorType>(DecodeFixedType(Infos, Tys, Context));
-    return VectorType::get(Ty->getElementType(), {Ty->getNumElements(), true});
+    if (isa<ScalableVectorType>(Ty))
+      return Ty;
+    // FIXME: Explicit conversion from fixed to scalable vector. Can/should this
+    // happen?
+    return ScalableVectorType::get(Ty->getElementType(),
+                                   Ty->getElementCount().Min);
   }
   }
   llvm_unreachable("unhandled");


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D78967.260462.patch
Type: text/x-patch
Size: 743 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200427/dd8273fb/attachment.bin>


More information about the llvm-commits mailing list