summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/pr23911.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.dg/pr23911.c')
-rw-r--r--gcc/testsuite/gcc.dg/pr23911.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/pr23911.c b/gcc/testsuite/gcc.dg/pr23911.c
new file mode 100644
index 000000000..b77dbaab9
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr23911.c
@@ -0,0 +1,21 @@
+/* This was a missed optimization in tree constant propagation
+ that CSE would catch later on. */
+/* { dg-do compile } */
+/* { dg-options "-O -fdump-tree-dce2" } */
+
+double _Complex *a;
+static const double _Complex b[10] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+
+void
+test (void)
+{
+ a[0] = b[0] + b[1];
+ a[1] = b[0] + b[1];
+ return;
+}
+
+/* After DCE2 which runs after FRE, the expressions should be fully
+ constant folded. There should be no loads from b left. */
+/* { dg-final { scan-tree-dump-times "__complex__ \\\(1.0e\\\+0, 0.0\\\)" 2 "dce2" } } */
+/* { dg-final { scan-tree-dump-times "= b" 0 "dce2" } } */
+/* { dg-final { cleanup-tree-dump "dce2" } } */