Skip to content

Commit 5d6c157

Browse files
committed
[ARM] Use VT vector size, not the array size, for determining if a shuffle corresponds to a VREV instruction
This logic matches that of AArch64's REVMask detection.
1 parent 72ce629 commit 5d6c157

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

llvm/lib/Target/ARM/ARMTargetTransformInfo.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,7 @@ inline bool isVREVMask(ArrayRef<int> M, EVT VT, unsigned BlockSize) {
347347
if (EltSz != 8 && EltSz != 16 && EltSz != 32)
348348
return false;
349349

350+
unsigned NumElts = VT.getVectorNumElements();
350351
unsigned BlockElts = M[0] + 1;
351352
// If the first shuffle index is UNDEF, be optimistic.
352353
if (M[0] < 0)
@@ -355,7 +356,7 @@ inline bool isVREVMask(ArrayRef<int> M, EVT VT, unsigned BlockSize) {
355356
if (BlockSize <= EltSz || BlockSize != BlockElts * EltSz)
356357
return false;
357358

358-
for (unsigned i = 0, e = M.size(); i < e; ++i) {
359+
for (unsigned i = 0; i < NumElts; ++i) {
359360
if (M[i] < 0)
360361
continue; // ignore UNDEF indices
361362
if ((unsigned)M[i] != (i - i % BlockElts) + (BlockElts - 1 - i % BlockElts))

0 commit comments

Comments
 (0)