https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99422

--- Comment #26 from Vladimir Makarov <vmakarov at gcc dot gnu.org> ---
Here are my findings.

Before the patches function process_address_1 used CONSTRAINT__UNKNOWN (taken
from '=' of constraint "=T,..." and this is wrong) to check validity address. 
It was invalid and LRA added reloads for the address.

After the patches, the function uses CONTSTRAINT_T (taken from 'T').  For
constraint T sparc code says that the memory address is ok and LRA keeps the
address and does not generate reloads.

That is wrong.  Sparc code should say LRA that the address is wrong.  Function
sparc.c:memory_ok_for_ldd is responsible for this.

If I apply the following patch

diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c                
index f1504172022..ac83f900964 100644                                           
--- a/gcc/config/sparc/sparc.c                                                  
+++ b/gcc/config/sparc/sparc.c                                                  
@@ -9230,6 +9230,9 @@ memory_ok_for_ldd (rtx op)                                
   if (! can_create_pseudo_p ()                                                 
       && !strict_memory_address_p (Pmode, XEXP (op, 0)))                       
     return 0;                                                                  
+  if (can_create_pseudo_p ()                                                   
+      && !memory_address_p (Pmode, XEXP (op, 0)))                              
+    return 0;                                                                  

   return 1;
 }

the problem is gone.

I think target code is responsible for the bug and fix should be there not in
LRA.

Reply via email to