[PATCH] D79416: [SVE] Fix wrong usage of getNumElements() in matchIntrinsicType
David Sherwood via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu May 7 03:55:08 PDT 2020
david-arm updated this revision to Diff 262589.
david-arm edited the summary of this revision.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D79416/new/
https://reviews.llvm.org/D79416
Files:
llvm/lib/IR/Function.cpp
llvm/test/CodeGen/AArch64/sve-bad-intrinsics.ll
Index: llvm/test/CodeGen/AArch64/sve-bad-intrinsics.ll
===================================================================
--- /dev/null
+++ llvm/test/CodeGen/AArch64/sve-bad-intrinsics.ll
@@ -0,0 +1,13 @@
+; RUN: not llc -mtriple=aarch64-linux-gnu -mattr=+sve < %s 2>%t
+; RUN: FileCheck --check-prefix=CHECK-ERROR %s <%t
+
+; CHECK-ERROR: error: invalid forward reference to function 'llvm.aarch64.sve.add.nxv2i64' with wrong type
+
+define <2 x i64> @add_i64_invalid(<2 x i1> %pg, <2 x i64> %a, <2 x i64> %b) {
+ %out = call <2 x i64> @llvm.aarch64.sve.add.nxv2i64(<2 x i1> %pg,
+ <2 x i64> %a,
+ <2 x i64> %b)
+ ret <2 x i64> %out
+}
+
+declare <vscale x 2 x i64> @llvm.aarch64.sve.add.nxv2i64(<vscale x 2 x i1>, <vscale x 2 x i64>, <vscale x 2 x i64>)
Index: llvm/lib/IR/Function.cpp
===================================================================
--- llvm/lib/IR/Function.cpp
+++ llvm/lib/IR/Function.cpp
@@ -1180,7 +1180,7 @@
case IITDescriptor::Quad: return !Ty->isFP128Ty();
case IITDescriptor::Integer: return !Ty->isIntegerTy(D.Integer_Width);
case IITDescriptor::Vector: {
- VectorType *VT = dyn_cast<VectorType>(Ty);
+ FixedVectorType *VT = dyn_cast<FixedVectorType>(Ty);
return !VT || VT->getNumElements() != D.Vector_Width ||
matchIntrinsicType(VT->getElementType(), Infos, ArgTys,
DeferredChecks, IsDeferredCheck);
@@ -1357,7 +1357,11 @@
case IITDescriptor::ScalableVecArgument: {
if (!isa<ScalableVectorType>(Ty))
return true;
- return matchIntrinsicType(Ty, Infos, ArgTys, DeferredChecks,
+ ScalableVectorType *STy = cast<ScalableVectorType>(Ty);
+ unsigned MinElts = STy->getMinNumElements();
+ FixedVectorType *FVTy =
+ FixedVectorType::get(STy->getElementType(), MinElts);
+ return matchIntrinsicType(FVTy, Infos, ArgTys, DeferredChecks,
IsDeferredCheck);
}
case IITDescriptor::VecOfBitcastsToInt: {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D79416.262589.patch
Type: text/x-patch
Size: 2114 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200507/af58898c/attachment-0001.bin>
More information about the llvm-commits
mailing list