Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -216,9 +216,18 @@ class MemDGNode final : public DGNode {
/// Memory predecessors.
DenseSet<MemDGNode *> MemPreds;
friend class PredIterator; // For MemPreds.

void setNextNode(MemDGNode *N) { NextMemN = N; }
void setPrevNode(MemDGNode *N) { PrevMemN = N; }
/// Creates both edges: this<->N.
void setNextNode(MemDGNode *N) {
NextMemN = N;
if (NextMemN != nullptr)
NextMemN->PrevMemN = this;
}
/// Creates both edges: N<->this.
void setPrevNode(MemDGNode *N) {
PrevMemN = N;
if (PrevMemN != nullptr)
PrevMemN->NextMemN = this;
}
friend class DependencyGraph; // For setNextNode(), setPrevNode().
void detachFromChain() {
if (PrevMemN != nullptr)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -283,8 +283,6 @@ void DependencyGraph::createNewNodes(const Interval<Instruction> &NewInterval) {
// Build the Mem node chain.
if (auto *MemN = dyn_cast<MemDGNode>(N)) {
MemN->setPrevNode(LastMemN);
if (LastMemN != nullptr)
LastMemN->setNextNode(MemN);
LastMemN = MemN;
}
}
Expand All @@ -302,7 +300,6 @@ void DependencyGraph::createNewNodes(const Interval<Instruction> &NewInterval) {
"Wrong order!");
if (LinkTopN != nullptr && LinkBotN != nullptr) {
LinkTopN->setNextNode(LinkBotN);
LinkBotN->setPrevNode(LinkTopN);
}
#ifndef NDEBUG
// TODO: Remove this once we've done enough testing.
Expand Down Expand Up @@ -394,22 +391,14 @@ void DependencyGraph::notifyMoveInstr(Instruction *I, const BBIterator &To) {
if (To != BB->end()) {
DGNode *ToN = getNodeOrNull(&*To);
if (ToN != nullptr) {
MemDGNode *PrevMemN = getMemDGNodeBefore(ToN, /*IncludingN=*/false);
MemDGNode *NextMemN = getMemDGNodeAfter(ToN, /*IncludingN=*/true);
MemN->PrevMemN = PrevMemN;
if (PrevMemN != nullptr)
PrevMemN->NextMemN = MemN;
MemN->NextMemN = NextMemN;
if (NextMemN != nullptr)
NextMemN->PrevMemN = MemN;
MemN->setPrevNode(getMemDGNodeBefore(ToN, /*IncludingN=*/false));
MemN->setNextNode(getMemDGNodeAfter(ToN, /*IncludingN=*/true));
}
} else {
// MemN becomes the last instruction in the BB.
auto *TermN = getNodeOrNull(BB->getTerminator());
if (TermN != nullptr) {
MemDGNode *PrevMemN = getMemDGNodeBefore(TermN, /*IncludingN=*/false);
PrevMemN->NextMemN = MemN;
MemN->PrevMemN = PrevMemN;
MemN->setPrevNode(getMemDGNodeBefore(TermN, /*IncludingN=*/false));
} else {
// The terminator is outside the DAG interval so do nothing.
}
Expand Down
Loading