[llvm-commits] [llvm] r61610 - /llvm/trunk/lib/Transforms/IPO/FunctionAttrs.cpp

Nick Lewycky nicholas at mxc.ca
Sat Jan 3 09:05:34 PST 2009


Author: nicholas
Date: Sat Jan  3 11:05:32 2009
New Revision: 61610

URL: http://llvm.org/viewvc/llvm-project?rev=61610&view=rev
Log:
Any void readonly functions are provably dead, don't waste time adding 
nocapture attributes to them.

Modified:
    llvm/trunk/lib/Transforms/IPO/FunctionAttrs.cpp

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

==============================================================================
--- llvm/trunk/lib/Transforms/IPO/FunctionAttrs.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/FunctionAttrs.cpp Sat Jan  3 11:05:32 2009
@@ -307,20 +307,6 @@
       // External node - skip it;
       continue;
 
-    // If the function is readonly and doesn't return any value, we know that
-    // the pointer value is not captured.  Mark all of its pointer arguments
-    // nocapture.
-    if (F->onlyReadsMemory() && F->getReturnType() == Type::VoidTy) {
-      for (Function::arg_iterator A = F->arg_begin(), E = F->arg_end();
-           A != E; ++A)
-        if (isa<PointerType>(A->getType()) && !A->hasNoCaptureAttr()) {
-          A->addAttr(Attribute::NoCapture);
-          ++NumNoCapture;
-          Changed = true;
-        }
-      continue;
-    }
-
     // Definitions with weak linkage may be overridden at linktime with
     // something that writes memory, so treat them like declarations.
     if (F->isDeclaration() || F->mayBeOverridden())





More information about the llvm-commits mailing list