[llvm-commits] [llvm] r60268 - /llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp

Chris Lattner sabre at nondot.org
Sat Nov 29 17:44:00 PST 2008


Author: lattner
Date: Sat Nov 29 19:44:00 2008
New Revision: 60268

URL: http://llvm.org/viewvc/llvm-project?rev=60268&view=rev
Log:
calls never depend on allocations.

Modified:
    llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp

Modified: llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp?rev=60268&r1=60267&r2=60268&view=diff

==============================================================================
--- llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp (original)
+++ llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp Sat Nov 29 19:44:00 2008
@@ -63,15 +63,6 @@
     if (StoreInst *S = dyn_cast<StoreInst>(Inst)) {
       Pointer = S->getPointerOperand();
       PointerSize = TD.getTypeStoreSize(S->getOperand(0)->getType());
-    } else if (AllocationInst *AI = dyn_cast<AllocationInst>(Inst)) {
-      Pointer = AI;
-      if (ConstantInt *C = dyn_cast<ConstantInt>(AI->getArraySize()))
-        // Use ABI size (size between elements), not store size (size of one
-        // element without padding).
-        PointerSize = C->getZExtValue() *
-                      TD.getABITypeSize(AI->getAllocatedType());
-      else
-        PointerSize = ~0UL;
     } else if (VAArgInst *V = dyn_cast<VAArgInst>(Inst)) {
       Pointer = V->getOperand(0);
       PointerSize = TD.getTypeStoreSize(V->getType());
@@ -85,8 +76,10 @@
             AliasAnalysis::DoesNotAccessMemory)
         continue;
       return DepResultTy(Inst, Normal);
-    } else
+    } else {
+      // Non-memory instruction.
       continue;
+    }
     
     if (AA.getModRefInfo(C, Pointer, PointerSize) != AliasAnalysis::NoModRef)
       return DepResultTy(Inst, Normal);
@@ -141,8 +134,8 @@
          (isa<StoreInst>(Inst) && cast<StoreInst>(Inst)->isVolatile())))
       return DepResultTy(Inst, Normal);
 
-    // MemDep is broken w.r.t. loads: it says that two loads of the same pointer
-    // depend on each other.  :(
+    // Values depend on loads if the pointers are must aliased.  This means that
+    // a load depends on another must aliased load from the same value.
     if (LoadInst *L = dyn_cast<LoadInst>(Inst)) {
       Value *Pointer = L->getPointerOperand();
       uint64_t PointerSize = TD.getTypeStoreSize(L->getType());





More information about the llvm-commits mailing list