On Wed, Jan 18, 2017 at 03:32:56PM +0100, Jakub Jelinek wrote: > > It probably is. > > > > But I guess I was asking whether you could initially emit > > > > void *omp_simt = IFN_GOMP_SIMT_ENTER (0); > > > > for (int i = n1; i < n2; i++) > > foo (&tmp); > > > > IFN_GOMP_SIMT_EXIT (omp_simt); > > > > and only after inlining do liveness / use analysis of everything between > > SIMT_ENTER and SIMT_EXIT doing the rewriting only at that point. > > Can't it be e.g. recorded inside a flag on the VAR_DECLs or magic attributes > on them during omplower time and then only finalized into the magic .local > alloca in the pass_omp_device_lower pass? The inliner would need to be able > to add those flags or magic attributes also when duplicating vars/parameters > from inline functions into the SIMT region (perhaps some flag on GIMPLE_CALL > stmts, or on bbs in the simt region, or something similar could turn that > behavior on in the inliner)?
I see in the 2/5 patch you introduce that as a loop flag, that works too. The inliner could still see the flag on the loop containing the call into which it is inlining, and if it is a SIMT loop, handle it specially in copy_decl*. Jakub