aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Bruel <christian.bruel@st.com>2015-04-29 08:52:23 +0200
committerChristian Bruel <chrbr@gcc.gnu.org>2015-04-29 08:52:23 +0200
commitb4d1725b5481fd693f078bd06e1e5b8209a89269 (patch)
treec94c951e50eb98e0a6ac0473e1eadb1e36e80027
parent874ef163cf31b1d045e2538a46937d457630f37d (diff)
downloadgcc-b4d1725b5481fd693f078bd06e1e5b8209a89269.zip
gcc-b4d1725b5481fd693f078bd06e1e5b8209a89269.tar.gz
gcc-b4d1725b5481fd693f078bd06e1e5b8209a89269.tar.bz2
re PR target/64835 (-fno-ipa-cp is inconsitently supported when attributes optimize or target are used)
2015-04-29 Christian Bruel <christian.bruel@st.com> PR target/64835 * config/i386/i386.c (ix86_default_align): New function. (ix86_override_options_after_change): Call ix86_default_align. (TARGET_OVERRIDE_OPTIONS_AFTER_CHANGE): New hook. (ix86_override_options_after_change): New function. From-SVN: r222559
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/config/i386/i386.c47
-rw-r--r--gcc/testsuite/ChangeLog6
-rw-r--r--gcc/testsuite/gcc.dg/ipa/iinline-attr.c27
-rw-r--r--gcc/testsuite/gcc.target/i386/iinline-attr-2.c29
5 files changed, 103 insertions, 14 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 2775226..9a58cbe 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,11 @@
+2015-04-29 Christian Bruel <christian.bruel@st.com>
+
+ PR target/64835
+ * config/i386/i386.c (ix86_default_align): New function.
+ (ix86_override_options_after_change): Call ix86_default_align.
+ (TARGET_OVERRIDE_OPTIONS_AFTER_CHANGE): New hook.
+ (ix86_override_options_after_change): New function.
+
2015-04-28 Jeff Law <law@redhat.com>
* tree-ssa-dom.c (record_equality); Fix comment typos.
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 77a6109..0e8477d 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -3106,6 +3106,35 @@ set_ix86_tune_features (enum processor_type ix86_tune, bool dump)
}
+/* Default align_* from the processor table. */
+
+static void
+ix86_default_align (struct gcc_options *opts)
+{
+ if (opts->x_align_loops == 0)
+ {
+ opts->x_align_loops = processor_target_table[ix86_tune].align_loop;
+ align_loops_max_skip = processor_target_table[ix86_tune].align_loop_max_skip;
+ }
+ if (opts->x_align_jumps == 0)
+ {
+ opts->x_align_jumps = processor_target_table[ix86_tune].align_jump;
+ align_jumps_max_skip = processor_target_table[ix86_tune].align_jump_max_skip;
+ }
+ if (opts->x_align_functions == 0)
+ {
+ opts->x_align_functions = processor_target_table[ix86_tune].align_func;
+ }
+}
+
+/* Implement TARGET_OVERRIDE_OPTIONS_AFTER_CHANGE hook. */
+
+static void
+ix86_override_options_after_change (void)
+{
+ ix86_default_align (&global_options);
+}
+
/* Override various settings based on options. If MAIN_ARGS_P, the
options are from the command line, otherwise they are from
attributes. */
@@ -3903,20 +3932,7 @@ ix86_option_override_internal (bool main_args_p,
opts->x_ix86_regparm = REGPARM_MAX;
/* Default align_* from the processor table. */
- if (opts->x_align_loops == 0)
- {
- opts->x_align_loops = processor_target_table[ix86_tune].align_loop;
- align_loops_max_skip = processor_target_table[ix86_tune].align_loop_max_skip;
- }
- if (opts->x_align_jumps == 0)
- {
- opts->x_align_jumps = processor_target_table[ix86_tune].align_jump;
- align_jumps_max_skip = processor_target_table[ix86_tune].align_jump_max_skip;
- }
- if (opts->x_align_functions == 0)
- {
- opts->x_align_functions = processor_target_table[ix86_tune].align_func;
- }
+ ix86_default_align (opts);
/* Provide default for -mbranch-cost= value. */
if (!opts_set->x_ix86_branch_cost)
@@ -52098,6 +52114,9 @@ ix86_operands_ok_for_move_multiple (rtx *operands, bool load,
#undef TARGET_PROMOTE_FUNCTION_MODE
#define TARGET_PROMOTE_FUNCTION_MODE ix86_promote_function_mode
+#undef TARGET_OVERRIDE_OPTIONS_AFTER_CHANGE
+#define TARGET_OVERRIDE_OPTIONS_AFTER_CHANGE ix86_override_options_after_change
+
#undef TARGET_MEMBER_TYPE_FORCES_BLK
#define TARGET_MEMBER_TYPE_FORCES_BLK ix86_member_type_forces_blk
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 1a018fa..71ef124 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2015-04-29 Christian Bruel <christian.bruel@st.com>
+
+ PR target/64835
+ * gcc.dg/ipa/iinline-attr.c: New test.
+ * gcc.target/i386/iinline-attr-2.c: New test.
+
2015-04-28 Andre Vehreschild <vehre@gmx.de>
* gfortran.dg/implicit_class_1.f90: Adding flag to check, if
diff --git a/gcc/testsuite/gcc.dg/ipa/iinline-attr.c b/gcc/testsuite/gcc.dg/ipa/iinline-attr.c
new file mode 100644
index 0000000..119d61f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ipa/iinline-attr.c
@@ -0,0 +1,27 @@
+/* Verify that simple indirect calls are inlined even when
+ attribute __optimize is used. */
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-ipa-inline" } */
+
+extern void non_existent(int);
+
+static void hooray ()
+{
+ non_existent (1);
+}
+
+__attribute__ ((__optimize__ ("O2")))
+static void hiphip (void (*f)())
+{
+ non_existent (2);
+ f ();
+}
+
+int test (void)
+{
+ hiphip (hooray);
+ return 0;
+}
+
+/* { dg-final { scan-ipa-dump "hooray\[^\\n\]*inline copy in test" "inline" } } */
+/* { dg-final { cleanup-ipa-dump "inline" } } */
diff --git a/gcc/testsuite/gcc.target/i386/iinline-attr-2.c b/gcc/testsuite/gcc.target/i386/iinline-attr-2.c
new file mode 100644
index 0000000..4b390ca
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/iinline-attr-2.c
@@ -0,0 +1,29 @@
+/* Verify that alignment flags are set when attribute __optimize is used. */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+extern void non_existent(int);
+
+__attribute__ ((__optimize__ ("O2")))
+static void hooray ()
+{
+ non_existent (1);
+}
+
+__attribute__ ((__optimize__ ("O2")))
+static void hiphip (void (*f)())
+{
+ non_existent (2);
+ f ();
+}
+
+__attribute__ ((__optimize__ ("O2")))
+int test (void)
+{
+ hiphip (hooray);
+ return 0;
+}
+
+/* { dg-final { scan-assembler "p2align" } } */
+
+