aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg
diff options
context:
space:
mode:
authorBin Cheng <bin.cheng@arm.com>2011-12-23 05:43:09 +0000
committerJoey Ye <jye2@gcc.gnu.org>2011-12-23 05:43:09 +0000
commit2b9ed3bc10e02c3430fa6393b604095cb4bd943a (patch)
treedcbbdbfe25be1bb7cb6bb32976e61c401d6ec529 /gcc/testsuite/gcc.dg
parent994182df2760962dc90ab4f2eace2de84c669133 (diff)
downloadgcc-2b9ed3bc10e02c3430fa6393b604095cb4bd943a.zip
gcc-2b9ed3bc10e02c3430fa6393b604095cb4bd943a.tar.gz
gcc-2b9ed3bc10e02c3430fa6393b604095cb4bd943a.tar.bz2
re PR tree-optimization/43491 (Unnecessary temporary for global register variable)
2011-12-22 Bin Cheng <bin.cheng@arm.com> Richard Guenther <rguenther@suse.de> PR tree-optimization/43491 * tree-ssa-pre.c (eliminate): Don't replace global register variable when it is the RHS of a single assign. testsuite: * gcc.dg/tree-ssa/pr43491.c: New test. Co-Authored-By: Richard Guenther <rguenther@suse.de> From-SVN: r182650
Diffstat (limited to 'gcc/testsuite/gcc.dg')
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr43491.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr43491.c b/gcc/testsuite/gcc.dg/tree-ssa/pr43491.c
new file mode 100644
index 0000000..2473400
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr43491.c
@@ -0,0 +1,42 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-pre-stats" } */
+
+#define REGISTER register
+
+#if defined __arm__
+# define REG1 asm("r4")
+#elif defined __i386__
+# define REG1 asm("ebx")
+#elif defined __mips__
+# define REG1 asm("s0")
+#elif defined __x86_64__
+# define REG1 asm("rbp")
+#else
+# undef REGISTER
+# define REGISTER
+# define REG1
+#endif
+
+REGISTER long data_0 REG1;
+long data_3;
+
+long foo(long data, long v)
+{
+ long i;
+ long t, u;
+
+ if (data)
+ i = data_0 + data_3;
+ else {
+ v = 2;
+ i = 5;
+ }
+ t = data_0 + data_3;
+ u = i;
+ return v * t * u;
+}
+/* We should not eliminate global register variable when it is the RHS of
+ a single assignment. */
+/* { dg-final { scan-tree-dump-times "Eliminated: 2" 1 "pre" { target { arm-*-* i?86-*-* mips*-*-* x86_64-*-* } } } } */
+/* { dg-final { scan-tree-dump-times "Eliminated: 3" 1 "pre" { target { ! { arm-*-* i?86-*-* mips*-*-* x86_64-*-* } } } } } */
+/* { dg-final { cleanup-tree-dump "pre" } } */