Skip to content

Commit

Permalink
avoid adding self-cycle for IntraDirectVFEdge
Browse files Browse the repository at this point in the history
  • Loading branch information
yuleisui committed Feb 27, 2021
1 parent 5b498f6 commit 46ee4c6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
6 changes: 5 additions & 1 deletion include/Graphs/VFG.h
Original file line number Diff line number Diff line change
Expand Up @@ -553,8 +553,12 @@ class VFG : public GenericVFGTy
PAGNodeToFormalRetMap[uniqueFunRet] = sNode;
/// if this uniqueFunRet is a phi node, which means it will receive values from multiple return instructions of fun
/// we will set this phi node's def later
if (!pag->isPhiNode(uniqueFunRet))
/// Ideally, every function uniqueFunRet should be a PhiNode (PAGBuilder.cpp), unless it does not have ret instruction
if (!pag->isPhiNode(uniqueFunRet)){
std::string warn = fun->getName();
SVFUtil::writeWrnMsg(warn + " does not have any ret instruction!");
setDef(uniqueFunRet, sNode);
}
}
/// Add a callsite Receive VFG node
inline void addActualRetVFGNode(const PAGNode* ret,const CallBlockNode* cs)
Expand Down
1 change: 1 addition & 0 deletions include/SVF-FE/LLVMUtil.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ inline const Function* getLLVMFunction(const Value* val)


/// Return true if the call is an external call (external library in function summary table)
/// If the libary function is redefined in the application code (e.g., memcpy), it will return false and will not be treated as an external call.
//@{
inline bool isExtCall(const SVFFunction* fun)
{
Expand Down
8 changes: 6 additions & 2 deletions lib/Graphs/VFG.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -529,8 +529,12 @@ VFGEdge* VFG::addIntraDirectVFEdge(NodeID srcId, NodeID dstId)
}
else
{
IntraDirSVFGEdge* directEdge = new IntraDirSVFGEdge(srcNode,dstNode);
return (addVFGEdge(directEdge) ? directEdge : nullptr);
if(srcNode!=dstNode){
IntraDirSVFGEdge* directEdge = new IntraDirSVFGEdge(srcNode,dstNode);
return (addVFGEdge(directEdge) ? directEdge : nullptr);
}
else
return nullptr;
}
}

Expand Down

0 comments on commit 46ee4c6

Please sign in to comment.