On 3/3/25 2:59 AM, Liao Shihua wrote:
The pass ext-dce is only activated at O2 and above. Using O2 instead of O1
in testsuites when using -fdump-ext_dce.

gcc/testsuite/ChangeLog:

        * gcc.target/riscv/core_list_init.c: Using -O2 instead of -O1.
        * gcc.target/riscv/pr111384.c: Ditto.

---
  gcc/testsuite/gcc.target/riscv/core_list_init.c | 2 +-
  gcc/testsuite/gcc.target/riscv/pr111384.c       | 2 +-
  2 files changed, 2 insertions(+), 2 deletions(-)
THanks. I think we're better off changing the -O1 to -fext-dce, then adding a dg-skip-if to skip the test entirely at -O0.

That gives us better test coverage since we iterate over various optimization options in gcc.target/riscv.

Something like this is what I'm planning to install instead:

diff --git a/gcc/testsuite/gcc.target/riscv/core_list_init.c 
b/gcc/testsuite/gcc.target/riscv/core_list_init.c
index 2f36dae85aa..eec3a817d80 100644
--- a/gcc/testsuite/gcc.target/riscv/core_list_init.c
+++ b/gcc/testsuite/gcc.target/riscv/core_list_init.c
@@ -1,6 +1,7 @@
 /* { dg-do compile } */
-/* { dg-options "-O1 -fdump-rtl-ext_dce" } */
+/* { dg-options "-fext-dce -fdump-rtl-ext_dce" } */
 /* { dg-final { scan-rtl-dump {Successfully transformed} "ext_dce" } } */
+/* { dg-skip-if "" { *-*-* } { "-O0"} } */
 
 unsigned short
 core_list_init (int size, short seed) {
diff --git a/gcc/testsuite/gcc.target/riscv/pr111384.c 
b/gcc/testsuite/gcc.target/riscv/pr111384.c
index a4e77d4aeb6..0000bcf33eb 100644
--- a/gcc/testsuite/gcc.target/riscv/pr111384.c
+++ b/gcc/testsuite/gcc.target/riscv/pr111384.c
@@ -1,6 +1,7 @@
 /* { dg-do compile } */
-/* { dg-options "-O1 -fdump-rtl-ext_dce" } */
+/* { dg-options "-fext-dce -fdump-rtl-ext_dce" } */
 /* { dg-final { scan-rtl-dump {Successfully transformed} "ext_dce" } } */
+/* { dg-skip-if "" { *-*-* } { "-O0"} } */
 
 void
 foo(unsigned int src, unsigned short *dst1, unsigned short *dst2)

Reply via email to