[llvm] r334699 - [CostModel] Cleanup isSingleSourceVectorMask to match other shuffle matchers. NFCI.
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 14 02:48:20 PDT 2018
Author: rksimon
Date: Thu Jun 14 02:48:19 2018
New Revision: 334699
URL: http://llvm.org/viewvc/llvm-project?rev=334699&view=rev
Log:
[CostModel] Cleanup isSingleSourceVectorMask to match other shuffle matchers. NFCI.
Modified:
llvm/trunk/lib/Analysis/TargetTransformInfo.cpp
Modified: llvm/trunk/lib/Analysis/TargetTransformInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/TargetTransformInfo.cpp?rev=334699&r1=334698&r2=334699&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/TargetTransformInfo.cpp (original)
+++ llvm/trunk/lib/Analysis/TargetTransformInfo.cpp Thu Jun 14 02:48:19 2018
@@ -645,17 +645,19 @@ static bool isReverseVectorMask(ArrayRef
}
static bool isSingleSourceVectorMask(ArrayRef<int> Mask) {
- bool Vec0 = false;
- bool Vec1 = false;
- for (unsigned i = 0, NumVecElts = Mask.size(); i < NumVecElts; ++i) {
- if (Mask[i] >= 0) {
- if ((unsigned)Mask[i] >= NumVecElts)
- Vec1 = true;
- else
- Vec0 = true;
- }
+ bool ShuffleLHS = false;
+ bool ShuffleRHS = false;
+ unsigned MaskSize = Mask.size();
+
+ for (unsigned i = 0; i < MaskSize && !(ShuffleLHS && ShuffleRHS); ++i) {
+ if (Mask[i] < 0)
+ continue;
+ if ((unsigned)Mask[i] >= MaskSize)
+ ShuffleRHS = true;
+ else
+ ShuffleLHS = true;
}
- return !(Vec0 && Vec1);
+ return !(ShuffleLHS && ShuffleRHS);
}
static bool isZeroEltBroadcastVectorMask(ArrayRef<int> Mask) {
More information about the llvm-commits
mailing list