aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2011-01-14 12:15:43 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2011-01-14 12:15:43 +0000
commit6c0c92e6b37e27b14dc3fb8a02ee4e0e8c33b658 (patch)
tree96cb277606ed0c9ba072b1fe08d770be7c52ad62 /gcc
parentdb09f9434d83e144068149a34fe3b24b5d5a5d61 (diff)
downloadgcc-6c0c92e6b37e27b14dc3fb8a02ee4e0e8c33b658.zip
gcc-6c0c92e6b37e27b14dc3fb8a02ee4e0e8c33b658.tar.gz
gcc-6c0c92e6b37e27b14dc3fb8a02ee4e0e8c33b658.tar.bz2
re PR tree-optimization/47286 (Invalid code when using register ... asm)
2011-01-14 Richard Guenther <rguenther@suse.de> PR tree-optimization/47286 * tree-ssa-structalias.c (new_var_info): Register variables are global. * gcc.dg/tree-ssa/pr47286.c: New testcase. From-SVN: r168779
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr47286.c20
-rw-r--r--gcc/tree-ssa-structalias.c5
4 files changed, 35 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 2ad6e8b..939d7f1 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2011-01-14 Richard Guenther <rguenther@suse.de>
+
+ PR tree-optimization/47286
+ * tree-ssa-structalias.c (new_var_info): Register variables
+ are global.
+
2011-01-14 Martin Jambor <mjambor@suse.cz>
PR middle-end/46823
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 8762f9a..ed3a787 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2011-01-14 Richard Guenther <rguenther@suse.de>
+
+ PR tree-optimization/47286
+ * gcc.dg/tree-ssa/pr47286.c: New testcase.
+
2011-01-13 Kai Tietz <kai.tietz@onevision.com>
PR c++/47213
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr47286.c b/gcc/testsuite/gcc.dg/tree-ssa/pr47286.c
new file mode 100644
index 0000000..b03c59b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr47286.c
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-skip-if "" { ! { i?86-*-* x86_64-*-* } } { "*" } { "" } } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+
+struct thread_info { int preempt_count; };
+static inline struct thread_info *current_thread_info(void)
+{
+ register struct thread_info *sp asm("esp");
+ return sp;
+}
+void testcase(void)
+{
+ current_thread_info()->preempt_count += 1;
+}
+
+/* We have to make sure that alias analysis treats sp as pointing
+ to globals and thus the store not optimized away. */
+
+/* { dg-final { scan-tree-dump "->preempt_count =" "optimized" } } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */
diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c
index a31b953..d3a54c6 100644
--- a/gcc/tree-ssa-structalias.c
+++ b/gcc/tree-ssa-structalias.c
@@ -413,7 +413,10 @@ new_var_info (tree t, const char *name)
ret->is_global_var = (t == NULL_TREE);
ret->is_fn_info = false;
if (t && DECL_P (t))
- ret->is_global_var = is_global_var (t);
+ ret->is_global_var = (is_global_var (t)
+ /* We have to treat even local register variables
+ as escape points. */
+ || (TREE_CODE (t) == VAR_DECL && DECL_REGISTER (t)));
ret->solution = BITMAP_ALLOC (&pta_obstack);
ret->oldsolution = BITMAP_ALLOC (&oldpta_obstack);
ret->next = NULL;