Add convergent property to CodeMetrics.

Summary: No functional changes.

Reviewers: jingyue, arsenm

Subscribers: arsenm, llvm-commits

Differential Revision: http://reviews.llvm.org/D17126

llvm-svn: 260728
This commit is contained in:
Justin Lebar 2016-02-12 21:01:31 +00:00
parent 531b24b53a
commit 144c5a6c15
2 changed files with 7 additions and 1 deletions

View File

@ -53,6 +53,9 @@ struct CodeMetrics {
/// one or more 'noduplicate' instructions.
bool notDuplicatable = false;
/// \brief True if this function contains a call to a convergent function.
bool convergent = false;
/// \brief True if this function calls alloca (in the C sense).
bool usesDynamicAlloca = false;

View File

@ -152,9 +152,12 @@ void CodeMetrics::analyzeBasicBlock(const BasicBlock *BB,
if (II->getType()->isTokenTy() && II->isUsedOutsideOfBlock(BB))
notDuplicatable = true;
if (const CallInst *CI = dyn_cast<CallInst>(II))
if (const CallInst *CI = dyn_cast<CallInst>(II)) {
if (CI->cannotDuplicate())
notDuplicatable = true;
if (CI->isConvergent())
convergent = true;
}
if (const InvokeInst *InvI = dyn_cast<InvokeInst>(II))
if (InvI->cannotDuplicate())