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

Chris Lattner sabre at nondot.org
Sat Nov 29 13:23:01 PST 2008


On Nov 29, 2008, at 5:25 AM, Duncan Sands wrote:

> 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());

Fixed, thanks!

-Chris



More information about the llvm-commits mailing list