Issue |
120772
|
Summary |
[VectorCombine] foldInsExtVectorToShuffle can't handle length changing shuffles
|
Labels |
new issue
|
Assignees |
|
Reporter |
RKSimon
|
The VectorCombine::foldInsExtVectorToShuffle fold `insert (DstVec, (extract SrcVec, ExtIdx), InsIdx) --> shuffle (DstVec, SrcVec, Mask)` is limited to cases where the DstVec/SrcVec are the same vector type, but it might still be cost beneficial to fold these for non matching shuffles assuming any shuffle narrowing/widening for SrcVec is cheap enough.
```ll
define <4 x double> @ins0_v4f64_ext1_v2f64(<4 x double> %a, <2 x double> %b) {
%ext = extractelement <2 x double> %b, i32 1
%ins = insertelement <4 x double> %a, double %ext, i32 0
ret <4 x double> %ins
}
define <2 x double> @ins1_v2f64_ext1_v4f64(<2 x double> %a, <4 x double> %b) {
%ext = extractelement <4 x double> %b, i32 1
%ins = insertelement <2 x double> %a, double %ext, i32 1
ret <2 x double> %ins
}
```
InstCombine will handle some 'easy' cases, but ideally we need VectorCombine to handle this more generally as a cost driven combine.
CC @ParkHanbum who handled something similar recently for #115209
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs