[llvm-branch-commits] [VectorCombine] Fix miscompile caused by collisions in foldShuffleToIdentity (PR #188668)

via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Mar 25 20:19:55 PDT 2026


https://github.com/wangleiat created https://github.com/llvm/llvm-project/pull/188668

`foldShuffleToIdentity` previously used a `SmallPtrSet<Use *, 4>` keyed
only on the first lane's `Use *` to track equivalent sequences. This
caused incorrect folding when different shuffle sequences shared the
same initial `Use *`.

This patch fixes the miscompile by tracking the full `InstLane` sequence
via `SmallVector<SmallVector<InstLane>>`, ensuring exact sequence
matching.

It also corrects an implicit `Use *` to `Value *` conversion by changing
`dyn_cast<Constant>(FrontU)` to `dyn_cast<Constant>(FrontU->get())`.

Fixes #180338





More information about the llvm-branch-commits mailing list