[llvm] [LoadStoreVectorizer] Support vectorization of mixed-type contiguous accesses (PR #177908)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 10 03:05:00 PDT 2026


================
@@ -783,17 +783,25 @@ const Value *Value::stripAndAccumulateConstantOffsets(
         }
       }
       V = GEP->getPointerOperand();
-    } else if (Operator::getOpcode(V) == Instruction::BitCast ||
-               Operator::getOpcode(V) == Instruction::AddrSpaceCast) {
+    } else if (Operator::getOpcode(V) == Instruction::BitCast) {
+      // Match stripPointerCastsAndOffsets: only look through ptr->ptr (or
+      // ptr-vector) bitcasts. Do not follow bitcast from byte/int/etc. to ptr
+      // (e.g. lossless bN -> ptr reconstitution) — the operand is not a
+      // pointer and pointer offset stripping cannot continue.
+      const Value *Src = cast<Operator>(V)->getOperand(0);
+      if (!Src->getType()->isPtrOrPtrVectorTy())
+        return V;
+      V = Src;
+    } else if (Operator::getOpcode(V) == Instruction::AddrSpaceCast) {
----------------
arsenm wrote:

The Value changes should be a separate PR 

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


More information about the llvm-commits mailing list