This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug rtl-optimization/50696] [x32] Unnecessary lea
- From: "hjl.tools at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 11 Oct 2011 20:11:59 +0000
- Subject: [Bug rtl-optimization/50696] [x32] Unnecessary lea
- Auto-submitted: auto-generated
- References: <bug-50696-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50696
--- Comment #3 from H.J. Lu <hjl.tools at gmail dot com> 2011-10-11 20:11:59 UTC ---
Does this patch
diff --git a/gcc/combine.c b/gcc/combine.c
index 6c3b17c..52259b6 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -5078,6 +5078,22 @@ subst (rtx x, rtx from, rtx to, int in_dest, int
in_cond, int unique_copy)
}
}
}
+#ifdef POINTERS_EXTEND_UNSIGNED
+ else if (POINTERS_EXTEND_UNSIGNED > 0
+ && code == MEM
+ && GET_MODE (XEXP (x, 0)) == Pmode
+ && GET_MODE (from) == ptr_mode
+ && GET_CODE (XEXP (x, 0)) == ZERO_EXTEND
+ && COMBINE_RTX_EQUAL_P (XEXP (XEXP (x, 0), 0), from))
+ {
+ /* If an address is zero-extended from ptr_mode to
+ Pmode, replace FROM with TO. */
+ SUBST (XEXP (XEXP (x, 0), 0),
+ (unique_copy && n_occurrences
+ ? copy_rtx (to) : to));
+ n_occurrences++;
+ }
+#endif
else
{
len = GET_RTX_LENGTH (code);
make any senses?