From 40fedaf35fa99a9728d5b84d47035f4c92e1ba90 Mon Sep 17 00:00:00 2001 From: Sam James Date: Sat, 26 Oct 2024 02:03:43 +0100 Subject: testsuite: fixup tbaa test again Test was broken until r15-4684-g2d1d6be00257c5 which made it actually run and r15-4685-g091e45b4e97d1e which applied fixes other than the trivial rename. But more is needed: this gets the test working properly in terms of scanning the dump and handling the interaction w/ LTO with not producing an executable (did try ltrans scan but that didn't work either). Unfortunately, the test seems to fail for me on godbolt even going back to GCC 7.1 or thereabouts, hence XFAIL. However, if I revert r9-3870-g2a98b4bfc3d952, I do get an ICE in fld_incomplete_type_of -- because we do far more checking with LTO now on (in)complete types. And reverting it on releases/gcc-9 actually makes it give 0. In summary: fix the test fully so it really does run and we get a check for ICEing at least, and mark the dg-final scan as XFAIL so Honza can comment on that. gcc/testsuite/ChangeLog: PR testsuite/117299 * gcc.dg/lto/tbaa_0.c: Move to... * gcc.dg/tbaa.c: ...here. --- gcc/testsuite/gcc.dg/lto/tbaa_0.c | 43 --------------------------------------- gcc/testsuite/gcc.dg/tbaa.c | 43 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 43 deletions(-) delete mode 100644 gcc/testsuite/gcc.dg/lto/tbaa_0.c create mode 100644 gcc/testsuite/gcc.dg/tbaa.c (limited to 'gcc') diff --git a/gcc/testsuite/gcc.dg/lto/tbaa_0.c b/gcc/testsuite/gcc.dg/lto/tbaa_0.c deleted file mode 100644 index eb14ea6..0000000 --- a/gcc/testsuite/gcc.dg/lto/tbaa_0.c +++ /dev/null @@ -1,43 +0,0 @@ -/* { dg-lto-do link } */ -/* We need -flto=partition=none to get the dump file for scan-tree-dump-times. */ -/* { dg-lto-options {{ -O2 -flto -flto-partition=none -fdump-tree-evrp -std=gnu89 }} } */ - -typedef struct rtx_def *rtx; -typedef struct cselib_val_struct -{ - union - { - } u; - struct elt_loc_list *locs; -} -cselib_val; -struct elt_loc_list -{ - struct elt_loc_list *next; - rtx loc; -}; -static int n_useless_values; -unchain_one_elt_loc_list (pl) - struct elt_loc_list **pl; -{ - struct elt_loc_list *l = *pl; - *pl = l->next; -} - -discard_useless_locs (x, info) - void **x; -{ - cselib_val *v = (cselib_val *) * x; - struct elt_loc_list **p = &v->locs; - int had_locs = v->locs != 0; - while (*p) - { - unchain_one_elt_loc_list (p); - p = &(*p)->next; - } - if (had_locs && v->locs == 0) - { - n_useless_values++; - } -} -/* { dg-final { scan-tree-dump-times "n_useless_values" 2 "evrp" } } */ diff --git a/gcc/testsuite/gcc.dg/tbaa.c b/gcc/testsuite/gcc.dg/tbaa.c new file mode 100644 index 0000000..b336622 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tbaa.c @@ -0,0 +1,43 @@ +/* { dg-do assemble } */ +/* { dg-options "-O2 -flto -flto-partition=one -fdump-tree-evrp -std=gnu89" } */ +/* { dg-require-effective-target lto } */ + +typedef struct rtx_def *rtx; +typedef struct cselib_val_struct +{ + union + { + } u; + struct elt_loc_list *locs; +} +cselib_val; +struct elt_loc_list +{ + struct elt_loc_list *next; + rtx loc; +}; +static int n_useless_values; +unchain_one_elt_loc_list (pl) + struct elt_loc_list **pl; +{ + struct elt_loc_list *l = *pl; + *pl = l->next; +} + +discard_useless_locs (x, info) + void **x; +{ + cselib_val *v = (cselib_val *) * x; + struct elt_loc_list **p = &v->locs; + int had_locs = v->locs != 0; + while (*p) + { + unchain_one_elt_loc_list (p); + p = &(*p)->next; + } + if (had_locs && v->locs == 0) + { + n_useless_values++; + } +} +/* { dg-final { scan-tree-dump-times "n_useless_values" 2 "evrp" { xfail *-*-* } } } */ -- cgit v1.1