diff mbox

[AArch64,committed] Add comment on why plus_constant is not used in aarch64_legitimize_reload_address

Message ID 527B7E2B.5040605@arm.com
State New
Headers show

Commit Message

Kyrylo Tkachov Nov. 7, 2013, 11:48 a.m. UTC
Hi all,

I've committed this patch as obvious. It adds a comment in 
aarch64_legitimize_reload_address explaining that we need the RTL structure to 
be preserved before push_reload and using plus_constant would fold that, causing 
ICEs.

Thanks,
Kyrill

[gcc/]
2013-11-07  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>

     * config/aarch64/aarch64.c (aarch64_legitimize_reload_address):
     Explain why plus_constant is not used.
diff mbox

Patch

diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index ee2cb4c..3fe70c1 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -4007,7 +4007,11 @@  aarch64_legitimize_reload_address (rtx *x_p,
 	cst = force_const_mem (xmode, cst);
 
       /* Reload high part into base reg, leaving the low part
-	 in the mem instruction.  */
+	 in the mem instruction.
+	 Note that replacing this gen_rtx_PLUS with plus_constant is
+	 wrong in this case because we rely on the
+	 (plus (plus reg c1) c2) structure being preserved so that
+	 XEXP (*p, 0) in push_reload below uses the correct term.  */
       x = gen_rtx_PLUS (xmode,
 			gen_rtx_PLUS (xmode, XEXP (x, 0), cst),
 			GEN_INT (low));