diff mbox

[PR67891] drop is_gimple_reg test from set_parm_rtl (was: [PR67766] reorder return value copying from PARALLELs and CONCATs)

Message ID oroag87az2.fsf_-_@livre.home
State New
Headers show

Commit Message

Alexandre Oliva Oct. 9, 2015, 7:33 a.m. UTC
On Oct  9, 2015, Alexandre Oliva <aoliva@redhat.com> wrote:

> This fixes fallout from the PR64164 expander revamp.

> Uroš kindly tested with an alpha-linux-gnu regstrap.

The one regression he mentioned from that run was gcc.dg/pr43300.c.  The
vector parameter there is handled by the emit_block_move case of
assign_parms_setup_block.  Alas, emit_block_move marks the decl as
addressable, which causes the subsequent is_gimple_reg test in
set_parm_rtl to return false.  This causes us to call set_rtl with the
parm decl, instead of its default def, and the latter would be required
to store the RTL in the partition holding the default def.

The good news it that we don't really need to call is_gimple_reg there,
though; testing whether there is a default def in place is enough, and
ssa_default_def will find the default def in spite of the parm's no
longer passing is_gimple_reg, and it won't complain if given a decl that
was never a gimple reg.

So, I'm dropping the test.  Regstrapped on x86_64-linux-gnu and
i686-linux-gnu.  Ok to install?


[PR67891] don't test is_gimple_reg after parm expansion

From: Alexandre Oliva <aoliva@redhat.com>

for  gcc/ChangeLog

	PR middle-end/67891
	* cfgexpand.c (set_parm_rtl): Drop is_gimple_reg test.
---
 gcc/cfgexpand.c |    3 ---
 1 file changed, 3 deletions(-)

Comments

Richard Biener Oct. 9, 2015, 9:40 a.m. UTC | #1
On Fri, Oct 9, 2015 at 9:33 AM, Alexandre Oliva <aoliva@redhat.com> wrote:
> On Oct  9, 2015, Alexandre Oliva <aoliva@redhat.com> wrote:
>
>> This fixes fallout from the PR64164 expander revamp.
>
>> Uroš kindly tested with an alpha-linux-gnu regstrap.
>
> The one regression he mentioned from that run was gcc.dg/pr43300.c.  The
> vector parameter there is handled by the emit_block_move case of
> assign_parms_setup_block.  Alas, emit_block_move marks the decl as
> addressable, which causes the subsequent is_gimple_reg test in
> set_parm_rtl to return false.  This causes us to call set_rtl with the
> parm decl, instead of its default def, and the latter would be required
> to store the RTL in the partition holding the default def.
>
> The good news it that we don't really need to call is_gimple_reg there,
> though; testing whether there is a default def in place is enough, and
> ssa_default_def will find the default def in spite of the parm's no
> longer passing is_gimple_reg, and it won't complain if given a decl that
> was never a gimple reg.
>
> So, I'm dropping the test.  Regstrapped on x86_64-linux-gnu and
> i686-linux-gnu.  Ok to install?

Ok.  Note that I think emit_block_move shouldn't mess with the addressable flag.

Thanks,
Richard.

>
> [PR67891] don't test is_gimple_reg after parm expansion
>
> From: Alexandre Oliva <aoliva@redhat.com>
>
> for  gcc/ChangeLog
>
>         PR middle-end/67891
>         * cfgexpand.c (set_parm_rtl): Drop is_gimple_reg test.
> ---
>  gcc/cfgexpand.c |    3 ---
>  1 file changed, 3 deletions(-)
>
> diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c
> index 58e55d2..eaad859 100644
> --- a/gcc/cfgexpand.c
> +++ b/gcc/cfgexpand.c
> @@ -1243,9 +1243,6 @@ set_parm_rtl (tree parm, rtx x)
>        record_alignment_for_reg_var (align);
>      }
>
> -  if (!is_gimple_reg (parm))
> -    return set_rtl (parm, x);
> -
>    tree ssa = ssa_default_def (cfun, parm);
>    if (!ssa)
>      return set_rtl (parm, x);
>
>
> --
> Alexandre Oliva, freedom fighter    http://FSFLA.org/~lxoliva/
> You must be the change you wish to see in the world. -- Gandhi
> Be Free! -- http://FSFLA.org/   FSF Latin America board member
> Free Software Evangelist|Red Hat Brasil GNU Toolchain Engineer
Alexandre Oliva Oct. 10, 2015, 1:16 p.m. UTC | #2
On Oct  9, 2015, Richard Biener <richard.guenther@gmail.com> wrote:

> Ok.  Note that I think emit_block_move shouldn't mess with the addressable flag.

I have successfully tested a patch that stops it from doing so,
reverting https://gcc.gnu.org/bugzilla/show_bug.cgi?id=49429#c11 but
according to bugs 49429 and 49454, it looks like removing it would mess
with escape analysis introduced in r175063 for bug 44194.  The thread
that introduces the mark_addressable calls suggests some discomfort with
this solution, and even a suggestion that the markings should be
deferred past the end of expand, but in the end there was agreement to
go with it.  https://gcc.gnu.org/ml/gcc-patches/2011-06/msg01746.html

I'm leaving it alone, since I can't reasonably test on the platforms
where the problems showed up.
Richard Biener Oct. 12, 2015, 10:21 a.m. UTC | #3
On Sat, Oct 10, 2015 at 3:16 PM, Alexandre Oliva <aoliva@redhat.com> wrote:
> On Oct  9, 2015, Richard Biener <richard.guenther@gmail.com> wrote:
>
>> Ok.  Note that I think emit_block_move shouldn't mess with the addressable flag.
>
> I have successfully tested a patch that stops it from doing so,
> reverting https://gcc.gnu.org/bugzilla/show_bug.cgi?id=49429#c11 but
> according to bugs 49429 and 49454, it looks like removing it would mess
> with escape analysis introduced in r175063 for bug 44194.  The thread
> that introduces the mark_addressable calls suggests some discomfort with
> this solution, and even a suggestion that the markings should be
> deferred past the end of expand, but in the end there was agreement to
> go with it.  https://gcc.gnu.org/ml/gcc-patches/2011-06/msg01746.html

Aww, indeed.  Of course the issue is that we don't track pointers to the
stack introduced during RTL properly.

> I'm leaving it alone, since I can't reasonably test on the platforms
> where the problems showed up.

Yeah.

Thanks for checking.  Might want to add a comment before that
addressable setting now that you've done the archeology.

Richard.

>
> --
> Alexandre Oliva, freedom fighter    http://FSFLA.org/~lxoliva/
> You must be the change you wish to see in the world. -- Gandhi
> Be Free! -- http://FSFLA.org/   FSF Latin America board member
> Free Software Evangelist|Red Hat Brasil GNU Toolchain Engineer
diff mbox

Patch

diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c
index 58e55d2..eaad859 100644
--- a/gcc/cfgexpand.c
+++ b/gcc/cfgexpand.c
@@ -1243,9 +1243,6 @@  set_parm_rtl (tree parm, rtx x)
       record_alignment_for_reg_var (align);
     }
 
-  if (!is_gimple_reg (parm))
-    return set_rtl (parm, x);
-
   tree ssa = ssa_default_def (cfun, parm);
   if (!ssa)
     return set_rtl (parm, x);