]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libgomp.c++/static-aggr-constructor-destructor-{1,2}.C: Fix scan-tree-dump
authorTobias Burnus <tburnus@baylibre.com>
Thu, 8 Aug 2024 08:42:25 +0000 (10:42 +0200)
committerThomas Schwinge <tschwinge@baylibre.com>
Fri, 25 Apr 2025 16:09:19 +0000 (18:09 +0200)
In principle, the optimized dump should be the same on the host, but as
'nohost' is not handled, is is present. However when ENABLE_OFFLOADING is
false, it is handled early enough to remove the function.

libgomp/ChangeLog:

* testsuite/libgomp.c++/static-aggr-constructor-destructor-1.C: Split
scan-tree-dump into with and without target offload_target_any.
* testsuite/libgomp.c++/static-aggr-constructor-destructor-2.C:
Likewise.

(cherry picked from commit e3a6dec326a127ad549246435b9d3835e9a32407)

libgomp/ChangeLog.omp
libgomp/testsuite/libgomp.c++/static-aggr-constructor-destructor-1.C
libgomp/testsuite/libgomp.c++/static-aggr-constructor-destructor-2.C

index df075af915304ddee2a41ba7d0036a7ed77ffd2c..6e99c7107c89cd4c376cb4ddcfb59d5b83108b0c 100644 (file)
@@ -1,5 +1,13 @@
 2025-04-25  Thomas Schwinge  <tschwinge@baylibre.com>
 
+       Backported from trunk:
+       2024-08-08  Tobias Burnus  <tburnus@baylibre.com>
+
+       * testsuite/libgomp.c++/static-aggr-constructor-destructor-1.C: Split
+       scan-tree-dump into with and without target offload_target_any.
+       * testsuite/libgomp.c++/static-aggr-constructor-destructor-2.C:
+       Likewise.
+
        Backported from trunk:
        2024-08-07  Julian Brown  <julian@codesourcery.com>
                    Tobias Burnus  <tobias@baylibre.com>
index 403a071c0c01c4bf187c85ccc5b249b348345892..b5aafc8cabc2f0ed3fba147aeab89839b71df9e9 100644 (file)
@@ -9,9 +9,18 @@
 
 // { dg-final { scan-tree-dump-not "omp_is_initial_device" "optimized" } }
 // { dg-final { scan-tree-dump-not "__omp_target_static_init_and_destruction" "optimized" } }
-// FIXME: should be '-not' not '-times' 1:
-// { dg-final { scan-tree-dump-times "void _GLOBAL__off_I_v1" 1 "optimized" } }
-// { dg-final { scan-tree-dump-times "__attribute__\\(\\(\[^\n\r]*omp declare target nohost" 1 "optimized" } }
+
+// (A) No offloading configured: The symbols aren't present
+//     Caveat: They are present with -foffload=disable - or offloading
+//     configured but none of the optional offload packages/binaries installed.
+//     But the 'offload_target_any' check cannot distinguish those
+// { dg-final { scan-tree-dump-not "void _GLOBAL__off_I_v1" "optimized" { target { ! offload_target_any } } } }
+// { dg-final { scan-tree-dump-not "__attribute__\\(\\(\[^\n\r]*omp declare target nohost" "optimized" { target { ! offload_target_any } } } }
+
+// (B) With offload configured (and compiling for an offload target)
+//     the symbols are present (missed optimization). Hence: FIXME.
+// { dg-final { scan-tree-dump-times "void _GLOBAL__off_I_v1" 1 "optimized" { target offload_target_any } } }
+// { dg-final { scan-tree-dump-times "__attribute__\\(\\(\[^\n\r]*omp declare target nohost" 1 "optimized" { target offload_target_any } } }
 
 // { dg-final { only_for_offload_target amdgcn-amdhsa scan-offload-tree-dump-not "omp_initial_device;" "optimized" { target offload_target_amdgcn } } }
 // { dg-final { only_for_offload_target amdgcn-amdhsa scan-offload-tree-dump "v1\\._x = 5;" "optimized" { target offload_target_amdgcn } } }
index 6dd4260a522cb9783be0d5d18f42c492344d4121..9652a721bbe273ffabc9c226a56402a98f858452 100644 (file)
@@ -9,9 +9,19 @@
 
 // { dg-final { scan-tree-dump-not "omp_is_initial_device" "optimized" } }
 // { dg-final { scan-tree-dump-not "__omp_target_static_init_and_destruction" "optimized" } }
-// FIXME: should be '-not' not '-times' 1:
-// { dg-final { scan-tree-dump-times "void _GLOBAL__off_I_" 1 "optimized" } }
-// { dg-final { scan-tree-dump-times "__attribute__\\(\\(\[^\n\r]*omp declare target nohost" 1 "optimized" } }
+
+// (A) No offloading configured: The symbols aren't present
+//     Caveat: They are present with -foffload=disable - or offloading
+//     configured but none of the optional offload packages/binaries installed.
+//     But the 'offload_target_any' check cannot distinguish those
+// { dg-final { scan-tree-dump-not "void _GLOBAL__off_I_v1" "optimized" { target { ! offload_target_any } } } }
+// { dg-final { scan-tree-dump-not "__attribute__\\(\\(\[^\n\r]*omp declare target nohost" "optimized" { target { ! offload_target_any } } } }
+
+// (B) With offload configured (and compiling for an offload target)
+//     the symbols are present (missed optimization). Hence: FIXME.
+// { dg-final { scan-tree-dump-times "void _GLOBAL__off_I_v1" 1 "optimized" { target offload_target_any } } }
+// { dg-final { scan-tree-dump-times "__attribute__\\(\\(\[^\n\r]*omp declare target nohost" 1 "optimized" { target offload_target_any } } }
+
 
 // { dg-final { only_for_offload_target amdgcn-amdhsa scan-offload-tree-dump-not "omp_initial_device;" "optimized" { target offload_target_amdgcn } } }
 // { dg-final { only_for_offload_target amdgcn-amdhsa scan-offload-tree-dump "v1\\._x = 5;" "optimized" { target offload_target_amdgcn } } }