On 11/2/18 7:40 AM, Richard Biener wrote:
> 
> The following fixes PR87852, a latent bug in fwprop which when verifying
> whether it may propagate a use from its definition site has a shortcut
> 
>   /* Check if the reg in USE has only one definition.  We already
>      know that this definition reaches use, or we wouldn't be here.
>      However, this is invalid for hard registers because if they are
>      live at the beginning of the function it does not mean that we
>      have an uninitialized access.  */
>   regno = DF_REF_REGNO (use);
>   def = DF_REG_DEF_CHAIN (regno);
>   if (def
>       && DF_REF_NEXT_REG (def) == NULL
>       && regno >= FIRST_PSEUDO_REGISTER)
>     return false;
> 
> not considering the case of a loop where the def might not dominate
> the use.  In fact earlier code in the very same function does
> handle this case but only for the case where we'd try propagating
> a later def into an earlier use.
> 
> Bootstrapped on x86_64-unknown-linux-gnu, testing in progress.
> 
> OK for trunk?
> 
> Thanks,
> Richard.
> 
> 2018-11-02  Richard Biener  <rguent...@suse.de>
> 
>       PR rtl-optimization/87852
>       * fwprop.c (use_killed_between): Only consider single-defs of the
>       use in the definition stmt that dominate it.
You may have just saved me major headaches.  I'm in the middle of trying
to debug an unreported ARM codegen bug.  I just walked through the CSE
dump and everything looks OK, and it's mucked up in fwprop1.  The thing
that caught my eye was a pseudo where the def does not dominate a use in
a loop.  ie, on the first iteration of the loop the value is undefined
(but we'll never read it at runtime due to other checks)....

/me hopes this is the same thing and ultimately explains the
mis-compilation of python I'm seeing.

Jeff

Reply via email to