https://gcc.gnu.org/g:ff45d02ee9e05baeb6fa3b61b0b214762b49aac7

commit ff45d02ee9e05baeb6fa3b61b0b214762b49aac7
Author: Thomas Schwinge <tschwi...@baylibre.com>
Date:   Tue Apr 22 13:41:22 2025 +0200

    Adjust 'libgomp.c++/target-exceptions-pr118794-1.C' for 
'targetm.arm_eabi_unwinder' [PR118794]
    
    Fix-up for commit aa3e72f943032e5f074b2bd2fd06d130dda8760b
    "Add test cases for exception handling constructs in dead code for GCN, 
nvptx target and OpenMP 'target' offloading [PR118794]":
    we need to adjust for configurations with 'targetm.arm_eabi_unwinder', as 
per:
    
        gcc/config/arm/arm.cc:#define TARGET_ARM_EABI_UNWINDER true
        gcc/config/c6x/c6x.cc:#define TARGET_ARM_EABI_UNWINDER true
    
    ..., which for ARM is conditional to '#if ARM_UNWIND_INFO' (defined in
    'gcc/config/arm/bpabi.h', used for various GCC configurations), and for
    C6x unconditional.
    
    This gets us:
    
        --- target-exceptions-pr118794-1.C.269t.optimized
        +++ target-exceptions-pr118794-1.C.270t.optimized
        [...]
         __attribute__((omp declare target))
         void f ()
        [...]
           gimple_call <__dt_comp , NULL, &c>
        -  gimple_call <__builtin_eh_pointer, _7, 2>
        -  gimple_call <__builtin_unwind_resume, NULL, _7>
        +  gimple_call <__builtin_cxa_end_cleanup, NULL>
    
         }
        [...]
    
            PR target/118794
            libgomp/
            * testsuite/libgomp.c++/target-exceptions-pr118794-1.C: Adjust for
            'targetm.arm_eabi_unwinder'.
            * 
testsuite/libgomp.c++/target-exceptions-pr118794-1-offload-sorry-GCN.C:
            Likewise.
            * 
testsuite/libgomp.c++/target-exceptions-pr118794-1-offload-sorry-nvptx.C:
            Likewise.
    
    (cherry picked from commit 8a1f5424b04130f88e9dcd5cbecd58300bc5166e)

Diff:
---
 libgomp/ChangeLog.omp                                         | 11 +++++++++++
 .../target-exceptions-pr118794-1-offload-sorry-GCN.C          |  6 ++++--
 .../target-exceptions-pr118794-1-offload-sorry-nvptx.C        |  6 ++++--
 libgomp/testsuite/libgomp.c++/target-exceptions-pr118794-1.C  |  6 ++++--
 4 files changed, 23 insertions(+), 6 deletions(-)

diff --git a/libgomp/ChangeLog.omp b/libgomp/ChangeLog.omp
index 94dcb8e1a36d..316aa05156c9 100644
--- a/libgomp/ChangeLog.omp
+++ b/libgomp/ChangeLog.omp
@@ -1,5 +1,16 @@
 2025-04-25  Thomas Schwinge  <tschwi...@baylibre.com>
 
+       Backported from trunk:
+       2025-04-25  Thomas Schwinge  <tschwi...@baylibre.com>
+
+       PR target/118794
+       * testsuite/libgomp.c++/target-exceptions-pr118794-1.C: Adjust for
+       'targetm.arm_eabi_unwinder'.
+       * 
testsuite/libgomp.c++/target-exceptions-pr118794-1-offload-sorry-GCN.C:
+       Likewise.
+       * 
testsuite/libgomp.c++/target-exceptions-pr118794-1-offload-sorry-nvptx.C:
+       Likewise.
+
        Backported from trunk:
        2024-08-09  Thomas Schwinge  <tschwi...@baylibre.com>
 
diff --git 
a/libgomp/testsuite/libgomp.c++/target-exceptions-pr118794-1-offload-sorry-GCN.C
 
