[llvm] f5815b9 - [SLP] NFC. Set NumOperands directly if VL[0] is IntrinsicInst. (#111103)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 4 04:38:37 PDT 2024
Author: Han-Kuan Chen
Date: 2024-10-04T19:38:33+08:00
New Revision: f5815b9903321367990afea7618978ef880d4e99
URL: https://github.com/llvm/llvm-project/commit/f5815b9903321367990afea7618978ef880d4e99
DIFF: https://github.com/llvm/llvm-project/commit/f5815b9903321367990afea7618978ef880d4e99.diff
LOG: [SLP] NFC. Set NumOperands directly if VL[0] is IntrinsicInst. (#111103)
Added:
Modified:
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
index 7c15f2a8f77fa9..8a07f9c36cd448 100644
--- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
+++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
@@ -2312,10 +2312,10 @@ class BoUpSLP {
assert((empty() || VL.size() == getNumLanes()) &&
"Expected same number of lanes");
assert(isa<Instruction>(VL[0]) && "Expected instruction");
- unsigned NumOperands = cast<Instruction>(VL[0])->getNumOperands();
constexpr unsigned IntrinsicNumOperands = 2;
- if (isa<IntrinsicInst>(VL[0]))
- NumOperands = IntrinsicNumOperands;
+ unsigned NumOperands = isa<IntrinsicInst>(VL[0])
+ ? IntrinsicNumOperands
+ : cast<Instruction>(VL[0])->getNumOperands();
OpsVec.resize(NumOperands);
unsigned NumLanes = VL.size();
for (unsigned OpIdx = 0; OpIdx != NumOperands; ++OpIdx) {
More information about the llvm-commits
mailing list