On Mon, Jun 22, 2015 at 03:59:57PM +0200, Bernd Schmidt wrote:
> On 06/19/2015 03:45 PM, Jakub Jelinek wrote:
> >I actually believe having some optimization passes in between the ompexp
> >and the lowering of the IR into the form PTX wants is highly desirable,
> >the form with the worker-single or vector-single mode lowered will contain
> >too complex CFG for many optimizations to be really effective, especially
> >if it uses abnormal edges. E.g. inlining supposedly would have harder job
> >etc. What exact unpredictable effects do you fear?
>
> Mostly the ones I can't predict. But let's take one example, LICM: let's say
> you pull some assignment out of a loop, then you find yourself in one of two
> possible situations: either it's become not actually available inside the
> loop (because the data and control flow is not described correctly and the
> compiler doesn't know what's going on), or, to avoid that, you introduce
Why do you think that would happen? E.g. for non-addressable gimple types you'd
most likely just have a PHI for it on the loop.
> additional broadcasting operations when entering the loop, which might be
> quite expensive.
If the PHI has cheap initialization, there is not a problem to emit it as
initialization in the loop instead of a broadcast (kind like RA
rematerialization). And by actually adding such an optimization, you help
even code that has computation in a vector-single code and uses it in vector
acc loop.
Jakub