[llvm-commits] [PATCH] Make dependency DAG construction to use AA

Hal Finkel hfinkel at anl.gov
Tue May 8 18:57:54 PDT 2012


On Tue, 08 May 2012 16:24:42 -0700
Andrew Trick <atrick at apple.com> wrote:

> 
> On May 8, 2012, at 3:04 PM, Andrew Trick <atrick at apple.com> wrote:
> 
> > +  int64_t MinOffset = std::min(MMOa->getOffset(),
> > MMOb->getOffset());
> > +  int64_t Overlapa = MMOa->getSize() + MMOa->getOffset() -
> > MinOffset;
> > +  int64_t Overlapb = MMOb->getSize() + MMOb->getOffset() -
> > MinOffset;
> > 
> > It took me a while to figure out what you're doing and why. We can
> > hide this behind an API eventually (I can do it post checkin), but
> > for now can you add comments with any cases you could think of?
> > Please also comment that it's taken from DAGCombiner. Apparently
> > DAGCombiner thinks it's a good idea to normalize offsets relative
> > to each other by subtracting MinOffset. I don't understand why this
> > is a good idea and can't prove to myself that it is safe. For
> > example, what if we have an IR-level offset from the same base
> > pointer smaller than the MachineOperand offset? We would seem to
> > miss the overlap. Maybe Dan can comment on this.
> > 
> > Hal also mentioned negative offsets, but it looks to me like that
> > would work assuming positive offsets work!
> 
> 
> Dan confirmed that AA provides a simple property that alias(p, q), is
> always equivalent to alias(p - c, q - c) assuming no wrapping.
> (Apparently the offset is only used when the underlying object is the
> same!). So the code is fine, we just need a clear comment to that
> effect.
> 
> The reason this is a good idea is that giving AA a smaller access
> size allows it to be more optimistic.

This feels like a work-around that we should fix. One of the reasons
that I had tried to do this in the IR->DAG phase was because of this
offset issue. Because AA queries don't take an offset, one needs to be
overly pessimistic with instructions with offsets: the larger the
offset the more we miss optimization opportunities.

Adding queries with offsets seems simple enough in Basic AA (and SCEV
AA). Thoughts?

 -Hal

> 
> -Andy



-- 
Hal Finkel
Postdoctoral Appointee
Leadership Computing Facility
Argonne National Laboratory



More information about the llvm-commits mailing list