diff options
author | Sanjay Patel <spatel@rotateright.com> | 2020-05-11 16:34:19 -0400 |
---|---|---|
committer | Sanjay Patel <spatel@rotateright.com> | 2020-05-11 16:36:07 -0400 |
commit | 5f05c2f59a7fc666605a74e8616af17da8efa132 (patch) | |
tree | b3784ed0f6772e3081c43636bed30e8f1462e43f /llvm/lib/CodeGen/CodeGenPrepare.cpp | |
parent | 8d94d3c3b44c3a27a69b153cef9be4b8e481150e (diff) | |
download | llvm-5f05c2f59a7fc666605a74e8616af17da8efa132.zip llvm-5f05c2f59a7fc666605a74e8616af17da8efa132.tar.gz llvm-5f05c2f59a7fc666605a74e8616af17da8efa132.tar.bz2 |
[CGP] remove duplicate function for finding a splat shuffle; NFC
Diffstat (limited to 'llvm/lib/CodeGen/CodeGenPrepare.cpp')
-rw-r--r-- | llvm/lib/CodeGen/CodeGenPrepare.cpp | 14 |
1 files changed, 1 insertions, 13 deletions
diff --git a/llvm/lib/CodeGen/CodeGenPrepare.cpp b/llvm/lib/CodeGen/CodeGenPrepare.cpp index eceee30..881366c 100644 --- a/llvm/lib/CodeGen/CodeGenPrepare.cpp +++ b/llvm/lib/CodeGen/CodeGenPrepare.cpp @@ -6415,18 +6415,6 @@ bool CodeGenPrepare::optimizeSelectInst(SelectInst *SI) { return true; } -static bool isBroadcastShuffle(ShuffleVectorInst *SVI) { - ArrayRef<int> Mask(SVI->getShuffleMask()); - int SplatElem = -1; - for (unsigned i = 0; i < Mask.size(); ++i) { - if (SplatElem != -1 && Mask[i] != -1 && Mask[i] != SplatElem) - return false; - SplatElem = Mask[i]; - } - - return true; -} - /// Some targets have expensive vector shifts if the lanes aren't all the same /// (e.g. x86 only introduced "vpsllvd" and friends with AVX2). In these cases /// it's often worth sinking a shufflevector splat down to its use so that @@ -6440,7 +6428,7 @@ bool CodeGenPrepare::optimizeShuffleVectorInst(ShuffleVectorInst *SVI) { // We only expect better codegen by sinking a shuffle if we can recognise a // constant splat. - if (!isBroadcastShuffle(SVI)) + if (getSplatIndex(SVI->getShuffleMask()) < 0) return false; // InsertedShuffles - Only insert a shuffle in each block once. |