查看LLVM BasicBlock类的文档时,发现了一些有意思的成员函数
BasicBlock *getSingleSuccessor () const
Return the successor of this block if it has a single successor. More...
BasicBlock *getUniqueSuccessor () const
Return the successor of this block if it has a unique successor. More...
我们主要疑惑于其中"Unique"的含义。在查阅源码注释后,基本得到了解答:
/// Note that unique predecessor doesn‘t mean single edge, there can be
/// multiple edges from the unique predecessor to this block (for example a
/// switch statement with multiple cases having the same destination).
LLVM程序分析日记之unique predecessor/successor
原文:https://www.cnblogs.com/bjchan9an/p/14348441.html