dead code: fix for entry statements, improve perfomance
This commit is contained in:
@@ -1028,7 +1028,8 @@ static bool runAnalysis(SgProject &project, const int curr_regime, const bool ne
|
|||||||
{
|
{
|
||||||
auto funcsForFile = getObjectForFileFromMap(file_name, allFuncInfo);
|
auto funcsForFile = getObjectForFileFromMap(file_name, allFuncInfo);
|
||||||
for (auto& func : funcsForFile)
|
for (auto& func : funcsForFile)
|
||||||
removeDeadCode(func->funcPointer, allFuncInfo, commonBlocks);
|
if(func->funcPointer->variant() != ENTRY_STAT)
|
||||||
|
removeDeadCode(func->funcPointer, allFuncInfo, commonBlocks);
|
||||||
}
|
}
|
||||||
else if (curr_regime == TEST_PASS)
|
else if (curr_regime == TEST_PASS)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -228,7 +228,9 @@ public:
|
|||||||
updated |= updateNextNotEmpty();
|
updated |= updateNextNotEmpty();
|
||||||
|
|
||||||
updated |= updateJumpStatus();
|
updated |= updateJumpStatus();
|
||||||
updated |= this->forwardData({ });
|
|
||||||
|
if(updated)
|
||||||
|
this->forwardData({ });
|
||||||
|
|
||||||
return updated;
|
return updated;
|
||||||
}
|
}
|
||||||
@@ -316,6 +318,7 @@ public:
|
|||||||
{
|
{
|
||||||
setBlock(block);
|
setBlock(block);
|
||||||
useful.resize(block->getInstructions().size(), false);
|
useful.resize(block->getInstructions().size(), false);
|
||||||
|
this->forwardData({ });
|
||||||
}
|
}
|
||||||
|
|
||||||
const vector<bool>& getResult() { return useful; }
|
const vector<bool>& getResult() { return useful; }
|
||||||
@@ -371,7 +374,8 @@ void removeDeadCode(SgStatement* func,
|
|||||||
set<SAPFOR::BasicBlock*> reachable;
|
set<SAPFOR::BasicBlock*> reachable;
|
||||||
|
|
||||||
for (auto b : cfg_pair.second)
|
for (auto b : cfg_pair.second)
|
||||||
if(b->getInstructions().front()->isHeader())
|
if(b->getInstructions().front()->isHeader() ||
|
||||||
|
b->getInstructions().front()->getInstruction()->getOperation() == SAPFOR::CFG_OP::ENTRY)
|
||||||
reachable.insert(b);
|
reachable.insert(b);
|
||||||
|
|
||||||
set<SAPFOR::BasicBlock*> worklist = reachable;
|
set<SAPFOR::BasicBlock*> worklist = reachable;
|
||||||
|
|||||||
Reference in New Issue
Block a user