[PATCH] D79475: [SVE] Fix getAlignmentInfo for scalable vectors

David Sherwood via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 6 23:59:46 PDT 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rGa400aa5faf78: [SVE] Fix getAlignmentInfo for scalable vectors (authored by david-arm).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D79475/new/

https://reviews.llvm.org/D79475

Files:
  llvm/lib/IR/DataLayout.cpp


Index: llvm/lib/IR/DataLayout.cpp
===================================================================
--- llvm/lib/IR/DataLayout.cpp
+++ llvm/lib/IR/DataLayout.cpp
@@ -559,7 +559,10 @@
     // with what clang and llvm-gcc do.
     unsigned Alignment =
         getTypeAllocSize(cast<VectorType>(Ty)->getElementType());
-    Alignment *= cast<VectorType>(Ty)->getNumElements();
+    // We're only calculating a natural alignment, so it doesn't have to be
+    // based on the full size for scalable vectors. Using the minimum element
+    // count should be enough here.
+    Alignment *= cast<VectorType>(Ty)->getElementCount().Min;
     Alignment = PowerOf2Ceil(Alignment);
     return Align(Alignment);
    }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D79475.262557.patch
Type: text/x-patch
Size: 711 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200507/7071554a/attachment.bin>


More information about the llvm-commits mailing list