Use more foreach loops in SelectionDAG. NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@242208 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Pete Cooper 2015-07-14 21:54:45 +00:00
parent 6e50c921d0
commit 6e6119a92e

View File

@ -151,8 +151,8 @@ bool ISD::isBuildVectorAllZeros(const SDNode *N) {
if (N->getOpcode() != ISD::BUILD_VECTOR) return false; if (N->getOpcode() != ISD::BUILD_VECTOR) return false;
bool IsAllUndef = true; bool IsAllUndef = true;
for (unsigned i = 0, e = N->getNumOperands(); i < e; ++i) { for (const SDValue &Op : N->op_values()) {
if (N->getOperand(i).getOpcode() == ISD::UNDEF) if (Op.getOpcode() == ISD::UNDEF)
continue; continue;
IsAllUndef = false; IsAllUndef = false;
// Do not accept build_vectors that aren't all constants or which have non-0 // Do not accept build_vectors that aren't all constants or which have non-0
@ -163,12 +163,11 @@ bool ISD::isBuildVectorAllZeros(const SDNode *N) {
// We only want to check enough bits to cover the vector elements, because // We only want to check enough bits to cover the vector elements, because
// we care if the resultant vector is all zeros, not whether the individual // we care if the resultant vector is all zeros, not whether the individual
// constants are. // constants are.
SDValue Zero = N->getOperand(i);
unsigned EltSize = N->getValueType(0).getVectorElementType().getSizeInBits(); unsigned EltSize = N->getValueType(0).getVectorElementType().getSizeInBits();
if (ConstantSDNode *CN = dyn_cast<ConstantSDNode>(Zero)) { if (ConstantSDNode *CN = dyn_cast<ConstantSDNode>(Op)) {
if (CN->getAPIntValue().countTrailingZeros() < EltSize) if (CN->getAPIntValue().countTrailingZeros() < EltSize)
return false; return false;
} else if (ConstantFPSDNode *CFPN = dyn_cast<ConstantFPSDNode>(Zero)) { } else if (ConstantFPSDNode *CFPN = dyn_cast<ConstantFPSDNode>(Op)) {
if (CFPN->getValueAPF().bitcastToAPInt().countTrailingZeros() < EltSize) if (CFPN->getValueAPF().bitcastToAPInt().countTrailingZeros() < EltSize)
return false; return false;
} else } else
@ -6694,8 +6693,8 @@ bool SDValue::isOperandOf(SDNode *N) const {
} }
bool SDNode::isOperandOf(SDNode *N) const { bool SDNode::isOperandOf(SDNode *N) const {
for (unsigned i = 0, e = N->NumOperands; i != e; ++i) for (const SDValue &Op : N->op_values())
if (this == N->OperandList[i].getNode()) if (this == Op.getNode())
return true; return true;
return false; return false;
} }