Patchwork Check the code to be executed for COND_EXEC in noop_move_p

login
register
mail settings
Submitter Bin Cheng
Date June 13, 2013, 1:26 a.m.
Message ID <00a001ce67d5$15cb19d0$41614d70$@cheng@arm.com>
Download mbox | patch
Permalink /patch/250955/
State New
Headers show

Comments

Bin Cheng - June 13, 2013, 1:26 a.m.
Hi,

For arm, gcc generates redundant assembly code like "movlt r4, r4", because
it doesn't check noop move for COND_EXEC instructions.  This patch fixes the
issue by checking the inner code to be executed for COND_EXEC in
noop_move_p.

Bootstrap and test on both x86 and cortex-a15. Is it OK?

Thanks.
bin

2013-06-13  Bin Cheng  <bin.cheng@arm.com>

	* rtlanal.c (noop_move_p): Check the code to be executed for
	COND_EXEC.

Patch

Index: gcc/rtlanal.c
===================================================================
--- gcc/rtlanal.c	(revision 199949)
+++ gcc/rtlanal.c	(working copy)
@@ -1199,6 +1199,13 @@  noop_move_p (const_rtx insn)
   if (find_reg_note (insn, REG_EQUAL, NULL_RTX))
     return 0;
 
+  /* Check the code to be executed for COND_EXEC.  */
+  if (GET_CODE (pat) == COND_EXEC)
+    {
+      pat = XEXP (pat, 1);
+      gcc_assert (pat != NULL_RTX);
+    }
+
   if (GET_CODE (pat) == SET && set_noop_p (pat))
     return 1;