On Wed, Feb 01, 2017 at 08:09:27PM +0300, Alexander Monakov wrote: > > 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?
I believe simduid doesn't have a defining stmt, and it is a decl, not SSA_NAME. So, if SIMT_ENTER would set an SSA_NAME using simduid as underlying variable (and perhaps also use the (D) and SIMT_EXIT consume it, you could look at the single user of the default def for the decl (SIMT_ENTER) and from there the single user of the SIMT_ENTER result (SIMT_EXIT). Jakub