Skip to content

[VectorCombine] foldShuffleOfShuffles - failure to fold shuffle(shuffle(x,y),undef) length changing masks #144656

@RKSimon

Description

@RKSimon
define <8 x float> @shuffle(<4 x float> %a0, <4 x float> %a1) {
  %x = shufflevector <4 x float> %a0, <4 x float> %a1, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
  %y = shufflevector <8 x float> %x, <8 x float> poison, <8 x i32> <i32 0, i32 4, i32 1, i32 5, i32 2, i32 6, i32 3, i32 7>
  ret <8 x float> %y
}

foldShuffleOfShuffles currently fails to merge "permute of shuffle" patterns if the vector length changes

But it will happily fold:

define <4 x float> @shuffle2(<4 x float> %a0, <4 x float> %a1) {
  %x = shufflevector <4 x float> %a0, <4 x float> %a1, <4 x i32> <i32 0, i32 4, i32 5, i32 3>
  %y = shufflevector <4 x float> %x, <4 x float> poison, <4 x i32> <i32 0, i32 3, i32 1, i32 2>
  ret <4 x float> %y
}
->
define <4 x float> @shuffle2(<4 x float> %a0, <4 x float> %a1) {
  %y = shufflevector <4 x float> %a0, <4 x float> %a1, <4 x i32> <i32 0, i32 3, i32 4, i32 5>
  ret <4 x float> %y
}

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions