summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/tree-ssa/pr23455.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.dg/tree-ssa/pr23455.c')
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr23455.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr23455.c b/gcc/testsuite/gcc.dg/tree-ssa/pr23455.c
new file mode 100644
index 000000000..766dc2b33
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr23455.c
@@ -0,0 +1,24 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-pre-stats" } */
+unsigned long outcnt;
+extern void flush_outbuf(void);
+
+void
+bi_windup(unsigned int *outbuf, unsigned int bi_buf)
+{
+ unsigned long t1 = outcnt;
+ outbuf[t1] = bi_buf;
+
+ unsigned long t2 = outcnt;
+ if (t2 == 16384)
+ flush_outbuf();
+
+ unsigned long t3 = outcnt;
+ outbuf[t3] = bi_buf;
+}
+/* We should eliminate one load of outcnt, which will in turn let us eliminate
+ one multiply of outcnt which will in turn let us eliminate
+ one add involving outcnt and outbuf. */
+/* { dg-final { scan-tree-dump-times "Eliminated: 3" 1 "pre" {target { ! avr-*-* } } } } */
+/* { dg-final { scan-tree-dump-times "Eliminated: 4" 1 "pre" {target { avr-*-* } } } } */
+/* { dg-final { cleanup-tree-dump "pre" } } */