aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@gcc.gnu.org>2017-03-22 19:33:37 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2017-03-22 19:33:37 +0100
commitc6dd4ee6b4a2716ae8c70644eb2987230ad729ac (patch)
treef9bb79e947b0f5d45222e3ffc658c82a054d9204 /gcc
parent9094d4a46f518bb5f37c654d2119a00ecdd2b5bb (diff)
downloadgcc-c6dd4ee6b4a2716ae8c70644eb2987230ad729ac.zip
gcc-c6dd4ee6b4a2716ae8c70644eb2987230ad729ac.tar.gz
gcc-c6dd4ee6b4a2716ae8c70644eb2987230ad729ac.tar.bz2
re PR rtl-optimization/63191 (32-bit gcc uses excessive memory during dead store elimination with -fPIC)
PR rtl-optimization/63191 * config/i386/i386.c (ix86_delegitimize_address): Turn into small wrapper function, moved the whole old content into ... (ix86_delegitimize_address_1): ... this. New inline function. (ix86_find_base_term): Use ix86_delegitimize_address_1 with true as last argument instead of ix86_delegitimize_address. From-SVN: r246398
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog13
-rw-r--r--gcc/config/i386/i386.c30
2 files changed, 36 insertions, 7 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 9d52b25..00d2015 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,7 +1,16 @@
+2017-03-22 Jakub Jelinek <jakub@redhat.com>
+
+ PR rtl-optimization/63191
+ * config/i386/i386.c (ix86_delegitimize_address): Turn into small
+ wrapper function, moved the whole old content into ...
+ (ix86_delegitimize_address_1): ... this. New inline function.
+ (ix86_find_base_term): Use ix86_delegitimize_address_1 with
+ true as last argument instead of ix86_delegitimize_address.
+
2017-03-22 Wilco Dijkstra <wdijkstr@arm.com>
- * config/aarch64/aarch64.c (generic_branch_cost):
- Copycortexa57_branch_cost.
+ * config/aarch64/aarch64.c (generic_branch_cost): Copy
+ cortexa57_branch_cost.
2017-03-22 Wilco Dijkstra <wdijkstr@arm.com>
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 259f97b..0f7e029 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -17261,10 +17261,16 @@ ix86_delegitimize_tls_address (rtx orig_x)
has a different PIC label for each routine but the DWARF debugging
information is not associated with any particular routine, so it's
necessary to remove references to the PIC label from RTL stored by
- the DWARF output code. */
+ the DWARF output code.
-static rtx
-ix86_delegitimize_address (rtx x)
+ This helper is used in the normal ix86_delegitimize_address
+ entrypoint (e.g. used in the target delegitimization hook) and
+ in ix86_find_base_term. As compile time memory optimization, we
+ avoid allocating rtxes that will not change anything on the outcome
+ of the callers (find_base_value and find_base_term). */
+
+static inline rtx
+ix86_delegitimize_address_1 (rtx x, bool base_term_p)
{
rtx orig_x = delegitimize_mem_from_attrs (x);
/* addend is NULL or some rtx if x is something+GOTOFF where
@@ -17291,6 +17297,10 @@ ix86_delegitimize_address (rtx x)
&& GET_CODE (XEXP (XEXP (x, 0), 0)) == UNSPEC
&& XINT (XEXP (XEXP (x, 0), 0), 1) == UNSPEC_PCREL)
{
+ /* find_base_{value,term} only care about MEMs with arg_pointer_rtx
+ base. A CONST can't be arg_pointer_rtx based. */
+ if (base_term_p && MEM_P (orig_x))
+ return orig_x;
rtx x2 = XVECEXP (XEXP (XEXP (x, 0), 0), 0, 0);
x = gen_rtx_PLUS (Pmode, XEXP (XEXP (x, 0), 1), x2);
if (MEM_P (orig_x))
@@ -17367,7 +17377,9 @@ ix86_delegitimize_address (rtx x)
if (! result)
return ix86_delegitimize_tls_address (orig_x);
- if (const_addend)
+ /* For (PLUS something CONST_INT) both find_base_{value,term} just
+ recurse on the first operand. */
+ if (const_addend && !base_term_p)
result = gen_rtx_CONST (Pmode, gen_rtx_PLUS (Pmode, result, const_addend));
if (reg_addend)
result = gen_rtx_PLUS (Pmode, reg_addend, result);
@@ -17405,6 +17417,14 @@ ix86_delegitimize_address (rtx x)
return result;
}
+/* The normal instantiation of the above template. */
+
+static rtx
+ix86_delegitimize_address (rtx x)
+{
+ return ix86_delegitimize_address_1 (x, false);
+}
+
/* If X is a machine specific address (i.e. a symbol or label being
referenced as a displacement from the GOT implemented using an
UNSPEC), then return the base term. Otherwise return X. */
@@ -17430,7 +17450,7 @@ ix86_find_base_term (rtx x)
return XVECEXP (term, 0, 0);
}
- return ix86_delegitimize_address (x);
+ return ix86_delegitimize_address_1 (x, true);
}
static void