[llvm] 3eeebfe - [RDF] Minor refactoring for clarity, NFC
Krzysztof Parzyszek via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 14 09:12:32 PDT 2023
Author: Krzysztof Parzyszek
Date: 2023-06-14T09:12:08-07:00
New Revision: 3eeebfe83baf6d86104bee0996f10eb80becf86d
URL: https://github.com/llvm/llvm-project/commit/3eeebfe83baf6d86104bee0996f10eb80becf86d
DIFF: https://github.com/llvm/llvm-project/commit/3eeebfe83baf6d86104bee0996f10eb80becf86d.diff
LOG: [RDF] Minor refactoring for clarity, NFC
Added:
Modified:
llvm/lib/CodeGen/RDFGraph.cpp
Removed:
################################################################################
diff --git a/llvm/lib/CodeGen/RDFGraph.cpp b/llvm/lib/CodeGen/RDFGraph.cpp
index 9dd3a9d9ac7de..ece51eae5dd65 100644
--- a/llvm/lib/CodeGen/RDFGraph.cpp
+++ b/llvm/lib/CodeGen/RDFGraph.cpp
@@ -1119,7 +1119,7 @@ void DataFlowGraph::reset() {
Ref DataFlowGraph::getNextRelated(Instr IA, Ref RA) const {
assert(IA.Id != 0 && RA.Id != 0);
- auto Related = [this, RA](Ref TA) -> bool {
+ auto IsRelated = [this, RA](Ref TA) -> bool {
if (TA.Addr->getKind() != RA.Addr->getKind())
return false;
if (!getPRI().equal_to(TA.Addr->getRegRef(*this),
@@ -1128,24 +1128,26 @@ Ref DataFlowGraph::getNextRelated(Instr IA, Ref RA) const {
}
return true;
};
- auto RelatedStmt = [&Related, RA](Ref TA) -> bool {
- return Related(TA) && &RA.Addr->getOp() == &TA.Addr->getOp();
- };
- auto RelatedPhi = [&Related, RA](Ref TA) -> bool {
- if (!Related(TA))
+
+ RegisterRef RR = RA.Addr->getRegRef(*this);
+ if (IA.Addr->getKind() == NodeAttrs::Stmt) {
+ auto Cond = [&IsRelated, RA](Ref TA) -> bool {
+ return IsRelated(TA) && &RA.Addr->getOp() == &TA.Addr->getOp();
+ };
+ return RA.Addr->getNextRef(RR, Cond, true, *this);
+ }
+
+ assert(IA.Addr->getKind() == NodeAttrs::Phi);
+ auto Cond = [&IsRelated, RA](Ref TA) -> bool {
+ if (!IsRelated(TA))
return false;
if (TA.Addr->getKind() != NodeAttrs::Use)
return true;
// For phi uses, compare predecessor blocks.
- const NodeAddr<const PhiUseNode *> TUA = TA;
- const NodeAddr<const PhiUseNode *> RUA = RA;
- return TUA.Addr->getPredecessor() == RUA.Addr->getPredecessor();
+ return PhiUse(TA).Addr->getPredecessor() ==
+ PhiUse(RA).Addr->getPredecessor();
};
-
- RegisterRef RR = RA.Addr->getRegRef(*this);
- if (IA.Addr->getKind() == NodeAttrs::Stmt)
- return RA.Addr->getNextRef(RR, RelatedStmt, true, *this);
- return RA.Addr->getNextRef(RR, RelatedPhi, true, *this);
+ return RA.Addr->getNextRef(RR, Cond, true, *this);
}
// Find the next node related to RA in IA that satisfies condition P.
@@ -1571,8 +1573,7 @@ void DataFlowGraph::linkBlockRefs(DefStackMap &DefM, Block BA) {
if (NA.Addr->getKind() != NodeAttrs::Use)
return false;
assert(NA.Addr->getFlags() & NodeAttrs::PhiRef);
- PhiUse PUA = NA;
- return PUA.Addr->getPredecessor() == BA.Id;
+ return PhiUse(NA).Addr->getPredecessor() == BA.Id;
};
RegisterAggr EHLiveIns = getLandingPadLiveIns();
More information about the llvm-commits
mailing list