[llvm-commits] GEP's too?

Chris Lattner clattner at apple.com
Tue Feb 27 19:26:24 PST 2007


On Feb 27, 2007, at 6:52 PM, Reid Spencer wrote:

> Chris,
>
> How far do we want to go with conversion to APInt? Does this  
> include GEP
> indices too? For example, consider this code from
> lib/Analysis/ConstantFolding.cpp
>
>>    if (isFoldableGEP) {
>>       uint64_t Offset = TD->getIndexedOffset(Ptr->getType(),
>>                                              (Value**)Ops+1,  
>> NumOps-1);
>>       Constant *C = ConstantInt::get(TD->getIntPtrType(), Offset);
>>       return ConstantExpr::getIntToPtr(C, ResultTy);
>>     }
>
> The TargetData class could be altered to return an APInt value instead
> of a uint64_t. This would then be used to construct the ConstantInt.
> This would allow addressing beyond 64-bits but it seems like  
> overkill to
> me.


I agree, totally overkill.  GEP should continue to allow int32 or  
int64 only,

Thanks,

-Chris



More information about the llvm-commits mailing list