Patchwork Fix bug with simple returns on cc0 targets

login
register
mail settings
Submitter Eric Botcazou
Date March 25, 2013, 11:24 a.m.
Message ID <1575965.2NCIYs47i8@polaris>
Download mbox | patch
Permalink /patch/230635/
State New
Headers show

Comments

Eric Botcazou - March 25, 2013, 11:24 a.m.
Hi,

for a private port which both is a cc0 target and has conditional returns, 
emit_use_return_register_into_block will try to emit the use return register 
sequence between a cc0 setter and a cc0 user.

Fixed thusly, tested on x86_64-suse-linux, applied on the mainline.


2013-03-25  Eric Botcazou  <ebotcazou@adacore.com>

	* function.c (emit_use_return_register_into_block): On cc0 targets,
	do not emit the sequence between cc0 setter and user.

Patch

Index: function.c
===================================================================
--- function.c	(revision 197003)
+++ function.c	(working copy)
@@ -5598,12 +5598,17 @@  prepare_shrink_wrap (basic_block entry_b
 static void
 emit_use_return_register_into_block (basic_block bb)
 {
-  rtx seq;
+  rtx seq, insn;
   start_sequence ();
   use_return_register ();
   seq = get_insns ();
   end_sequence ();
-  emit_insn_before (seq, BB_END (bb));
+  insn = BB_END (bb);
+#ifdef HAVE_cc0
+  if (reg_mentioned_p (cc0_rtx, PATTERN (insn)))
+    insn = prev_cc0_setter (insn);
+#endif
+  emit_insn_before (seq, insn);
 }