[llvm-commits] [patch] Use the new edge dominance functions in GVN

Daniel Berlin dannyb at google.com
Sat Aug 11 05:47:38 PDT 2012


On Fri, Aug 10, 2012 at 9:34 PM, Rafael EspĂ­ndola
<rafael.espindola at gmail.com> wrote:
> On 10 August 2012 21:32, Chandler Carruth <chandlerc at google.com> wrote:
>> And I'm CC-ing Danny specifically to get the URL to his github branch w/
>> this in it. =D
>

He's also trying to reconcile the fact that i get about 1 hour to work
on it a week at this point, due to dealing with chandler-made-stuff,
so he's politely trying to find a way to get it done without
mentioning that it's 1+ month late :)


> I will take a look, but I would also like to fix these small issues on
> the current one. If nothing else it provides testcases for the new one
> :-)

Don't take this the wrong way, but the "small issues' have been piling
up with the old one for a long time.  It's pretty crufty at this
point.  For example, the edge dominance stuff you are doing to solve
13307 would be better taken care of by implementing the predicate
support + value inference from the new algorithm, and making it fast
(I had implemented it, decided i wouldn't have time to make it fast
for the first commit, and ripped it back out).
It takes care of issues like this in a nice, clean way, without having
to try to guess locally substituting which equalities will turn out
better later on.

The current algorithm relies *heavily* on catching everything in a
single iteration so the next iteration gets the advantage, rather than
having a clean separation between analysis and removal, and making the
analysis work well, etc.  If you take your example from 13307, and
through another variable in it that gets copies of x, etc, you will
see it starts to take more iterations to accomplish the same thing.

This is actually a fairly bad and slow way to accomplish things in the
long run. It works pretty well for small cases, but, for example, as I
showed nick, it means that it turns local load dependency checking
into slow non-local load dependency checking as it removes loads on
each iteration, etc.


Anyhoo, the github branch is https://github.com/dberlin/llvm-gvn-rewrite

It's likely slightly broken at this exact moment, i was in the midst
of fixing up a small issue, and needed to leave for chicago, so i
pushed what i had before i left.

I'll push a fixed version when i get back to my laptop on monday.

(The version there will be faster in most cases, but slower in some
degenerate cases. If you will profile it, you will see all of those
cases spend 90+% of their time in getNonLocalPointerDependency, which
I was going to fix as a followup).

> Cheers,
> Rafael




More information about the llvm-commits mailing list