Skip to content

Commit 04364e1

Browse files
pratikasharsys_zuul
authored andcommitted
Remove unused code from rematerialization pass.
Change-Id: I5bc8498088f48a38ca5ecd48a56c68bb1b1d6bd1
1 parent 78fcc60 commit 04364e1

File tree

3 files changed

+2
-80
lines changed

3 files changed

+2
-80
lines changed

visa/FlowGraph.h

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -246,10 +246,6 @@ class G4_BB
246246
//
247247
unsigned traversal;
248248
//
249-
// its immediate dominator
250-
//
251-
G4_BB* idom;
252-
//
253249
// if the current BB is the return block after a CALL subroutine, then beforeCall points
254250
// to the BB before the subroutine call.
255251
//
@@ -377,7 +373,7 @@ class G4_BB
377373

378374
G4_BB(INST_LIST_NODE_ALLOCATOR& alloc, unsigned i, FlowGraph* fg) :
379375
id(i), preId(0), rpostId(0),
380-
traversal(0), idom(NULL), beforeCall(NULL),
376+
traversal(0), beforeCall(NULL),
381377
afterCall(NULL), calleeInfo(NULL), BBType(G4_BB_NONE_TYPE),
382378
inNaturalLoop(false), hasSendInBB(false), loopNestLevel(0), scopeID(0),
383379
inSimdFlow(false), divergent(false), physicalPred(NULL), physicalSucc(NULL),
@@ -407,8 +403,6 @@ class G4_BB
407403
void removePredEdge(G4_BB* pred);
408404
void writeBBId(std::ostream& cout) {cout << "BB" << id;}
409405
G4_BB* fallThroughBB();
410-
G4_BB* getIDom() {return idom;}
411-
void setIDom(G4_BB* dom) {idom = dom;}
412406
G4_BB* BBBeforeCall() {return beforeCall;}
413407
G4_BB* BBAfterCall() {return afterCall;}
414408
void setBBBeforeCall(G4_BB* before) {beforeCall = before;}

visa/Rematerialization.cpp

Lines changed: 0 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -500,15 +500,6 @@ namespace vISA
500500
if (!inSameSubroutine(bb, uniqueDefBB))
501501
return false;
502502

503-
#if 0
504-
// idom currently not computed
505-
506-
// Def must be in a dominating BB
507-
auto defDomsUse = doms.dominates(uniqueDefBB, bb);
508-
if (!defDomsUse)
509-
return false;
510-
#endif
511-
512503
// If uniqueDefBB is not under SIMD CF, current BB is under SIMD CF
513504
// then we can remat only if def has NoMask option set.
514505
if (!uniqueDefBB->isInSimdFlow() &&
@@ -1181,46 +1172,4 @@ namespace vISA
11811172

11821173
//unsigned int after = getNumSamplers(kernel);
11831174
}
1184-
1185-
void Dominators::computeDominators()
1186-
{
1187-
// Compute all doms for given bb.
1188-
// Flowgraph already has idoms for each bb.
1189-
for (auto&& bb : fg)
1190-
{
1191-
std::pair<G4_BB*, std::set<G4_BB*>> domBB;
1192-
domBB.first = bb;
1193-
auto idom = bb->getIDom();
1194-
while (idom)
1195-
{
1196-
domBB.second.insert(bb->getIDom());
1197-
idom = idom->getIDom();
1198-
}
1199-
}
1200-
}
1201-
bool Dominators::dominates(G4_BB* def, G4_BB* use)
1202-
{
1203-
auto dIt = dom.find(use);
1204-
if (dIt == dom.end())
1205-
return false;
1206-
1207-
auto bbIt = dIt->second.find(def);
1208-
if (bbIt == dIt->second.end())
1209-
return false;
1210-
1211-
return true;
1212-
}
1213-
1214-
void Dominators::dump()
1215-
{
1216-
for (auto&& bb : dom)
1217-
{
1218-
printf("BB%d:", bb.first->getId());
1219-
for (auto&& d : bb.second)
1220-
{
1221-
printf("BB%d, ", d->getId());
1222-
}
1223-
printf("\n\n");
1224-
}
1225-
}
12261175
}

visa/Rematerialization.h

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -70,34 +70,13 @@ namespace vISA
7070
std::unordered_set<unsigned int> rowsUsed;
7171
};
7272

73-
class Dominators
74-
{
75-
private:
76-
std::map<G4_BB*, std::set<G4_BB*>> dom;
77-
78-
FlowGraph& fg;
79-
80-
public:
81-
Dominators(FlowGraph& f) : fg(f)
82-
{
83-
computeDominators();
84-
}
85-
86-
// Store dominator information in data structure above for easy querying.
87-
// Flow graph stores immediate doms of each BB.s
88-
void computeDominators();
89-
bool dominates(G4_BB*, G4_BB*);
90-
void dump();
91-
};
92-
9373
class Rematerialization
9474
{
9575
private:
9676
G4_Kernel& kernel;
9777
LivenessAnalysis& liveness;
9878
GraphColor& coloring;
9979
GlobalRA& gra;
100-
Dominators doms;
10180
G4_Declare* samplerHeader = nullptr;
10281
unsigned int numRematsInLoop = 0;
10382
bool IRChanged = false;
@@ -223,7 +202,7 @@ namespace vISA
223202

224203
public:
225204
Rematerialization(G4_Kernel& k, LivenessAnalysis& l, GraphColor& c, RPE& r, GlobalRA& g) :
226-
kernel(k), liveness(l), coloring(c), gra(g), doms(k.fg), rpe(r)
205+
kernel(k), liveness(l), coloring(c), gra(g), rpe(r)
227206
{
228207
unsigned numGRFs = k.getNumRegTotal();
229208
auto scale = [=](unsigned threshold) -> unsigned {

0 commit comments

Comments
 (0)