[llvm] 25b90c4 - [SandboxVec][SeedCollector][NFC] Remove redundant 'else' and move the assertion within the 'if'

Vasileios Porpodas via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 10 14:55:28 PST 2025


Author: Vasileios Porpodas
Date: 2025-01-10T14:54:44-08:00
New Revision: 25b90c4ef67a01de6eba4f9e160d33772eb53454

URL: https://github.com/llvm/llvm-project/commit/25b90c4ef67a01de6eba4f9e160d33772eb53454
DIFF: https://github.com/llvm/llvm-project/commit/25b90c4ef67a01de6eba4f9e160d33772eb53454.diff

LOG: [SandboxVec][SeedCollector][NFC] Remove redundant 'else' and move the assertion within the 'if'

Added: 
    

Modified: 
    llvm/lib/Transforms/Vectorize/SandboxVectorizer/SeedCollector.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Vectorize/SandboxVectorizer/SeedCollector.cpp b/llvm/lib/Transforms/Vectorize/SandboxVectorizer/SeedCollector.cpp
index a3ce663407c4a9..bc86c785e84ae9 100644
--- a/llvm/lib/Transforms/Vectorize/SandboxVectorizer/SeedCollector.cpp
+++ b/llvm/lib/Transforms/Vectorize/SandboxVectorizer/SeedCollector.cpp
@@ -67,13 +67,13 @@ ArrayRef<Instruction *> SeedBundle::getSlice(unsigned StartIdx,
     BitCount = BitCountPowerOfTwo;
   }
 
-  assert((!ForcePowerOf2 || isPowerOf2_32(BitCount)) &&
-         "Must be a power of two");
   // Return any non-empty slice
-  if (NumElements > 1)
+  if (NumElements > 1) {
+    assert((!ForcePowerOf2 || isPowerOf2_32(BitCount)) &&
+           "Must be a power of two");
     return ArrayRef<Instruction *>(&Seeds[StartIdx], NumElements);
-  else
-    return {};
+  }
+  return {};
 }
 
 template <typename LoadOrStoreT>


        


More information about the llvm-commits mailing list