On Thu, Oct 22, 2015 at 4:01 PM, Nathan Sidwell <nat...@acm.org> wrote: > On 10/22/15 04:07, Richard Biener wrote: > >> Yeah, please make them either end or start a BB so we have to check >> at most a single stmt. ECF_RETURNS_TWICE should achieve that, >> it also makes it a code motion barrier. > > > Just so I'm clear, you're not saying that RETURNS_TWICE will stop the call > being duplicated though?
It will in practice. RETURNS_TWICE will get you an abnormal edge from entry (I think) > thinking a little further, a code motion barrier is stronger than I need > (but conservatively safe). For instance: > > UNIQUE (HEAD) > for (...) > { > a = <loop_invariant_expr> > } > UNIQUE (TAIL) > > It would be safe and desirable to move that loop invariant to before the > UNIQUE. Perhaps it won't matter in practice -- after all having N physical > threads calculate it in parallel (just after the HEAD marker, but before the > loop) will probably take no longer than a single thread doing it while the > others wait.[*] RETURNS_TWICE will make the invariant motion stop at UNIQUE (HEAD), but it would have done that anyway. It will also be a CSE barrier, thus tem = global; UNIQUE(HEAD) tem2 = global; will not CSE tem2 to tem. Richard. > nathan > > [*] ut it will take more power.