Skip to content

Commit 0a65849

Browse files
authored
[X86] EltsFromConsecutiveLoads - only attempt to recognise reverse patterns from all load element patterns (#170852)
Noticed while investigating a regression reported after #168706 - don't attempt this if any elements are zero/undef - there is a potential issue with reverse(insert_subvector(undef,load(),0)) patterns - but I haven't managed to create a fail case.
1 parent 1df7b51 commit 0a65849

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

llvm/lib/Target/X86/X86ISelLowering.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7571,7 +7571,8 @@ static SDValue EltsFromConsecutiveLoads(EVT VT, ArrayRef<SDValue> Elts,
75717571

75727572
// REVERSE - attempt to match the loads in reverse and then shuffle back.
75737573
// TODO: Do this for any permute or mismatching element counts.
7574-
if (Depth == 0 && !ZeroMask && TLI.isTypeLegal(VT) && VT.isVector() &&
7574+
if (Depth == 0 && ZeroMask.isZero() && UndefMask.isZero() &&
7575+
TLI.isTypeLegal(VT) && VT.isVector() &&
75757576
NumElems == VT.getVectorNumElements()) {
75767577
SmallVector<SDValue, 16> ReverseElts(Elts.rbegin(), Elts.rend());
75777578
if (SDValue RevLd = EltsFromConsecutiveLoads(

0 commit comments

Comments
 (0)