[PATCH] D96953: [SVE] fix IRMover returning wrong modified vector type
Nashe Mncube via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 18 05:40:35 PST 2021
nasherm created this revision.
Herald added subscribers: psnobl, hiraditya, tschuett.
Herald added a reviewer: efriedma.
nasherm requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Modified scalable vector types weren't correctly returned at link-time.
The previous behaviour was a FixedVectorType was constructed
when expecting a ScalableVectorType. This commit has added a regression
test which re-creates the failure as well as a fix.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D96953
Files:
llvm/lib/Linker/IRMover.cpp
llvm/test/Linker/fixed-vector-type-construction.ll
llvm/test/Linker/sve-type-construction.ll
Index: llvm/test/Linker/sve-type-construction.ll
===================================================================
--- /dev/null
+++ llvm/test/Linker/sve-type-construction.ll
@@ -0,0 +1,7 @@
+; RUN: llvm-link %p/fixed-vector-type-construction.ll %p/sve-type-construction.ll -S -o - | FileCheck %s
+%t = type {i32, float}
+; CHECK: define void @foo(<4 x
+; CHECK; define void @bar(<vscale x 4 x
+define void @bar(<vscale x 4 x %t*> %x) {
+ ret void
+}
Index: llvm/test/Linker/fixed-vector-type-construction.ll
===================================================================
--- /dev/null
+++ llvm/test/Linker/fixed-vector-type-construction.ll
@@ -0,0 +1,5 @@
+; RUN: true
+%t = type {i32, float}
+define void @foo(<4 x %t*> %x) {
+ ret void
+}
\ No newline at end of file
Index: llvm/lib/Linker/IRMover.cpp
===================================================================
--- llvm/lib/Linker/IRMover.cpp
+++ llvm/lib/Linker/IRMover.cpp
@@ -298,7 +298,8 @@
return *Entry = ArrayType::get(ElementTypes[0],
cast<ArrayType>(Ty)->getNumElements());
case Type::ScalableVectorTyID:
- // FIXME: handle scalable vectors
+ return *Entry = ScalableVectorType::get(ElementTypes[0],
+ cast<ScalableVectorType>(Ty)->getMinNumElements());
case Type::FixedVectorTyID:
return *Entry = FixedVectorType::get(
ElementTypes[0], cast<FixedVectorType>(Ty)->getNumElements());
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D96953.324607.patch
Type: text/x-patch
Size: 1486 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210218/1aab4d8a/attachment.bin>
More information about the llvm-commits
mailing list