[llvm-commits] LSR Overkill For Strides?

Reid Spencer rspencer at reidspencer.com
Thu Mar 1 14:59:08 PST 2007


On Thu, 2007-03-01 at 14:44 -0800, Chris Lattner wrote:
> On Mar 1, 2007, at 2:43 PM, Reid Spencer wrote:
> 
> > Chris,
> >
> > I'm wondering if you could look at this patch to  
> > LoopStrengthReduce.cpp.
> > It's the third (last change set) I'm asking about.
> >
> > I've converted the stride comparisons to use APInt. It seems unlikely
> > that strides will be > 64 bits. Is this overkill?
> 
> Without looking at the patch, if it has to do with sizeof(void*), it  
> is safe to assume that all pointers (and thus differences between  
> pointers) are <= 64-bits in size.

It might, but it would also apply to integers.  Could you look at the
patch?

It has to do with IndVar strides and sorting them. If I understand this
code correctly, it would only be affected by a large increment in an
induction variable. For example, consider an array of structures of size
1M and we increment through them 2^48 at a time. Since 1M == 2^20, if
the increment was 2^48, the stride could be 2^68. This implies a machine
with > 64bit addresses. This seems a bit ridiculous but it could happen.
The patch guards against this by using APInt for the stride comparisons.

Seems like overkill to me, but just wanted to check. Seems you think its
overkill too.

> 
> -Chris




More information about the llvm-commits mailing list