[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
Mon Feb 2 09:46:36 PST 2026
================
@@ -5475,8 +5479,14 @@ bool VectorCombine::shrinkLoadForShuffles(Instruction &I) {
return false;
// Create new load of smaller vector.
+ Type *IndexTy = DL->getIndexType(PtrOp->getType());
+ Value *NewPtr = LowOffset > 0u
+ ? Builder.CreateInBoundsPtrAdd(
+ PtrOp, ConstantInt::get(IndexTy, LowOffset))
+ : PtrOp;
+
auto *NewLoad = cast<LoadInst>(
- Builder.CreateAlignedLoad(NewLoadTy, PtrOp, OldLoad->getAlign()));
+ Builder.CreateAlignedLoad(NewLoadTy, NewPtr, OldLoad->getAlign()));
----------------
RKSimon wrote:
@PeddleSpam You need to adjust the alignment as well
https://github.com/llvm/llvm-project/pull/149093
More information about the cfe-commits
mailing list