From 7947dd0bdf9cfe2a704355b1e5d7c7f786c67b9b Mon Sep 17 00:00:00 2001 From: Ilya Enkovich Date: Wed, 13 May 2015 08:29:14 +0000 Subject: [PATCH] re PR target/65103 ([i386] GOTOFF relocation is not propagated into address expression) gcc/ PR target/65103 * config/i386/i386.c (ix86_rtx_costs): We want to propagate link time constants into adress expressions and therefore set their cost to 0. gcc/testsuite/ PR target/65103 * gcc.target/i386/pr65103-3.c: New. From-SVN: r223119 --- gcc/ChangeLog | 7 +++++++ gcc/config/i386/i386.c | 4 +++- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.target/i386/pr65103-3.c | 19 +++++++++++++++++++ 4 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.target/i386/pr65103-3.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 1906845ed58..2bb07a57023 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2015-05-13 Ilya Enkovich + + PR target/65103 + * config/i386/i386.c (ix86_rtx_costs): We want to propagate + link time constants into adress expressions and therefore set + their cost to 0. + 2015-05-13 Jakub Jelinek PR target/66112 diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index bda32570d54..de333d88a88 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -42006,7 +42006,9 @@ ix86_rtx_costs (rtx x, int code_i, int outer_code_i, int opno, int *total, && !(TARGET_64BIT && (GET_CODE (x) == LABEL_REF || (GET_CODE (x) == SYMBOL_REF - && SYMBOL_REF_LOCAL_P (x))))) + && SYMBOL_REF_LOCAL_P (x)))) + /* Use 0 cost for CONST to improve its propagation. */ + && (TARGET_64BIT || GET_CODE (x) != CONST)) *total = 1; else *total = 0; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 0f6b188e15f..b5f96f3693a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-05-13 Ilya Enkovich + + PR target/65103 + * gcc.target/i386/pr65103-3.c: New. + 2015-05-13 Martin Liska * g++.dg/ipa/pr65557.C: Remove unnecessary dump flag. diff --git a/gcc/testsuite/gcc.target/i386/pr65103-3.c b/gcc/testsuite/gcc.target/i386/pr65103-3.c new file mode 100644 index 00000000000..eddf20bc04b --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr65103-3.c @@ -0,0 +1,19 @@ +/* { dg-do compile { target ia32 } } */ +/* { dg-require-effective-target pie } */ +/* { dg-options "-O2 -fPIE" } */ +/* { dg-final { scan-assembler-not "GOTOFF," } } */ + +static int *data[100]; + +void test (long a, long b) +{ + do + { + if( a < b ) + { + data[a] = data[b]; + a++; + } + } + while (a <= b); +} -- 2.30.2