瀏覽代碼

[SLP] reduce duplicated code; NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369250 91177308-0d34-0410-b5e6-96231b3b80d8
Sanjay Patel 6 年之前
父節點
當前提交
e5efd69031
共有 1 個文件被更改,包括 4 次插入2 次删除
  1. 4 2
      lib/Transforms/Vectorize/SLPVectorizer.cpp

+ 4 - 2
lib/Transforms/Vectorize/SLPVectorizer.cpp

@@ -2176,11 +2176,13 @@ void BoUpSLP::buildTree_rec(ArrayRef<Value *> VL, unsigned Depth,
     if (Res.second)
       UniqueValues.emplace_back(V);
   }
-  if (UniqueValues.size() == VL.size()) {
+  size_t NumUniqueScalarValues = UniqueValues.size();
+  if (NumUniqueScalarValues == VL.size()) {
     ReuseShuffleIndicies.clear();
   } else {
     LLVM_DEBUG(dbgs() << "SLP: Shuffle for reused scalars.\n");
-    if (UniqueValues.size() <= 1 || !llvm::isPowerOf2_32(UniqueValues.size())) {
+    if (NumUniqueScalarValues <= 1 ||
+        !llvm::isPowerOf2_32(NumUniqueScalarValues)) {
       LLVM_DEBUG(dbgs() << "SLP: Scalar used twice in bundle.\n");
       newTreeEntry(VL, None /*not vectorized*/, UserTreeIdx);
       return;