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.ch...@arm.com>

        * rtlanal.c (noop_move_p): Check the code to be executed for
        COND_EXEC.
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;
 

Reply via email to