Issue 120764
Summary [VectorCombine] foldShuffleOfShuffles - failure to merge nested shuffles with common operands
Labels missed-optimization, llvm:transforms
Assignees
Reporter RKSimon
    ```ll
define <4 x double> @add_v4f64_u123(<4 x double> %a, <4 x double> %b) {
  %1 = shufflevector <4 x double> %b, <4 x double> %a, <4 x i32> <i32 poison, i32 0, i32 6, i32 poison>
  %2 = shufflevector <4 x double> %b, <4 x double> %a, <4 x i32> <i32 poison, i32 1, i32 7, i32 poison>
  %3 = shufflevector <4 x double> %1, <4 x double> %b, <4 x i32> <i32 poison, i32 1, i32 2, i32 6>
 %4 = shufflevector <4 x double> %2, <4 x double> %b, <4 x i32> <i32 poison, i32 1, i32 2, i32 7>
  %result = fadd <4 x double> %3, %4
  ret <4 x double> %result
}
```
All shuffles only have 2 operands, so we should be able to fold to:
```ll
define <4 x double> @add_v4f64_u123(<4 x double> %a, <4 x double> %b) {
  %1 = shufflevector <4 x double> %a, <4 x double> %b, <4 x i32> <i32 poison, i32 4, i32 2, i32 6>
  %2 = shufflevector <4 x double> %a, <4 x double> %b, <4 x i32> <i32 poison, i32 5, i32 3, i32 7>
  %result = fadd <4 x double> %1, %2
  ret <4 x double> %result
}
```
Pulled out of #34072
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to