aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg
diff options
context:
space:
mode:
authorZdenek Dvorak <ook@ucw.cz>2008-12-12 21:32:47 +0100
committerZdenek Dvorak <rakdver@gcc.gnu.org>2008-12-12 20:32:47 +0000
commit771f882e18593bf51b526dc3cc75a41aaec2313c (patch)
treed2bf855f278b353dce85dfa95de900d9e0e0ca37 /gcc/testsuite/gcc.dg
parent9c877fcc00d1510fd4a6e0d109609522f6e108e1 (diff)
downloadgcc-771f882e18593bf51b526dc3cc75a41aaec2313c.zip
gcc-771f882e18593bf51b526dc3cc75a41aaec2313c.tar.gz
gcc-771f882e18593bf51b526dc3cc75a41aaec2313c.tar.bz2
re PR tree-optimization/32044 (final value replacement too aggressive for e.g. targets with no native div/mod insns)
PR tree-optimization/32044 * tree-scalar-evolution.h (expression_expensive_p): Declare. * tree-scalar-evolution.c (expression_expensive_p): New function. (scev_const_prop): Avoid introducing expensive expressions. * tree-ssa-loop-ivopts.c (may_eliminate_iv): Ditto. * gcc.dg/pr34027-1.c: Change outcome. * gcc.dg/tree-ssa/pr32044.c: New test. From-SVN: r142719
Diffstat (limited to 'gcc/testsuite/gcc.dg')
-rw-r--r--gcc/testsuite/gcc.dg/pr34027-1.c6
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr32044.c55
2 files changed, 60 insertions, 1 deletions
diff --git a/gcc/testsuite/gcc.dg/pr34027-1.c b/gcc/testsuite/gcc.dg/pr34027-1.c
index 532e497..8e8872a 100644
--- a/gcc/testsuite/gcc.dg/pr34027-1.c
+++ b/gcc/testsuite/gcc.dg/pr34027-1.c
@@ -8,5 +8,9 @@ unsigned long foobar(unsigned long ns)
return ns;
}
-/* { dg-final { scan-tree-dump "ns % 10000" "optimized" } } */
+/* This test was originally introduced to test that we transform
+ to ns % 10000. See the discussion of PR 32044 why we do not do
+ that anymore. */
+/* { dg-final { scan-tree-dump-times "%" 0 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "/" 0 "optimized" } } */
/* { dg-final { cleanup-tree-dump "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr32044.c b/gcc/testsuite/gcc.dg/tree-ssa/pr32044.c
new file mode 100644
index 0000000..0c1a582
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr32044.c
@@ -0,0 +1,55 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-empty -fdump-tree-final_cleanup" } */
+
+int foo (int n)
+{
+ while (n >= 45)
+ n -= 45;
+
+ return n;
+}
+
+int bar (int n)
+{
+ while (n >= 64)
+ n -= 64;
+
+ return n;
+}
+
+int bla (int n)
+{
+ int i = 0;
+
+ while (n >= 45)
+ {
+ i++;
+ n -= 45;
+ }
+
+ return i;
+}
+
+int baz (int n)
+{
+ int i = 0;
+
+ while (n >= 64)
+ {
+ i++;
+ n -= 64;
+ }
+
+ return i;
+}
+
+/* The loops computing division/modulo by 64 should be eliminated. */
+/* { dg-final { scan-tree-dump-times "Removing empty loop" 2 "empty" } } */
+
+/* There should be no division/modulo in the final dump (division and modulo
+ by 64 are done using bit operations). */
+/* { dg-final { scan-tree-dump-times "/" 0 "final_cleanup" } } */
+/* { dg-final { scan-tree-dump-times "%" 0 "final_cleanup" } } */
+
+/* { dg-final { cleanup-tree-dump "empty" } } */
+/* { dg-final { cleanup-tree-dump "final_cleanup" } } */