diff mbox series

testsuite: Compile-only gcc.dg/tree-ssa/pr100359.c if ! natural_alignment_32

Message ID 20230321153805.9120E2040E@pchp3.se.axis.com
State New
Headers show
Series testsuite: Compile-only gcc.dg/tree-ssa/pr100359.c if ! natural_alignment_32 | expand

Commit Message

Hans-Peter Nilsson March 21, 2023, 3:38 p.m. UTC
(CC to respectively author and committer of pr100359.c.)

Tested cris-elf and native x86_64-linux: the two
scan-tree-dumps pass and x86_64-linux still links.  Ok to
commit?

-- >8 --
The test gcc.dg/tree-ssa/pr100359.c fails the "test for
excess errors" for at least m68k-linux, pru-elf, and
cris-elf according to posts on gcc-testresults.  For
cris-elf, the "excess errors" is a failure to link; an
undefined reference to foo, because the code has a call to
an extern function foo, which is not optimized away, and
which is not defined.  I guess it's the same for those other
targets.

From comparative gdb sessions for native x86_64-linux and
cris-elf, I see tree-ssa-sccvn.cc:vn_reference_lookup_3
(called from the "pre" pass) requires int-size-alignment for
a target to see through the "int *" dereference, that the
expression is constant false and subsequently optimize away
the call to foo.  The conclusion is with substantially less
effort available from comments in PR91419.

The point of the test seems only incidental to
optimizing-out the call to foo, judging from the comments in
PR100359, so an alternative is compile it (not link it) for
all targets.  However, I chose to not change the nature of
the test where it passes.

	* gcc.dg/tree-ssa/pr100359.c: Compile-only for ! natural_alignment_32.
---
 gcc/testsuite/gcc.dg/tree-ssa/pr100359.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Richard Biener March 21, 2023, 4:47 p.m. UTC | #1
> Am 21.03.2023 um 16:38 schrieb Hans-Peter Nilsson via Gcc-patches <gcc-patches@gcc.gnu.org>:
> 
> (CC to respectively author and committer of pr100359.c.)
> 
> Tested cris-elf and native x86_64-linux: the two
> scan-tree-dumps pass and x86_64-linux still links.  Ok to
> commit?

Ok

Richard 

> -- >8 --
> The test gcc.dg/tree-ssa/pr100359.c fails the "test for
> excess errors" for at least m68k-linux, pru-elf, and
> cris-elf according to posts on gcc-testresults.  For
> cris-elf, the "excess errors" is a failure to link; an
> undefined reference to foo, because the code has a call to
> an extern function foo, which is not optimized away, and
> which is not defined.  I guess it's the same for those other
> targets.
> 
> From comparative gdb sessions for native x86_64-linux and
> cris-elf, I see tree-ssa-sccvn.cc:vn_reference_lookup_3
> (called from the "pre" pass) requires int-size-alignment for
> a target to see through the "int *" dereference, that the
> expression is constant false and subsequently optimize away
> the call to foo.  The conclusion is with substantially less
> effort available from comments in PR91419.
> 
> The point of the test seems only incidental to
> optimizing-out the call to foo, judging from the comments in
> PR100359, so an alternative is compile it (not link it) for
> all targets.  However, I chose to not change the nature of
> the test where it passes.
> 
>    * gcc.dg/tree-ssa/pr100359.c: Compile-only for ! natural_alignment_32.
> ---
> gcc/testsuite/gcc.dg/tree-ssa/pr100359.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr100359.c b/gcc/testsuite/gcc.dg/tree-ssa/pr100359.c
> index 29243522caaf..236dbef41c4e 100644
> --- a/gcc/testsuite/gcc.dg/tree-ssa/pr100359.c
> +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr100359.c
> @@ -1,4 +1,5 @@
> -/* { dg-do link } */
> +/* { dg-do link { target natural_alignment_32 } } */
> +/* { dg-do compile { target { ! natural_alignment_32 } } } */
> /* { dg-options "-O3 -fdump-tree-cunrolli-optimized" } */
> 
> extern void foo(void);
> -- 
> 2.30.2
>
diff mbox series

Patch

diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr100359.c b/gcc/testsuite/gcc.dg/tree-ssa/pr100359.c
index 29243522caaf..236dbef41c4e 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/pr100359.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr100359.c
@@ -1,4 +1,5 @@ 
-/* { dg-do link } */
+/* { dg-do link { target natural_alignment_32 } } */
+/* { dg-do compile { target { ! natural_alignment_32 } } } */
 /* { dg-options "-O3 -fdump-tree-cunrolli-optimized" } */
 
 extern void foo(void);