b/libgomp/testsuite/libgomp.c++/target-exceptions-pr118794-1-offload-sorry-GCN.C
index 3cdedf48529e..d4dccf167fbb 100644
--- 
a/libgomp/testsuite/libgomp.c++/target-exceptions-pr118794-1-offload-sorry-GCN.C
+++ 
b/libgomp/testsuite/libgomp.c++/target-exceptions-pr118794-1-offload-sorry-GCN.C
@@ -14,8 +14,10 @@
 
 /* In this specific C++ arrangement, distilled from PR118794, GCC synthesizes
    '__builtin_eh_pointer', '__builtin_unwind_resume' calls as dead code in 'f':
-   { dg-final { scan-tree-dump-times {gimple_call <__builtin_eh_pointer, } 1 
optimized } }
-   { dg-final { scan-tree-dump-times {gimple_call <__builtin_unwind_resume, } 
1 optimized } }
+   { dg-final { scan-tree-dump-times {gimple_call <__builtin_eh_pointer, } 1 
optimized { target { ! { arm_eabi || tic6x-*-* } } } } }
+   { dg-final { scan-tree-dump-times {gimple_call <__builtin_unwind_resume, } 
1 optimized { target { ! { arm_eabi || tic6x-*-* } } } } }
+   ..., just 'targetm.arm_eabi_unwinder' is different:
+   { dg-final { scan-tree-dump-times {gimple_call <__builtin_cxa_end_cleanup, 
} 1 optimized { target { arm_eabi || tic6x-*-* } } } }
    { dg-final { only_for_offload_target amdgcn-amdhsa 
scan-offload-tree-dump-times {gimple_call <__builtin_eh_pointer, } 1 optimized 
} }
    { dg-final { only_for_offload_target amdgcn-amdhsa 
scan-offload-tree-dump-times {gimple_call <__builtin_unwind_resume, } 1 
optimized } }
    Given '-O0' and '-foffload-options=-mno-fake-exceptions', offload 
compilation fails:
diff --git 
a/libgomp/testsuite/libgomp.c++/target-exceptions-pr118794-1-offload-sorry-nvptx.C
 
b/libgomp/testsuite/libgomp.c++/target-exceptions-pr118794-1-offload-sorry-nvptx.C
index ef996cfff7fa..724e34bd9234 100644
--- 
a/libgomp/testsuite/libgomp.c++/target-exceptions-pr118794-1-offload-sorry-nvptx.C
+++ 
b/libgomp/testsuite/libgomp.c++/target-exceptions-pr118794-1-offload-sorry-nvptx.C
@@ -14,8 +14,10 @@
 
 /* In this specific C++ arrangement, distilled from PR118794, GCC synthesizes
    '__builtin_eh_pointer', '__builtin_unwind_resume' calls as dead code in 'f':
-   { dg-final { scan-tree-dump-times {gimple_call <__builtin_eh_pointer, } 1 
optimized } }
-   { dg-final { scan-tree-dump-times {gimple_call <__builtin_unwind_resume, } 
1 optimized } }
+   { dg-final { scan-tree-dump-times {gimple_call <__builtin_eh_pointer, } 1 
optimized { target { ! { arm_eabi || tic6x-*-* } } } } }
+   { dg-final { scan-tree-dump-times {gimple_call <__builtin_unwind_resume, } 
1 optimized { target { ! { arm_eabi || tic6x-*-* } } } } }
+   ..., just 'targetm.arm_eabi_unwinder' is different:
+   { dg-final { scan-tree-dump-times {gimple_call <__builtin_cxa_end_cleanup, 
} 1 optimized { target { arm_eabi || tic6x-*-* } } } }
    { dg-final { only_for_offload_target nvptx-none 
scan-offload-tree-dump-times {gimple_call <__builtin_eh_pointer, } 1 optimized 
} }
    { dg-final { only_for_offload_target nvptx-none 
scan-offload-tree-dump-times {gimple_call <__builtin_unwind_resume, } 1 
optimized } }
    Given '-O0' and '-foffload-options=-mno-fake-exceptions', offload 
compilation fails:
diff --git a/libgomp/testsuite/libgomp.c++/target-exceptions-pr118794-1.C 
b/libgomp/testsuite/libgomp.c++/target-exceptions-pr118794-1.C
index 24e3d076a1b1..24eb7a59c79d 100644
--- a/libgomp/testsuite/libgomp.c++/target-exceptions-pr118794-1.C
+++ b/libgomp/testsuite/libgomp.c++/target-exceptions-pr118794-1.C
@@ -51,7 +51,9 @@ int main()
 
 /* In this specific C++ arrangement, distilled from PR118794, GCC synthesizes
    '__builtin_eh_pointer', '__builtin_unwind_resume' calls as dead code in 'f':
-   { dg-final { scan-tree-dump-times {gimple_call <__builtin_eh_pointer, } 1 
optimized } }
-   { dg-final { scan-tree-dump-times {gimple_call <__builtin_unwind_resume, } 
1 optimized } }
+   { dg-final { scan-tree-dump-times {gimple_call <__builtin_eh_pointer, } 1 
optimized { target { ! { arm_eabi || tic6x-*-* } } } } }
+   { dg-final { scan-tree-dump-times {gimple_call <__builtin_unwind_resume, } 
1 optimized { target { ! { arm_eabi || tic6x-*-* } } } } }
+   ..., just 'targetm.arm_eabi_unwinder' is different:
+   { dg-final { scan-tree-dump-times {gimple_call <__builtin_cxa_end_cleanup, 
} 1 optimized { target { arm_eabi || tic6x-*-* } } } }
    { dg-final { scan-offload-tree-dump-times {gimple_call 
<__builtin_eh_pointer, } 1 optimized } }
    { dg-final { scan-offload-tree-dump-times {gimple_call 
<__builtin_unwind_resume, } 1 optimized } } */

Reply via email to