]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR target/59880 (ix86_avoid_lea_for_addr is buggy)
authorUros Bizjak <ubizjak@gmail.com>
Wed, 22 Jan 2014 19:57:30 +0000 (20:57 +0100)
committerUros Bizjak <uros@gcc.gnu.org>
Wed, 22 Jan 2014 19:57:30 +0000 (20:57 +0100)
PR target/59880
* config/i386/i386.c (ix86_avoid_lea_for_addr): Return false
for SImode_address_operand operands.  Return false
if operands[1] is a REG.

Co-Authored-By: Jakub Jelinek <jakub@redhat.com>
From-SVN: r206940

gcc/ChangeLog
gcc/config/i386/i386.c

index 4d3f1e5fa3320c9e3571c215ee412894424d345d..8660db337f3c2b9524a1185a277d48fffe30e204 100644 (file)
@@ -1,3 +1,11 @@
+2014-01-22  Uros Bizjak  <ubizjak@gmail.com>
+           Jakub Jelinek  <jakub@redhat.com>
+
+       PR target/59880
+       * config/i386/i386.c (ix86_avoid_lea_for_addr): Return false
+       for SImode_address_operand operands.  Return false
+       if operands[1] is a REG.
+
 2014-01-21  Andrey Belevantsev  <abel@ispras.ru>
 
        Backport from mainline
index 8e0185623a38b3dce0bc96031ec6dcd1703de44c..447f6f27f144eb8889e414a123ad12a4682ee5cb 100644 (file)
@@ -16986,16 +16986,23 @@ ix86_avoid_lea_for_addr (rtx insn, rtx operands[])
   int ok;
 
   /* FIXME: Handle zero-extended addresses.  */
-  if (GET_CODE (operands[1]) == ZERO_EXTEND
-      || GET_CODE (operands[1]) == AND)
+  if (SImode_address_operand (operands[1], VOIDmode))
     return false;
 
   /* Check we need to optimize.  */
   if (!TARGET_OPT_AGU || optimize_function_for_size_p (cfun))
     return false;
 
-  /* Check it is correct to split here.  */
-  if (!ix86_ok_to_clobber_flags(insn))
+  /* The "at least two components" test below might not catch simple
+     move insns if parts.base is non-NULL and parts.disp is const0_rtx
+     as the only components in the address, e.g. if the register is
+     %rbp or %r13.  As this test is much cheaper and moves are the
+     common case, do this check first.  */
+  if (REG_P (operands[1]))
+    return false;
+  /* Check if it is OK to split here.  */
+  if (!ix86_ok_to_clobber_flags (insn))
     return false;
 
   ok = ix86_decompose_address (operands[1], &parts);