[PATCH] D150515: [ConstantFold] use StoreSize for VectorType byte checking

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun May 14 02:59:20 PDT 2023


nikic added inline comments.


================
Comment at: llvm/lib/Analysis/ConstantFolding.cpp:513
       EltTy = cast<FixedVectorType>(C->getType())->getElementType();
+      EltSize = DL.getTypeStoreSize(EltTy);
     }
----------------
This fix is correct, but incomplete: We should also add a `if (!DL.typeSizeEqualsStoreSize(EltTy)) return false;` here. For non-byte-sized vectors the memory layout is packed, while this code will assume that there is padding to the next byte boundary between elements.


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

https://reviews.llvm.org/D150515



More information about the llvm-commits mailing list