[PATCH, RTL] Fix PR 51106

Andrey Belevantsev abel@ispras.ru
Mon Apr 2 14:56:00 GMT 2012


Hello,

On 19.01.2012 18:40, Jakub Jelinek wrote:
> On Thu, Jan 19, 2012 at 06:13:58PM +0400, Andrey Belevantsev wrote:
>> 2012-01-19  Andrey Belevantsev<abel@ispras.ru>
>>
>> 	PR target/51106
>> 	* function.c (instantiate_virtual_regs_in_insn): Use
>> delete_insn_and_edges when removing a wrong asm insn.
>
> This is ok for trunk.
>

After Richi's RTL generation related cleanups went it, the extra 
cleanup_cfg call was added so we are no longer lucky to have the proper 
fallthru edge in this case.  The PR trail has the patch to purge_dead_edges 
making it consider this situation, but I still prefer the below patch that 
fixes only the invalid asm case.  The reason is that I think it unlikely 
that after initial RTL expansion (of which the instantiate virtual regs 
pass seems to be the part) we will get the problematic situation.  However, 
I'm happy to test the PR trail patch, too.

Tested fine on x86-64, ok for trunk?

Andrey

2012-04-02  Andrey Belevantsev  <abel@ispras.ru>

	PR target/51106
	PR middle-end/52650
	* function.c (instantiate_virtual_regs_in_insn): Make sure to set
	the proper fallthru bits when removing a wrong jump asm.

diff --git a/gcc/function.c b/gcc/function.c
index 3e903ef..a2638bb 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -1730,6 +1730,15 @@ instantiate_virtual_regs_in_insn (rtx insn)
        if (!check_asm_operands (PATTERN (insn)))
         {
           error_for_asm (insn, "impossible constraint in %<asm%>");
+         if (JUMP_P (insn))
+           {
+             basic_block bb = BLOCK_FOR_INSN (insn);
+             edge e;
+
+             if (single_succ_p (bb)
+                 && !((e = single_succ_edge (bb))->flags & EDGE_FALLTHRU))
+               e->flags |= EDGE_FALLTHRU;
+           }
           delete_insn_and_edges (insn);
         }
      }



More information about the Gcc-patches mailing list