[llvm] r260728 - Add convergent property to CodeMetrics.

Justin Lebar via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 12 13:01:31 PST 2016


Author: jlebar
Date: Fri Feb 12 15:01:31 2016
New Revision: 260728

URL: http://llvm.org/viewvc/llvm-project?rev=260728&view=rev
Log:
Add convergent property to CodeMetrics.

Summary: No functional changes.

Reviewers: jingyue, arsenm

Subscribers: arsenm, llvm-commits

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

Modified:
    llvm/trunk/include/llvm/Analysis/CodeMetrics.h
    llvm/trunk/lib/Analysis/CodeMetrics.cpp

Modified: llvm/trunk/include/llvm/Analysis/CodeMetrics.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/CodeMetrics.h?rev=260728&r1=260727&r2=260728&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/CodeMetrics.h (original)
+++ llvm/trunk/include/llvm/Analysis/CodeMetrics.h Fri Feb 12 15:01:31 2016
@@ -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;
 

Modified: llvm/trunk/lib/Analysis/CodeMetrics.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/CodeMetrics.cpp?rev=260728&r1=260727&r2=260728&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/CodeMetrics.cpp (original)
+++ llvm/trunk/lib/Analysis/CodeMetrics.cpp Fri Feb 12 15:01:31 2016
@@ -152,9 +152,12 @@ void CodeMetrics::analyzeBasicBlock(cons
     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())




More information about the llvm-commits mailing list