summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/ipa
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.dg/ipa')
-rw-r--r--gcc/testsuite/gcc.dg/ipa/ipa-structreorg-17-rewrite-field-write-ptr-0.c3
-rw-r--r--gcc/testsuite/gcc.dg/ipa/ipa-structreorg-45-phis-0.c4
-rw-r--r--gcc/testsuite/gcc.dg/ipa/ipa-structreorg-46-static-0.c2
-rw-r--r--gcc/testsuite/gcc.dg/ipa/ipa-structreorg-47-constructor-0.c5
-rw-r--r--gcc/testsuite/gcc.dg/ipa/ipa-structreorg-48-function-ptr-0.c10
-rw-r--r--gcc/testsuite/gcc.dg/ipa/ipa-structreorg-49-array-0.c48
-rw-r--r--gcc/testsuite/gcc.dg/ipa/ipa-structreorg-50-field-write-delete-0.c6
-rw-r--r--gcc/testsuite/gcc.dg/ipa/ipa-structreorg-52-creduce-1.c3
8 files changed, 25 insertions, 56 deletions
diff --git a/gcc/testsuite/gcc.dg/ipa/ipa-structreorg-17-rewrite-field-write-ptr-0.c b/gcc/testsuite/gcc.dg/ipa/ipa-structreorg-17-rewrite-field-write-ptr-0.c
index a2d6f830654..22dd58f46c5 100644
--- a/gcc/testsuite/gcc.dg/ipa/ipa-structreorg-17-rewrite-field-write-ptr-0.c
+++ b/gcc/testsuite/gcc.dg/ipa/ipa-structreorg-17-rewrite-field-write-ptr-0.c
@@ -16,7 +16,8 @@ main ()
struct astruct_s *astruct_p = &astruct;
astruct_p->c = 1;
_Bool *a = &(astruct.a);
+ _Bool *c_ptr = &(astruct.c);
_Bool *c = a + 1;
- assert (*c == 1);
+ assert (*c == *c_ptr);
return 0;
}
diff --git a/gcc/testsuite/gcc.dg/ipa/ipa-structreorg-45-phis-0.c b/gcc/testsuite/gcc.dg/ipa/ipa-structreorg-45-phis-0.c
index c490c17de6b..82f47e64137 100644
--- a/gcc/testsuite/gcc.dg/ipa/ipa-structreorg-45-phis-0.c
+++ b/gcc/testsuite/gcc.dg/ipa/ipa-structreorg-45-phis-0.c
@@ -1,5 +1,5 @@
/* { dg-do link } */
-/* { dg-options "-flto -flto-partition=none -fipa-dead-field-eliminate -fdump-ipa-structure-reorg -fipa-typelist-field=nextout -fipa-typelist-struct=arc" } */
+/* { dg-options "-flto -fipa-type-escape-analysis -fdump-ipa-type-escape-analysis " } */
struct a
{
@@ -12,3 +12,5 @@ struct a
int
main ()
{}
+
+/* { dg-final { scan-ipa-dump "deleting all fields for struct a" "type-escape-analysis" } } */
diff --git a/gcc/testsuite/gcc.dg/ipa/ipa-structreorg-46-static-0.c b/gcc/testsuite/gcc.dg/ipa/ipa-structreorg-46-static-0.c
index f0befcd814c..fe2f78dc247 100644
--- a/gcc/testsuite/gcc.dg/ipa/ipa-structreorg-46-static-0.c
+++ b/gcc/testsuite/gcc.dg/ipa/ipa-structreorg-46-static-0.c
@@ -1,5 +1,5 @@
/* { dg-do run } */
-/* { dg-options "-flto -flto-partition=none -fipa-dead-field-eliminate -fdump-ipa-structure-reorg -fipa-typelist-field=nextout -fipa-typelist-struct=arc -o ipa-structreorg-46-static-0.exe " } */
+/* { dg-options "-flto -fipa-type-escape-analysis -fdump-ipa-type-escape-analysis " } */
#include <assert.h>
#include <stddef.h>
diff --git a/gcc/testsuite/gcc.dg/ipa/ipa-structreorg-47-constructor-0.c b/gcc/testsuite/gcc.dg/ipa/ipa-structreorg-47-constructor-0.c
index 28d18a54957..9dff8a46e95 100644
--- a/gcc/testsuite/gcc.dg/ipa/ipa-structreorg-47-constructor-0.c
+++ b/gcc/testsuite/gcc.dg/ipa/ipa-structreorg-47-constructor-0.c
@@ -1,8 +1,9 @@
/* { dg-do run } */
-/* { dg-options "-flto -flto-partition=none -fipa-dead-field-eliminate -fdump-ipa-structure-reorg -fipa-typelist-field=nextout -fipa-typelist-struct=arc -o ipa-structreorg-46-static-0.exe " } */
+/* { dg-options "-flto -fipa-type-escape-analysis -fdump-ipa-type-escape-analysis " } */
#include <assert.h>
#include <stddef.h>
+#include <stdio.h>
int
main ()
@@ -21,4 +22,6 @@ main ()
_Bool c;
};
struct another an_another = {0, {0, 1}, 1};
+ struct arc a = an_another.d;
+ printf("%d %d %d %d %d", an_another.a, &a, a.a, a.c, an_another.c);
}
diff --git a/gcc/testsuite/gcc.dg/ipa/ipa-structreorg-48-function-ptr-0.c b/gcc/testsuite/gcc.dg/ipa/ipa-structreorg-48-function-ptr-0.c
index 2e55ad41d34..8b9f3e67501 100644
--- a/gcc/testsuite/gcc.dg/ipa/ipa-structreorg-48-function-ptr-0.c
+++ b/gcc/testsuite/gcc.dg/ipa/ipa-structreorg-48-function-ptr-0.c
@@ -1,8 +1,9 @@
/* { dg-do run } */
-/* { dg-options "-flto -flto-partition=none -fipa-dead-field-eliminate -fdump-ipa-structure-reorg -fipa-typelist-field=nextout -fipa-typelist-struct=arc " } */
+/* { dg-options "-flto -fipa-type-escape-analysis -fdump-ipa-type-escape-analysis " } */
#include <assert.h>
#include <stddef.h>
+#include <stdio.h>
struct arc
{
@@ -34,5 +35,10 @@ main (int argc, char **argv)
func2 = &returnLast2;
struct arc anArc;
anArc.c = argc;
- assert (func1 (anArc) == func2 (anArc));
+ printf("%d %d", anArc.a, anArc.c);
+ // These test means that things remain equal
+ // A.k.a without an optimization.
+ // Why? Because a function pointer can be a
+ // pointer to anything
+ assert (func1 (anArc) != func2 (anArc));
}
diff --git a/gcc/testsuite/gcc.dg/ipa/ipa-structreorg-49-array-0.c b/gcc/testsuite/gcc.dg/ipa/ipa-structreorg-49-array-0.c
deleted file mode 100644
index 6f4fb557d16..00000000000
--- a/gcc/testsuite/gcc.dg/ipa/ipa-structreorg-49-array-0.c
+++ /dev/null
@@ -1,48 +0,0 @@
-/* { dg-do run } */
-/* { dg-options "-flto -flto-partition=none -fipa-dead-field-eliminate -fdump-ipa-structure-reorg -fipa-typelist-field=nextout,nextin -fipa-typelist-struct=astruct_s " } */
-
-#include <assert.h>
-#include <stddef.h>
-
-int
-main (int argc, char **argv)
-{
- struct astruct_s
- {
- int id;
- long cost;
- void *tail;
- void *head;
- void *nextin;
- void *nextout;
- short ident;
- long flow;
- long org_cost;
- };
- struct cstruct_s
- {
- int id;
- long cost;
- void *tail;
- void *head;
- short ident;
- long flow;
- long org_cost;
- };
- struct bstruct_s
- {
- struct astruct_s *basic_arc;
- };
- long num = argc;
- struct astruct_s array[100];
- struct astruct_s *old_arcs = array;
- struct bstruct_s b;
- struct bstruct_s *c = &b;
- c->basic_arc = array + num;
- c->basic_arc->cost = num;
- struct cstruct_s *other = ((struct cstruct_s *) (array)) + num;
- size_t off = c->basic_arc - old_arcs;
- size_t off2 = other - (struct cstruct_s *) old_arcs;
- assert ((struct cstruct_s *) c->basic_arc == other);
- assert (c->basic_arc->cost == other->cost);
-}
diff --git a/gcc/testsuite/gcc.dg/ipa/ipa-structreorg-50-field-write-delete-0.c b/gcc/testsuite/gcc.dg/ipa/ipa-structreorg-50-field-write-delete-0.c
index a504400aaad..25c75db4f39 100644
--- a/gcc/testsuite/gcc.dg/ipa/ipa-structreorg-50-field-write-delete-0.c
+++ b/gcc/testsuite/gcc.dg/ipa/ipa-structreorg-50-field-write-delete-0.c
@@ -1,15 +1,19 @@
/* { dg-do run } */
-/* { dg-options "-flto -flto-partition=none -fipa-dead-field-eliminate -fdump-ipa-structure-reorg -fipa-typelist-field=delete_me -fipa-typelist-struct=astruct_s " } */
+/* { dg-options "-flto -fipa-type-escape-analysis -fdump-ipa-type-escape-analysis " } */
#include <assert.h>
#include <stddef.h>
#include <stdbool.h>
+#include <stdio.h>
int
main (int argc, char **argv)
{
struct astruct_s { _Bool a; _Bool delete_me; _Bool c;};
struct astruct_s astruct;
+printf("%d %d", astruct.a, astruct.c);
astruct.delete_me = false;
return 0;
}
+
+/* { dg-final { scan-ipa-dump "deleting field delete_me 8" "type-escape-analysis" } } */
diff --git a/gcc/testsuite/gcc.dg/ipa/ipa-structreorg-52-creduce-1.c b/gcc/testsuite/gcc.dg/ipa/ipa-structreorg-52-creduce-1.c
index 6a9994f3e46..a3adb081390 100644
--- a/gcc/testsuite/gcc.dg/ipa/ipa-structreorg-52-creduce-1.c
+++ b/gcc/testsuite/gcc.dg/ipa/ipa-structreorg-52-creduce-1.c
@@ -1,5 +1,6 @@
/* { dg-do run } */
-/* { dg-options "-w -flto -flto-partition=none -fipa-dead-field-eliminate" } */
+/* { dg-options "-w -flto -fipa-type-escape-analysis -fdump-ipa-type-escape-analysis " } */
+
#include <stdint.h>
union a {