Skip to content

Commit 93247ff

Browse files
pratikasharigcbot
authored andcommitted
Preserve logic of adding weak edges
This change preserves logic of adding weak edges in augmentation. Current logic implies duplicate weak edges are added causing pessimistic degree computation. But in order to keep the larger change NFC, we preserve this logic. Later (non-NFC) change will modify logic so we don't add duplicate weak edges.
1 parent f31c646 commit 93247ff

15 files changed

+1526
-367
lines changed

visa/FlowGraph.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4622,18 +4622,18 @@ void RelocationEntry::dump(std::ostream &os) const {
46224622
os << " symbol = " << symName << "; src" << opndPos << "\n";
46234623
}
46244624

4625-
void FuncInfo::dump() const {
4626-
std::cerr << "subroutine " << getId() << "("
4625+
void FuncInfo::dump(std::ostream &os) const {
4626+
os << "subroutine " << getId() << "("
46274627
<< getInitBB()->front()->getLabelStr() << ")\n";
4628-
std::cerr << "\tentryBB=" << getInitBB()->getId()
4628+
os << "\tentryBB=" << getInitBB()->getId()
46294629
<< ", exitBB=" << getExitBB()->getId() << "\n";
4630-
std::cerr << "\tCallees: ";
4630+
os << "\tCallees: ";
46314631
for (auto callee : callees) {
4632-
std::cerr << callee->getId() << " ";
4632+
os << callee->getId() << " ";
46334633
}
4634-
std::cerr << "\n\tBB list: ";
4634+
os << "\n\tBB list: ";
46354635
for (auto bb : BBList) {
4636-
std::cerr << bb->getId() << " ";
4636+
os << bb->getId() << " ";
46374637
}
4638-
std::cerr << "\n";
4638+
os << "\n";
46394639
}

visa/FlowGraph.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,12 @@ class FuncInfo {
8888
void addCallee(FuncInfo *fn) { callees.push_back(fn); }
8989
std::list<FuncInfo *> &getCallees() { return callees; }
9090

91+
// const version that does O(n) lookup.
92+
bool contains(G4_BB *bb) const {
93+
auto it = std::find(BBList.begin(), BBList.end(), bb);
94+
return it != BBList.end();
95+
}
96+
9197
bool contains(G4_BB *bb) {
9298
if (BBSet.size() != BBList.size()) {
9399
BBSet.clear();
@@ -120,7 +126,7 @@ class FuncInfo {
120126
unsigned getPostID() const { return postID; }
121127
void setPostID(unsigned id) { postID = id; }
122128

123-
void dump() const;
129+
void dump(std::ostream &os = std::cerr) const;
124130
}; // FuncInfo
125131

126132
//

0 commit comments

Comments
 (0)