Skip to content

Commit e2449f1

Browse files
authored
[SelectionDAG] Use SDNode::op_iterator instead of SDNodeIterator. NFC (llvm#122147)
I think SDNodeIterator primarily exists because GraphTraits requires an iterator that dereferences to SDNode*. op_iterator dereferences to SDUse* which is implicitly convertible to SDValue. This piece of code can use SDValue instead of SDNode* so we should prefer to use the the more common op_iterator.
1 parent a7cbd41 commit e2449f1

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2985,13 +2985,11 @@ bool TargetLowering::SimplifyDemandedBits(
29852985
if (!isTargetCanonicalConstantNode(Op) &&
29862986
DemandedBits.isSubsetOf(Known.Zero | Known.One)) {
29872987
// Avoid folding to a constant if any OpaqueConstant is involved.
2988-
const SDNode *N = Op.getNode();
2989-
for (SDNode *Op :
2990-
llvm::make_range(SDNodeIterator::begin(N), SDNodeIterator::end(N))) {
2991-
if (auto *C = dyn_cast<ConstantSDNode>(Op))
2992-
if (C->isOpaque())
2993-
return false;
2994-
}
2988+
if (llvm::any_of(Op->ops(), [](SDValue V) {
2989+
auto *C = dyn_cast<ConstantSDNode>(V);
2990+
return C && C->isOpaque();
2991+
}))
2992+
return false;
29952993
if (VT.isInteger())
29962994
return TLO.CombineTo(Op, TLO.DAG.getConstant(Known.One, dl, VT));
29972995
if (VT.isFloatingPoint())

0 commit comments

Comments
 (0)