diff options
| author | Craig Topper <craig.topper@sifive.com> | 2025-01-09 09:09:55 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-01-09 09:09:55 -0800 |
| commit | e2449f1bceeefd4a603cae024a7a1db763df6834 (patch) | |
| tree | 9eab9f18a699c3e7746c40f2e9b4bb46ac7dd908 /llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp | |
| parent | a7cbd41000f55c0475bbfb42a2bb7af418c47a35 (diff) | |
[SelectionDAG] Use SDNode::op_iterator instead of SDNodeIterator. NFC (#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.
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp')
| -rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp index 9f57884eae04..56194e2614af 100644 --- a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp @@ -2985,13 +2985,11 @@ bool TargetLowering::SimplifyDemandedBits( if (!isTargetCanonicalConstantNode(Op) && DemandedBits.isSubsetOf(Known.Zero | Known.One)) { // Avoid folding to a constant if any OpaqueConstant is involved. - const SDNode *N = Op.getNode(); - for (SDNode *Op : - llvm::make_range(SDNodeIterator::begin(N), SDNodeIterator::end(N))) { - if (auto *C = dyn_cast<ConstantSDNode>(Op)) - if (C->isOpaque()) - return false; - } + if (llvm::any_of(Op->ops(), [](SDValue V) { + auto *C = dyn_cast<ConstantSDNode>(V); + return C && C->isOpaque(); + })) + return false; if (VT.isInteger()) return TLO.CombineTo(Op, TLO.DAG.getConstant(Known.One, dl, VT)); if (VT.isFloatingPoint()) |
