[spirv] Add a pass to convert a sequence of composite insert to one composite construct
Sometimes we will see the following code pattern
%0 = spv.undef : vector<3xi32>
%1 = spv.CompositeInsert %val0 into %0 : vector<3xi32>
%2 = spv.CompositeInsert %val1 into %1 : vector<3xi32>
%3 = spv.CompositeInsert %val2 into %2 : vector<3xi32>
for composite types.
The above can be converted into a
%3 = spv.CompositeConstruct %val0, %val1, %val2 : vector<3xi32>
To simplify the code and remove undef.
https://github.com/google/clspv/blob/master/lib/RewriteInsertsPass.cpp in clspv can serve as an example.
@antiagainst @MaheshRavishankar according to this task, CompositeInsert and CompositeConstruct are not implemented yet, does anyone work on adding this instructions or I can take it?
Thanks!
SGTM. Please feel free to pick it up! Thanks! :)
@antiagainst does anyone have plans for this task?
Hey @denis0x0D, I don't think so. Please feel free to take it if you are interested. :)
@antiagainst thanks!