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

commit r15-5960-gab5bd6ac68c6d9f870fcaf0de4a73f3dec920db9
Author: Thomas Schwinge <tschwi...@baylibre.com>
Date:   Mon Oct 14 10:45:06 2024 +0200

    Fortran: Use OpenACC's acc_on_device builtin, fix OpenMP' 
__builtin_is_initial_device: Revert 'gimple_fold_builtin_acc_on_device' change
    
    The motivation of the 'gimple_fold_builtin_acc_on_device' change in
    commit 3269a722b7a03613e9c4e2862bc5088c4a17cc11
    "Fortran: Use OpenACC's acc_on_device builtin, fix OpenMP' 
__builtin_is_initial_device"
    is unclear, and it unnecessarily diverges GCC's (default)
    '--disable-offload-targets' vs. '--enable-offload-targets=[...]'
    configurations.
    
            PR testsuite/82250
            gcc/
            * gimple-fold.cc (gimple_fold_builtin_acc_on_device): Revert last
            change.
            libgomp/
            * testsuite/libgomp.oacc-c-c++-common/routine-nohost-1.c: Revert
            last change.

Diff:
---
 gcc/gimple-fold.cc                                             | 2 +-
 libgomp/testsuite/libgomp.oacc-c-c++-common/routine-nohost-1.c | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/gcc/gimple-fold.cc b/gcc/gimple-fold.cc
index 3c72cd6c79ae..3c0abf26be7a 100644
--- a/gcc/gimple-fold.cc
+++ b/gcc/gimple-fold.cc
@@ -4231,7 +4231,7 @@ static bool
 gimple_fold_builtin_acc_on_device (gimple_stmt_iterator *gsi, tree arg0)
 {
   /* Defer folding until we know which compiler we're in.  */
-  if (ENABLE_OFFLOADING && symtab->state != EXPANSION)
+  if (symtab->state != EXPANSION)
     return false;
 
   unsigned val_host = GOMP_DEVICE_HOST;
diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/routine-nohost-1.c 
b/libgomp/testsuite/libgomp.oacc-c-c++-common/routine-nohost-1.c
index e64711b536bb..7dc7459e5fe1 100644
--- a/libgomp/testsuite/libgomp.oacc-c-c++-common/routine-nohost-1.c
+++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/routine-nohost-1.c
@@ -36,7 +36,8 @@ static int fact_nohost(int n)
 
   return fact(n);
 }
-/* { dg-final { scan-tree-dump-times {(?n)^OpenACC routine 'fact_nohost' has 
'nohost' clause\.$} 1 oaccloops { target { c && offloading_enabled } } } }
+/* { dg-final { scan-tree-dump-times {(?n)^OpenACC routine 'fact_nohost' has 
'nohost' clause\.$} 1 oaccloops { target c } } }
+   { dg-final { scan-tree-dump-times {(?n)^OpenACC routine 'int 
fact_nohost\(int\)' has 'nohost' clause\.$} 1 oaccloops { target { c++ && { ! 
offloading_enabled } } } } }
    { dg-final { scan-tree-dump-times {(?n)^OpenACC routine 
'fact_nohost\(int\)' has 'nohost' clause\.$} 1 oaccloops { target { c++ && 
offloading_enabled } } } }
    TODO See PR101551 for 'offloading_enabled' differences.  */

Reply via email to