public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: [PATCH][GCC] Make stackalign test LTO proof
@ 2015-11-16 15:34 Joern Wolfgang Rennecke
  2015-11-16 15:48 ` Andre Vieira
  0 siblings, 1 reply; 12+ messages in thread
From: Joern Wolfgang Rennecke @ 2015-11-16 15:34 UTC (permalink / raw)
  To: Richard Biener; +Cc: Andre Vieira, GCC Patches

I just happened to stumble on this problem with another port.
The volatile & test solution doesn't work, though.

What does work, however, is:

__asm__ ("" : : "" (dummy));

^ permalink raw reply	[flat|nested] 12+ messages in thread
* [PATCH][GCC] Make stackalign test LTO proof
@ 2015-11-12 15:07 Andre Vieira
  2015-11-13 10:34 ` Richard Biener
  0 siblings, 1 reply; 12+ messages in thread
From: Andre Vieira @ 2015-11-12 15:07 UTC (permalink / raw)
  To: GCC Patches

[-- Attachment #1: Type: text/plain, Size: 802 bytes --]

Hi,

   This patch changes this testcase to make sure LTO will not optimize 
away the assignment of the local array to a global variable which was 
introduced to make sure stack space was made available for the test to work.

   This is correct because LTO is supposed to optimize this global away 
as at link time it knows this global will never be read. By adding a 
read of the global, LTO will no longer optimize it away.

   Tested by running regressions for this testcase for various ARM targets.

   Is this OK to commit?

   Thanks,
   Andre Vieira

gcc/testsuite/ChangeLog:
2015-11-06  Andre Vieira  <andre.simoesdiasvieira@arm.com>

         * gcc.dg/torture/stackalign/builtin-return-1.c: Added read
           to global such that a write is not optimized away by LTO.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-keep-the-stack-testsuite-fix.patch --]
[-- Type: text/x-patch; name=0001-keep-the-stack-testsuite-fix.patch, Size: 977 bytes --]

From 6fbac447475c3b669baee84aa9d6291c3d09f1ab Mon Sep 17 00:00:00 2001
From: Andre Simoes Dias Vieira <andsim01@arm.com>
Date: Fri, 6 Nov 2015 13:13:47 +0000
Subject: [PATCH] keep the stack testsuite fix

---
 gcc/testsuite/gcc.dg/torture/stackalign/builtin-return-1.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/gcc/testsuite/gcc.dg/torture/stackalign/builtin-return-1.c b/gcc/testsuite/gcc.dg/torture/stackalign/builtin-return-1.c
index af017532aeb3878ef7ad717a2743661a87a56b7d..1ccd109256de72419a3c71c2c1be6d07c423c005 100644
--- a/gcc/testsuite/gcc.dg/torture/stackalign/builtin-return-1.c
+++ b/gcc/testsuite/gcc.dg/torture/stackalign/builtin-return-1.c
@@ -39,5 +39,10 @@ int main(void)
   if (bar(1) != 2)
     abort();
 
+  /* Make sure there is a read of the global after the function call to bar
+   * such that LTO does not optimize away the assignment above.  */
+  if (g != dummy)
+    abort();
+
   return 0;
 }
-- 
1.9.1


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2015-12-04 17:34 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-16 15:34 [PATCH][GCC] Make stackalign test LTO proof Joern Wolfgang Rennecke
2015-11-16 15:48 ` Andre Vieira
2015-11-17 12:29   ` Bernd Schmidt
2015-11-17 16:30     ` Andre Vieira
2015-12-04 15:19       ` Andre Vieira
2015-12-04 17:34         ` Bernd Schmidt
  -- strict thread matches above, loose matches on Subject: below --
2015-11-12 15:07 Andre Vieira
2015-11-13 10:34 ` Richard Biener
2015-11-16 11:43   ` Andre Vieira
2015-11-16 13:33     ` Richard Biener
2015-11-16 14:08       ` Andre Vieira
2015-11-16 14:31         ` Richard Biener

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).