[PATCH] D79416: [SVE] Fix wrong usage of getNumElements() in matchIntrinsicType

David Sherwood via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 5 06:25:53 PDT 2020


david-arm created this revision.
david-arm added reviewers: sdesmalen, c-rhodes, ctetreau.
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.

I have changed the Vector case in matchIntrinsicType to use
getElementCount().Min instead of getNumElements() because we
assume that the ScalableVecArgument descriptor preceeded it.
Ideally we would assert this somehow, but that would require
some refactoring of matchIntrinsicType to pass in the previous
descriptor.

The changes are covered by this existing test:

CodeGen/AArch64/sve-intrinsics-fp-converts.ll


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D79416

Files:
  llvm/lib/IR/Function.cpp


Index: llvm/lib/IR/Function.cpp
===================================================================
--- llvm/lib/IR/Function.cpp
+++ llvm/lib/IR/Function.cpp
@@ -1180,8 +1180,10 @@
     case IITDescriptor::Quad: return !Ty->isFP128Ty();
     case IITDescriptor::Integer: return !Ty->isIntegerTy(D.Integer_Width);
     case IITDescriptor::Vector: {
+      // TODO: It would be nice if we could assert that we'd seen
+      // a ScalableVecArgument prior to this for ScalableVectorTypes
       VectorType *VT = dyn_cast<VectorType>(Ty);
-      return !VT || VT->getNumElements() != D.Vector_Width ||
+      return !VT || VT->getElementCount().Min != D.Vector_Width ||
              matchIntrinsicType(VT->getElementType(), Infos, ArgTys,
                                 DeferredChecks, IsDeferredCheck);
     }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D79416.262092.patch
Type: text/x-patch
Size: 810 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200505/aae87166/attachment.bin>


More information about the llvm-commits mailing list