[VectorCombine] widen a load with subvector insert
authorSanjay Patel <spatel@rotateright.com>
Thu, 10 Nov 2022 19:09:57 +0000 (14:09 -0500)
committerSanjay Patel <spatel@rotateright.com>
Thu, 10 Nov 2022 19:11:32 +0000 (14:11 -0500)
commitb57819e130258b4cb30912dcf2f420af94d43808
tree71b8b376a9050d1f6bad9fa43af8cf30a49d8857
parent244ac4fb1d7e96be9a0068751db42162772605a7
[VectorCombine] widen a load with subvector insert

This adapts/copies code from the existing fold that allows
widening of load scalar+insert. It can help in IR because
it removes a shuffle, and the backend can already narrow
loads if that is profitable in codegen.

We might be able to consolidate more of the logic, but
handling this basic pattern should be enough to make a small
difference on one of the motivating examples from issue #17113.
The final goal of combining loads on those patterns is not
solved though.

Differential Revision: https://reviews.llvm.org/D137341
llvm/lib/Transforms/Vectorize/VectorCombine.cpp
llvm/test/Transforms/VectorCombine/X86/load-widening.ll