On 09/09/2016 10:57 AM, Segher Boessenkool wrote:
On Fri, Sep 09, 2016 at 10:48:30AM -0600, Jeff Law wrote:
and even allows them to be executed more than once, if that is
cheaper.
This is the part that I'm still struggling with.

The usual example:

1
|\
| \
|  2
| /
|/
3
|\
| \
|  4
| /
|/
5

where 2 and 4 need a certain prologue component (and the rest doesn't).
Perfect.

So this is consistent with one of the ideas I was starting to form. I'm going to stay in the PRE world because it's model is so damn close to what you're doing.

PRE minimizes expression evaluations on paths *without* introducing evaluations on paths that didn't already have one.

So if we pretend we had some expression evaluated in 2 & 4. The path 1->2->3->4 has two evaluations of the expression, but PRE can't really do anything here. We can't hoist the evaluation into a better spot as doing so would introduce evaluations on paths that didn't have one before. 2 & 4 are the proper locations for that expression evaluation.

And the same applies to separate shrink wrapping. 2 & 4 are the right place. It's all so clear now.

I'll note that duplicating 3 into 3' and redirecting the edge 2->3 to 2->3' allows us to do better PRE and prologue insertion. But I don't think that's a requirement for you to go forward :-)

Anyway, it's all clear now.  Thanks so much for that example.


Jeff

Reply via email to