[clang] [llvm] [VectorCombine] Trim low end of loads used in shufflevector rebroadcasts. (PR #149093)

Matt Arsenault via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 29 14:52:40 PST 2026


================
@@ -4789,8 +4793,14 @@ bool VectorCombine::shrinkLoadForShuffles(Instruction &I) {
         return false;
 
       // Create new load of smaller vector.
+      Type *IndexTy = DL->getIndexType(PtrOp->getType());
+      Constant *PtrOffset = ConstantInt::get(IndexTy, LowOffset);
+      Value *NewPtr = LowOffset > 0u
+                          ? Builder.CreateInBoundsPtrAdd(PtrOp, PtrOffset)
+                          : PtrOp;
----------------
arsenm wrote:

```suggestion
      Value *NewPtr = LowOffset > 0u
                          ? Builder.CreateInBoundsPtrAdd(PtrOp, ConstantInt::get(IndexTy, LowOffset))
                          : PtrOp;
```

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


More information about the cfe-commits mailing list