Skip to content

Commit

Permalink
Merge pull request #1147 from xudon9/perf-issue-fix
Browse files Browse the repository at this point in the history
Fix bug in inst2LabelMap handling
  • Loading branch information
yuleisui authored Jul 8, 2023
2 parents 31f6fcd + d377ac9 commit 6e59fd2
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions svf/include/SVFIR/SVFStatements.h
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,10 @@ class SVFStmt : public GenericPAGEdgeTy
static inline GEdgeFlag makeEdgeFlagWithAddionalOpnd(GEdgeKind k,
const SVFVar* var)
{
Var2LabelMap::const_iterator iter = var2LabelMap.find(var);
u64_t label = (iter != var2LabelMap.end()) ? iter->second
: multiOpndLabelCounter++;
auto it_inserted = var2LabelMap.emplace(var, multiOpndLabelCounter);
if (it_inserted.second)
++multiOpndLabelCounter;
u64_t label = it_inserted.first->second;
return (label << EdgeKindMaskBits) | k;
}

Expand All @@ -182,9 +183,10 @@ class SVFStmt : public GenericPAGEdgeTy
static inline GEdgeFlag makeEdgeFlagWithCallInst(GEdgeKind k,
const ICFGNode* cs)
{
Inst2LabelMap::const_iterator iter = inst2LabelMap.find(cs);
u64_t label = (iter != inst2LabelMap.end()) ? iter->second
: callEdgeLabelCounter++;
auto it_inserted = inst2LabelMap.emplace(cs, callEdgeLabelCounter);
if (it_inserted.second)
++callEdgeLabelCounter;
u64_t label = it_inserted.first->second;
return (label << EdgeKindMaskBits) | k;
}

Expand All @@ -193,9 +195,10 @@ class SVFStmt : public GenericPAGEdgeTy
static inline GEdgeFlag makeEdgeFlagWithStoreInst(GEdgeKind k,
const ICFGNode* store)
{
Inst2LabelMap::const_iterator iter = inst2LabelMap.find(store);
u64_t label = (iter != inst2LabelMap.end()) ? iter->second
: storeEdgeLabelCounter++;
auto it_inserted = inst2LabelMap.emplace(store, storeEdgeLabelCounter);
if (it_inserted.second)
++storeEdgeLabelCounter;
u64_t label = it_inserted.first->second;
return (label << EdgeKindMaskBits) | k;
}

Expand Down

0 comments on commit 6e59fd2

Please sign in to comment.