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

Duncan Sands baldrick at free.fr
Sat Nov 29 05:25:09 PST 2008


Hi Chris,

>        if (ConstantInt* C = dyn_cast<ConstantInt>(AI->getArraySize()))
>          pointerSize = C->getZExtValue() *
> -                      TD.getABITypeSize(AI->getAllocatedType());
> +                      TD.getTypeStoreSize(AI->getAllocatedType());

this looks wrong: when alloca'ing multiple elements, the elements are spaced
by the ABI size, not the store size, so I think this change is wrong when C > 1.
That said, if C >= 1, then doing (C-1)*ABISize + StoreSize should be correct.

> +    } else if (AllocationInst *AI = dyn_cast<AllocationInst>(Inst)) {
> +      Pointer = AI;
> +      if (ConstantInt *C = dyn_cast<ConstantInt>(AI->getArraySize()))
> +        PointerSize = C->getZExtValue() * 
> +                      TD.getTypeStoreSize(AI->getAllocatedType());

Likewise.

Ciao,

Duncan.



More information about the llvm-commits mailing list