[llvm] [VectorCombine] Try to scalarize vector loads feeding bitcast instructions. (PR #164682)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 6 03:07:07 PST 2025


================
@@ -1845,49 +1847,42 @@ bool VectorCombine::foldSingleElementStore(Instruction &I) {
   return false;
 }
 
-/// Try to scalarize vector loads feeding extractelement instructions.
-bool VectorCombine::scalarizeLoadExtract(Instruction &I) {
-  if (!TTI.allowVectorElementIndexingUsingGEP())
-    return false;
-
+/// Try to scalarize vector loads feeding extractelement or bitcast
+/// instructions.
+bool VectorCombine::scalarizeLoad(Instruction &I) {
   Value *Ptr;
   if (!match(&I, m_Load(m_Value(Ptr))))
     return false;
 
   auto *LI = cast<LoadInst>(&I);
   auto *VecTy = cast<VectorType>(LI->getType());
-  if (LI->isVolatile() || !DL->typeSizeEqualsStoreSize(VecTy->getScalarType()))
+  if (!VecTy || LI->isVolatile() ||
----------------
fhahn wrote:

Does this need checking now, can the function be called for scalar loads?

https://github.com/llvm/llvm-project/pull/164682


More information about the llvm-commits mailing list