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

Simon Pilgrim via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 30 02:53:23 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;
----------------
RKSimon wrote:

Yes we use the InstSimplifyFolder in the Builder which should handle this

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


More information about the cfe-commits mailing list