[PATCH] D82329: [SVE] Fix invalid Scalable to fixed width vetor type demotion in LLT

Christopher Tetreault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 22 13:59:45 PDT 2020


ctetreau created this revision.
Herald added subscribers: llvm-commits, psnobl, rkruppe, hiraditya, tschuett.
Herald added a reviewer: efriedma.
Herald added a project: LLVM.

getLLTForType calls LLT::vector(Ty->getNumElements(), ScalarTy) for
fixed width and scalable vectors, losing information on the scalability
of the input vector. Rather than miscompile, return an invalid LLT for
scalable vectors.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D82329

Files:
  llvm/lib/CodeGen/LowLevelType.cpp


Index: llvm/lib/CodeGen/LowLevelType.cpp
===================================================================
--- llvm/lib/CodeGen/LowLevelType.cpp
+++ llvm/lib/CodeGen/LowLevelType.cpp
@@ -18,7 +18,7 @@
 using namespace llvm;
 
 LLT llvm::getLLTForType(Type &Ty, const DataLayout &DL) {
-  if (auto VTy = dyn_cast<VectorType>(&Ty)) {
+  if (auto VTy = dyn_cast<FixedVectorType>(&Ty)) {
     auto NumElements = VTy->getNumElements();
     LLT ScalarTy = getLLTForType(*VTy->getElementType(), DL);
     if (NumElements == 1)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D82329.272538.patch
Type: text/x-patch
Size: 523 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200622/907c7db0/attachment.bin>


More information about the llvm-commits mailing list