[llvm-commits] [PATCH] Optimistically analyse phi cycles in BasicAA
Nick Lewycky
nlewycky at google.com
Mon Dec 10 13:07:49 PST 2012
On 8 December 2012 10:12, Hal Finkel <hfinkel at anl.gov> wrote:
> Nick,
>
> You had okayed the previous version of this. Would you like to look at
> this one as well?
>
Thanks for the ping!
I took a look, and I must be missing something. Won't this miscompile:
bb2:
%pn1 = phi i8* [ %x, %bb1 ], [ %y, %bb2 ]
%pn2 = phi i8* [ %z, %bb1 ], [ %pn1, %bb2 ]
when %x, %y and %z are all NoAlias? It will speculate that %pn1 and %pn2
don't alias and the proceed to confirm that just because it speculated it.
Nick
> -Hal
>
> ----- Original Message -----
> > From: "Dan Gohman" <dan433584 at gmail.com>
> > To: "Hal Finkel" <hfinkel at anl.gov>
> > Cc: "Arnold Schwaighofer" <arnold.schwaighofer at gmail.com>, "Commit
> Messages and Patches for LLVM"
> > <llvm-commits at cs.uiuc.edu>
> > Sent: Thursday, December 6, 2012 4:32:32 PM
> > Subject: Re: [llvm-commits] [PATCH] Optimistically analyse phi cycles in
> BasicAA
> >
> > The basic idea sounds fine.
> >
> > Dan
> >
> > On Thu, Dec 6, 2012 at 9:31 AM, Hal Finkel <hfinkel at anl.gov> wrote:
> > > Dan,
> > >
> > > Do you have an opinion on this?
> > >
> > > Thanks again,
> > > Hal
> > >
> > > ----- Original Message -----
> > >> From: "Arnold Schwaighofer" <arnold.schwaighofer at gmail.com>
> > >> Cc: "Commit Messages and Patches for LLVM"
> > >> <llvm-commits at cs.uiuc.edu>
> > >> Sent: Wednesday, November 21, 2012 9:24:13 AM
> > >> Subject: Re: [llvm-commits] [PATCH] Optimistically analyse phi
> > >> cycles in BasicAA
> > >>
> > >> Also send to list ...
> > >>
> > >> On Wed, Nov 21, 2012 at 3:37 AM, Duncan Sands <baldrick at free.fr>
> > >> wrote:
> > >> >
> > >> > what happens if the recursion bails out due to hitting a
> > >> > recursion
> > >> > limit?
> > >> > Will the conservatively correct MayAlias be returned in that
> > >> > case?
> > >>
> > >> Yes, because when we hit the limit in the recursion we return
> > >> MayAlias
> > >> from this recursion. This result will be merged with the phi's
> > >> alias
> > >> result, setting the phi to MayAlias.
> > >>
> > >> AliasResult Alias = NoAlias;
> > >> AliasResult OrigAliasResult = AliasCache[Locs]; // Is
> > >> MayAlias
> > >> if we have never seen this node.
> > >> AliasCache[Locs] = NoAlias;
> > >>
> > >> for (unsigned i = 0, e = PN->getNumIncomingValues(); i != e;
> > >> ++i) {
> > >> AliasResult ThisAlias =
> > >> [1]
> > >> aliasCheck(PN->getIncomingValue(i), PNSize, PNTBAAInfo,
> > >>
> PN2->getIncomingValueForBlock(PN->getIncomingBlock(i)),
> > >> V2Size, V2TBAAInfo);
> > >> Alias = MergeAliasResults(ThisAlias, Alias);
> > >> if (Alias == MayAlias)
> > >> break;
> > >> }
> > >>
> > >> // Reset if speculation failed.
> > >> if (Alias != NoAlias)
> > >> AliasCache[Locs] = OrigAliasResult;
> > >>
> > >> We either process all nodes in the phis' input graph and
> > >> eventually
> > >> see a MayAlias result or we give up early and return MayAlias
> > >> through
> > >> the recursion.
> > >> The interesting case when we handle two phi nodes. We assume the
> > >> phis
> > >> to be NoAlias and they are not. Let say we process all inputs
> > >> recursively then we eventually will see an input that is MayAlias,
> > >> this will be propagate up to the call aliasCheck [1] above,
> > >> resulting
> > >> in the phi to be set to MayAlias.
> > >> In the case were we hit the recursion limit this again will happen
> > >> in
> > >> the call to aliasCheck [1] which then returns MayAlias and again
> > >> the
> > >> phis' result will be reset to MayAlias.
> > >> _______________________________________________
> > >> llvm-commits mailing list
> > >> llvm-commits at cs.uiuc.edu
> > >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
> > >>
> > >
> > > --
> > > Hal Finkel
> > > Postdoctoral Appointee
> > > Leadership Computing Facility
> > > Argonne National Laboratory
> >
>
> --
> Hal Finkel
> Postdoctoral Appointee
> Leadership Computing Facility
> Argonne National Laboratory
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20121210/a9359231/attachment.html>
More information about the llvm-commits
mailing list