Skip to content

Commit 5f05c2f

Browse files
committed
[CGP] remove duplicate function for finding a splat shuffle; NFC
1 parent 8d94d3c commit 5f05c2f

File tree

1 file changed

+1
-13
lines changed

1 file changed

+1
-13
lines changed

llvm/lib/CodeGen/CodeGenPrepare.cpp

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6415,18 +6415,6 @@ bool CodeGenPrepare::optimizeSelectInst(SelectInst *SI) {
64156415
return true;
64166416
}
64176417

6418-
static bool isBroadcastShuffle(ShuffleVectorInst *SVI) {
6419-
ArrayRef<int> Mask(SVI->getShuffleMask());
6420-
int SplatElem = -1;
6421-
for (unsigned i = 0; i < Mask.size(); ++i) {
6422-
if (SplatElem != -1 && Mask[i] != -1 && Mask[i] != SplatElem)
6423-
return false;
6424-
SplatElem = Mask[i];
6425-
}
6426-
6427-
return true;
6428-
}
6429-
64306418
/// Some targets have expensive vector shifts if the lanes aren't all the same
64316419
/// (e.g. x86 only introduced "vpsllvd" and friends with AVX2). In these cases
64326420
/// it's often worth sinking a shufflevector splat down to its use so that
@@ -6440,7 +6428,7 @@ bool CodeGenPrepare::optimizeShuffleVectorInst(ShuffleVectorInst *SVI) {
64406428

64416429
// We only expect better codegen by sinking a shuffle if we can recognise a
64426430
// constant splat.
6443-
if (!isBroadcastShuffle(SVI))
6431+
if (getSplatIndex(SVI->getShuffleMask()) < 0)
64446432
return false;
64456433

64466434
// InsertedShuffles - Only insert a shuffle in each block once.

0 commit comments

Comments
 (0)