forked from OSchip/llvm-project
Update DataflowSolver to handle the case where a successor/predecessor block
could be NULL. This allows the solver to handle optimized CFGs where branches can be determined during CFG-construction to be infeasible. llvm-svn: 76452
This commit is contained in:
parent
47d2859b3e
commit
619eece347
|
@ -194,9 +194,9 @@ private:
|
||||||
|
|
||||||
while (!WorkList.isEmpty()) {
|
while (!WorkList.isEmpty()) {
|
||||||
const CFGBlock* B = WorkList.dequeue();
|
const CFGBlock* B = WorkList.dequeue();
|
||||||
ProcessMerge(cfg,B);
|
ProcessMerge(cfg, B);
|
||||||
ProcessBlock(B, recordStmtValues, AnalysisDirTag());
|
ProcessBlock(B, recordStmtValues, AnalysisDirTag());
|
||||||
UpdateEdges(cfg,B,TF.getVal());
|
UpdateEdges(cfg, B, TF.getVal());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -211,16 +211,22 @@ private:
|
||||||
bool firstMerge = true;
|
bool firstMerge = true;
|
||||||
|
|
||||||
for (PrevBItr I=ItrTraits::PrevBegin(B),E=ItrTraits::PrevEnd(B); I!=E; ++I){
|
for (PrevBItr I=ItrTraits::PrevBegin(B),E=ItrTraits::PrevEnd(B); I!=E; ++I){
|
||||||
|
|
||||||
|
CFGBlock *PrevBlk = *I;
|
||||||
|
|
||||||
|
if (!PrevBlk)
|
||||||
|
continue;
|
||||||
|
|
||||||
typename EdgeDataMapTy::iterator EI =
|
typename EdgeDataMapTy::iterator EI =
|
||||||
M.find(ItrTraits::PrevEdge(B, *I));
|
M.find(ItrTraits::PrevEdge(B, PrevBlk));
|
||||||
|
|
||||||
if (EI != M.end()) {
|
if (EI != M.end()) {
|
||||||
if (firstMerge) {
|
if (firstMerge) {
|
||||||
firstMerge = false;
|
firstMerge = false;
|
||||||
V.copyValues(EI->second);
|
V.copyValues(EI->second);
|
||||||
}
|
}
|
||||||
else Merge(V,EI->second);
|
else
|
||||||
|
Merge(V, EI->second);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -263,7 +269,8 @@ private:
|
||||||
// forward/backward analysis respectively)
|
// forward/backward analysis respectively)
|
||||||
void UpdateEdges(CFG& cfg, const CFGBlock* B, ValTy& V) {
|
void UpdateEdges(CFG& cfg, const CFGBlock* B, ValTy& V) {
|
||||||
for (NextBItr I=ItrTraits::NextBegin(B), E=ItrTraits::NextEnd(B); I!=E; ++I)
|
for (NextBItr I=ItrTraits::NextBegin(B), E=ItrTraits::NextEnd(B); I!=E; ++I)
|
||||||
UpdateEdgeValue(ItrTraits::NextEdge(B, *I),V,*I);
|
if (CFGBlock *NextBlk = *I)
|
||||||
|
UpdateEdgeValue(ItrTraits::NextEdge(B, NextBlk),V, NextBlk);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// UpdateEdgeValue - Update the value associated with a given edge.
|
/// UpdateEdgeValue - Update the value associated with a given edge.
|
||||||
|
|
Loading…
Reference in New Issue