diff mbox

[ARM,committed] Add comment in arm_legitimize_reload_address to discourage use of plus_constant

Message ID 524BF011.8050002@arm.com
State New
Headers show

Commit Message

Kyrylo Tkachov Oct. 2, 2013, 10:06 a.m. UTC
Hi all,

I've committed the attached patch to make it mode clear why we use gen_rtx_PLUS 
instead of plus_constant in that particular instance.

Committed as obvious with r203106.

Kyrill

2013-10-02  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>

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

Patch

diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
index e23e29a..2f1e0b8 100644
--- a/gcc/config/arm/arm.c
+++ b/gcc/config/arm/arm.c
@@ -7547,7 +7547,11 @@  arm_legitimize_reload_address (rtx *p,
 	return false;
 
       /* Reload the high part into a base reg; leave the low part
-	 in the mem.  */
+	 in the mem.
+	 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.  */
       *p = gen_rtx_PLUS (GET_MODE (*p),
 			 gen_rtx_PLUS (GET_MODE (*p), XEXP (*p, 0),
 				       GEN_INT (high)),