This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Bug target/66015] New: align directives not propagated after __attribute__ ((__optimize__ ("O2")))
- From: Christian Bruel <christian dot bruel at st dot com>
- To: <wilson at tuliptree dot org>, Steve Ellcey <sellcey at mips dot com>, "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>, <schwab at linux-m68k dot org>
- Date: Tue, 5 May 2015 14:19:43 +0200
- Subject: Re: [Bug target/66015] New: align directives not propagated after __attribute__ ((__optimize__ ("O2")))
- Authentication-results: sourceware.org; auth=none
- References: <bug-66015-4 at http dot gcc dot gnu dot org/bugzilla/>
Hi Jim, Steve, Andreas
Please find here a fix for the issue reported by Andreas
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64835 for ia64.
same than x86 and aarch64.
I don't the environment to run the testsuite for ia64. would you mind
giving it a try and verify that it fixes the issue ?
many thanks
Christian
2015-05-05 Christian Bruel <christian.bruel@st.com>
PR target/66015
* config/ia64/ia64.c (ia64_option_override): Move align_loops,
and align_functions into ia64_override_options_after_change.
2015-05-05 Christian Bruel <christian.bruel@st.com>
PR target/66015
* gcc.target/ia64/iinline-attr-1.c: New test.
Index: gcc/config/ia64/ia64.c
===================================================================
--- gcc/config/ia64/ia64.c (revision 222803)
+++ gcc/config/ia64/ia64.c (working copy)
@@ -6051,10 +6051,6 @@
init_machine_status = ia64_init_machine_status;
- if (align_functions <= 0)
- align_functions = 64;
- if (align_loops <= 0)
- align_loops = 32;
if (TARGET_ABI_OPEN_VMS)
flag_no_common = 1;
@@ -6066,6 +6062,11 @@
static void
ia64_override_options_after_change (void)
{
+ if (align_functions <= 0)
+ align_functions = 64;
+ if (align_loops <= 0)
+ align_loops = 32;
+
if (optimize >= 3
&& !global_options_set.x_flag_selective_scheduling
&& !global_options_set.x_flag_selective_scheduling2)
Index: gcc/testsuite/gcc.target/ia64/iinline-attr-1.c
===================================================================
--- gcc/testsuite/gcc.target/ia64/iinline-attr-1.c (revision 0)
+++ gcc/testsuite/gcc.target/ia64/iinline-attr-1.c (working copy)
@@ -0,0 +1,28 @@
+/* Verify that alignment flags are set when attribute __optimize is used. */
+/* { dg-do compile } */
+
+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 ".align 64" } } */
+
+