[PATCH] Fix sibcall related failure in g++.old-deja/g++.other/eh1.C (take 2)

Jakub Jelinek jakub@redhat.com
Fri Jun 23 10:18:00 GMT 2000


On Wed, Jun 21, 2000 at 11:30:55AM -0600, Jeffrey A Law wrote:
> 
>   In message < 20000616184049.W474@sunsite.ms.mff.cuni.cz >you write:
>   > > FWIW, I'd have written it as,
>   > > if (insn)
>   > >   {
>   > >     tree probe;
>   > >     
>   > >     while ((probe = NEXT_INSN (insn)))
>   > >       insn = probe;
>   > >     set_last_insn (insn);
>   > >   }
>   > > 
>   > > Which, I find clearer. (maybe a != NULL_TREE should be put in there
>   > > for good measure too ...
>   > 
>   > I wanted to optimize for the common case (ie. insn != NULL_RTX, NEXT_INSN
>   > (insn) == NULL_RTX) and avoid calling set_last_insn in that case.
>   > But I'm of course open to changing it to be more readable.
> Given the initial confusion about the code, I think it is worth trying
> to make it more readable.
> 
> In general, if people have to ask questions about the code, then the code
> either needs to be rewritten or needs additional comments to make the
> author's intent clearer.

Ok, what about this:
Can I commit it?

2000-06-23  Jakub Jelinek  <jakub@redhat.com>

	* calls.c (expand_call): Update last_insn if necessary before
	emitting CALL_PLACEHOLDER or normal_insns.

--- gcc/calls.c.jj	Fri Jun 23 11:52:34 2000
+++ gcc/calls.c	Fri Jun 23 19:05:04 2000
@@ -3262,6 +3262,17 @@ expand_call (exp, target, ignore)
 	&& GET_CODE (PATTERN (insn)) == CALL_PLACEHOLDER)
       replace_call_placeholder (insn, sibcall_use_normal);
 
+  /* EH might append instructions to last_unconditional_cleanup,
+     so last_insn might have changed.  Update it now.  */
+  if ((insn = get_last_insn ()) != NULL_RTX)
+    {
+      rtx next;
+
+      while ((next = NEXT_INSN (insn)) != NULL_RTX)
+	insn = next;
+      set_last_insn (insn);
+    }
+
   /* If this was a potential tail recursion site, then emit a
      CALL_PLACEHOLDER with the normal and the tail recursion streams.
      One of them will be selected later.  */


	Jakub


More information about the Gcc-patches mailing list