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

Duncan Sands baldrick at free.fr
Wed Nov 3 07:45:05 PDT 2010


Author: baldrick
Date: Wed Nov  3 09:45:05 2010
New Revision: 118171

URL: http://llvm.org/viewvc/llvm-project?rev=118171&view=rev
Log:
Rename PointsToLocalMemory to PointsToLocalOrConstantMemory to make
the code more self-documenting.

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=118171&r1=118170&r2=118171&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/FunctionAttrs.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/FunctionAttrs.cpp Wed Nov  3 09:45:05 2010
@@ -65,7 +65,7 @@
       CallGraphSCCPass::getAnalysisUsage(AU);
     }
 
-    bool PointsToLocalMemory(Value *V);
+    bool PointsToLocalOrConstantMemory(Value *V);
   };
 }
 
@@ -79,10 +79,10 @@
 Pass *llvm::createFunctionAttrsPass() { return new FunctionAttrs(); }
 
 
-/// PointsToLocalMemory - Returns whether the given pointer value points to
-/// memory that is local to the function.  Global constants are considered
-/// local to all functions.
-bool FunctionAttrs::PointsToLocalMemory(Value *V) {
+/// PointsToLocalOrConstantMemory - Returns whether the given pointer value
+/// points to memory that is local to the function, with global constants being
+/// considered local to all functions.
+bool FunctionAttrs::PointsToLocalOrConstantMemory(Value *V) {
   SmallVector<Value*, 16> Worklist;
   unsigned MaxLookup = 8;
 
@@ -179,7 +179,8 @@
             for (CallSite::arg_iterator CI = CS.arg_begin(), CE = CS.arg_end();
                  CI != CE; ++CI) {
               Value *Arg = *CI;
-              if (Arg->getType()->isPointerTy() && !PointsToLocalMemory(Arg))
+              if (Arg->getType()->isPointerTy() &&
+                  !PointsToLocalOrConstantMemory(Arg))
                 // Writes memory.  Just give up.
                 return false;
             }
@@ -188,11 +189,13 @@
           }
       } else if (LoadInst *LI = dyn_cast<LoadInst>(I)) {
         // Ignore non-volatile loads from local memory.
-        if (!LI->isVolatile() && PointsToLocalMemory(LI->getPointerOperand()))
+        if (!LI->isVolatile() &&
+            PointsToLocalOrConstantMemory(LI->getPointerOperand()))
           continue;
       } else if (StoreInst *SI = dyn_cast<StoreInst>(I)) {
         // Ignore non-volatile stores to local memory.
-        if (!SI->isVolatile() && PointsToLocalMemory(SI->getPointerOperand()))
+        if (!SI->isVolatile() &&
+            PointsToLocalOrConstantMemory(SI->getPointerOperand()))
           continue;
       }
 





More information about the llvm-commits mailing list