[PATCH] D17126: Add convergent property to CodeMetrics.

Justin Lebar via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 10 20:56:48 PST 2016


jlebar created this revision.
jlebar added a reviewer: jingyue.
jlebar added a subscriber: llvm-commits.

No functional changes.

http://reviews.llvm.org/D17126

Files:
  include/llvm/Analysis/CodeMetrics.h
  lib/Analysis/CodeMetrics.cpp

Index: lib/Analysis/CodeMetrics.cpp
===================================================================
--- lib/Analysis/CodeMetrics.cpp
+++ lib/Analysis/CodeMetrics.cpp
@@ -152,9 +152,12 @@
     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())
Index: include/llvm/Analysis/CodeMetrics.h
===================================================================
--- include/llvm/Analysis/CodeMetrics.h
+++ include/llvm/Analysis/CodeMetrics.h
@@ -53,6 +53,9 @@
   /// 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;
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D17126.47593.patch
Type: text/x-patch
Size: 1137 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160211/8d9aeb62/attachment.bin>


More information about the llvm-commits mailing list