On Wed, 1 Feb 2017, Jakub Jelinek wrote:
> > Yes; I imagine the approach taken in patch 2/5 can be extended to achieve 
> > this.
> > That is, instead of just storing a flag 'bool in_simtreg' in struct loop, 
> > store
> > pointers to corresponding SIMT_ENTER/EXIT gimple statements, use a similar
> > upwards walk on loop tree to discover if we're inlining into a SIMT region, 
> > and
> > if yes, adjust their argument lists.  Does this sound ok?
> 
> I'd prefer the abnormal edges and flags on the vars, if it can work, but
> won't fight for that hard.

Sorry, I'm uncomfortable with that because introducing abnormal edges seems like
a big hammer, e.g. it constrains non-privatized variables too.  And they don't
seem to be rigorously defined, so to me that leaves some uncertainty -- as
opposed to an approach I seek that makes constraints obvious in the IR.

> That said, I think pointers to gimple stmts in struct loop or something
> similar is problematic, you'd need to adjust those whenever something would
> remove those stmts, or e.g. duplicate the loop and stmts, handle those
> during inlining (if you inline some function with SIMT_ENTER/EXIT in them)
> etc.  Trying to find those stmts on preheader or in exit block from the
> marked loop might be easier.

Ah, sorry, so I'd need to keep the bool flag, and for SIMT_ENTER walk the
dominator tree upwards, scanning each bb until I find it (and likewise on
postdominator tree for SIMT_EXIT).

Alternatively, if simduid is already properly remapped, we could assign to it
when calling SIMT_ENTER, and then just look up its defining statement?

Alexander

Reply via email to