[PATCH] D74424: [ConstantFold][SVE] Fix constant fold for FoldReinterpretLoadFromConstPtr.

Sander de Smalen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 11 12:06:10 PST 2020


sdesmalen added inline comments.


================
Comment at: llvm/lib/Analysis/ConstantFolding.cpp:522
       MapTy = Type::getInt64Ty(C->getContext());
-    else if (LoadTy->isVectorTy()) {
+    else if (LoadTy->isVectorTy() && !LoadTy->getVectorIsScalable()) {
       MapTy = PointerType::getIntNTy(C->getContext(),
----------------
It seems a bit arbitrary to special case this condition, given that the remainder of the function also doesn't work for scalable vectors (scalable vectors cannot be global variables according to the LangRef).

It probably makes more sense to bail out at the beginning of this function and to query the fixed-size explicit using `getTypeSizeInBits().getFixed()`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74424





More information about the llvm-commits mailing list