[llvm] Reland "[VectorCombine] Combine adjacent loads feeding as shuffle operands" (PR #229662)
Thurston Dang via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 7 10:02:24 PDT 2026
thurstond wrote:
> > > Have you tested this reland with a UBSan-enabled clang? [8d05ee1](https://github.com/llvm/llvm-project/commit/8d05ee14ac96ed82ffef778f4c6684ded7d2911d) only fixes one overflow. In #229306 I had added fixes in two more places (and added another test case).
> >
> >
> > Non-UBSan presubmit is failing (https://github.com/llvm/llvm-project/actions/runs/37577968281/job/112651004719?pr=229662#logs):
> > ```
> > # | opt: /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/IR/Instructions.cpp:1966: bool isSingleSourceMaskImpl(ArrayRef<int>, int): Assertion `I >= 0 && I < (NumOpElts * 2) && "Out-of-bounds shuffle mask element"' failed.
> > ```
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > which is one of the extra overflow cases that was handled in #229306.
>
> Added the test case and handled it. Thanks
https://github.com/llvm/llvm-project/pull/229662/changes/8c430b9f0fb72e9ba6dec22b040e3586f5ac9939 lets VectorCombine::foldShuffleOfAdjacentLoads() avoid the unsigned integer overflow in ShuffleVectorInst::isSingleSourceMask(), but that footgun still exists, and arguably it was made worse by https://github.com/llvm/llvm-project/pull/229662/changes/aaf3c0c8a018ef4221f080798c02db0942f8625d (because it is became possible for a Mask to be validated by ShuffleVectorInst::isValidOperands but then assert out in ShuffleVectorInst::isSingleSourceMask()).
P.S. Nit: “In general, you should avoid rebasing a Pull Request and force pushing to the branch that’s the root of the Pull Request during the review. This action will make the context of the old changes and comments harder to find and read. If you want to make your pull request up-to-date with main, you might consider updating your branch, as described in the previous section.” (https://llvm.org/docs/GitHub.html#rebasing-pull-requests-and-force-pushes)
https://github.com/llvm/llvm-project/pull/229662
More information about the llvm-commits
mailing list