[PATCH] D128228: [BasicTTI] Account for vector of pointers in getMemoryOpCost

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 20 14:27:37 PDT 2022


reames created this revision.
reames added reviewers: craig.topper, kito-cheng.
Herald added subscribers: StephenFan, bollu, mcrosier.
Herald added a project: All.
reames requested review of this revision.
Herald added a project: LLVM.

By using getPrimitiveSizeInBits, we were getting 0 for every pointer type.  From the comments, that doesn't seem to be the expected behavior.  Unfortunately, I'm somewhat guessing here as this code causes no differences in "make check" if removed.

      

I'd originally seen this as a crash when trying to scalarize a <vscale x 1 x ptr> type coming from the vectorizer.  After bbf3fd, this no longer crashes since we correctly return invalid if the extending load/truncating store isn't legal.

Testing wise, this entire bit of code is, I think, unreachable from the cost model analysis interface.  I think this is only hit from the vectorizer, and even then, it's not really clear to me why.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D128228

Files:
  llvm/include/llvm/CodeGen/BasicTTIImpl.h


Index: llvm/include/llvm/CodeGen/BasicTTIImpl.h
===================================================================
--- llvm/include/llvm/CodeGen/BasicTTIImpl.h
+++ llvm/include/llvm/CodeGen/BasicTTIImpl.h
@@ -1204,7 +1204,7 @@
         // In practice it's not currently possible to have a change in lane
         // length for extending loads or truncating stores so both types should
         // have the same scalable property.
-        TypeSize::isKnownLT(Src->getPrimitiveSizeInBits(),
+        TypeSize::isKnownLT(DL.getTypeStoreSizeInBits(Src),
                             LT.second.getSizeInBits())) {
       // This is a vector load that legalizes to a larger type than the vector
       // itself. Unless the corresponding extending load or truncating store is


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D128228.438475.patch
Type: text/x-patch
Size: 772 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220620/d323096b/attachment.bin>


More information about the llvm-commits mailing list