[llvm-commits] [llvm] r61532 - in /llvm/trunk: include/llvm/Argument.h lib/Transforms/IPO/FunctionAttrs.cpp lib/VMCore/Function.cpp

Duncan Sands baldrick at free.fr
Wed Dec 31 10:08:59 PST 2008


Author: baldrick
Date: Wed Dec 31 12:08:59 2008
New Revision: 61532

URL: http://llvm.org/viewvc/llvm-project?rev=61532&view=rev
Log:
Don't analyze arguments already marked 'nocapture'.

Modified:
    llvm/trunk/include/llvm/Argument.h
    llvm/trunk/lib/Transforms/IPO/FunctionAttrs.cpp
    llvm/trunk/lib/VMCore/Function.cpp

Modified: llvm/trunk/include/llvm/Argument.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Argument.h?rev=61532&r1=61531&r2=61532&view=diff

==============================================================================
--- llvm/trunk/include/llvm/Argument.h (original)
+++ llvm/trunk/include/llvm/Argument.h Wed Dec 31 12:08:59 2008
@@ -56,6 +56,10 @@
   /// it in its containing function.
   bool hasNoAliasAttr() const;
   
+  /// hasNoCaptureAttr - Return true if this argument has the nocapture
+  /// attribute on it in its containing function.
+  bool hasNoCaptureAttr() const;
+  
   /// hasSRetAttr - Return true if this argument has the sret attribute on it in
   /// its containing function.
   bool hasStructRetAttr() const;

Modified: llvm/trunk/lib/Transforms/IPO/FunctionAttrs.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/FunctionAttrs.cpp?rev=61532&r1=61531&r2=61532&view=diff

==============================================================================
--- llvm/trunk/lib/Transforms/IPO/FunctionAttrs.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/FunctionAttrs.cpp Wed Dec 31 12:08:59 2008
@@ -263,7 +263,8 @@
       continue;
 
     for (Function::arg_iterator A = F->arg_begin(), E = F->arg_end(); A!=E; ++A)
-      if (isa<PointerType>(A->getType()) && !isCaptured(*F, A)) {
+      if (isa<PointerType>(A->getType()) && !A->hasNoCaptureAttr() &&
+          !isCaptured(*F, A)) {
         A->addAttr(Attribute::NoCapture);
         NumNoCapture++;
         Changed = true;

Modified: llvm/trunk/lib/VMCore/Function.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Function.cpp?rev=61532&r1=61531&r2=61532&view=diff

==============================================================================
--- llvm/trunk/lib/VMCore/Function.cpp (original)
+++ llvm/trunk/lib/VMCore/Function.cpp Wed Dec 31 12:08:59 2008
@@ -102,6 +102,13 @@
   return getParent()->paramHasAttr(getArgNo()+1, Attribute::NoAlias);
 }
 
+/// hasNoCaptureAttr - Return true if this argument has the nocapture attribute
+/// on it in its containing function.
+bool Argument::hasNoCaptureAttr() const {
+  if (!isa<PointerType>(getType())) return false;
+  return getParent()->paramHasAttr(getArgNo()+1, Attribute::NoCapture);
+}
+
 /// hasSRetAttr - Return true if this argument has the sret attribute on
 /// it in its containing function.
 bool Argument::hasStructRetAttr() const {





More information about the llvm-commits mailing list