[llvm] d967aaa - [DAG] BuildVectorSDNode::getSplatValue - pull out repeated getNumOperands() calls. NFCI.
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 18 08:21:26 PDT 2020
Author: Simon Pilgrim
Date: 2020-09-18T16:10:23+01:00
New Revision: d967aaa8fa801e2ed355058db98fd43e4b05edb6
URL: https://github.com/llvm/llvm-project/commit/d967aaa8fa801e2ed355058db98fd43e4b05edb6
DIFF: https://github.com/llvm/llvm-project/commit/d967aaa8fa801e2ed355058db98fd43e4b05edb6.diff
LOG: [DAG] BuildVectorSDNode::getSplatValue - pull out repeated getNumOperands() calls. NFCI.
Added:
Modified:
llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Removed:
################################################################################
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
index f94e0a034807..b9674c08a3b7 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
@@ -9766,16 +9766,16 @@ bool BuildVectorSDNode::isConstantSplat(APInt &SplatValue, APInt &SplatUndef,
SDValue BuildVectorSDNode::getSplatValue(const APInt &DemandedElts,
BitVector *UndefElements) const {
+ unsigned NumOps = getNumOperands();
if (UndefElements) {
UndefElements->clear();
- UndefElements->resize(getNumOperands());
+ UndefElements->resize(NumOps);
}
- assert(getNumOperands() == DemandedElts.getBitWidth() &&
- "Unexpected vector size");
+ assert(NumOps == DemandedElts.getBitWidth() && "Unexpected vector size");
if (!DemandedElts)
return SDValue();
SDValue Splatted;
- for (unsigned i = 0, e = getNumOperands(); i != e; ++i) {
+ for (unsigned i = 0; i != NumOps; ++i) {
if (!DemandedElts[i])
continue;
SDValue Op = getOperand(i);
More information about the llvm-commits
mailing list