[clang] [flang] [flang][OpenMP] Globalize MAIN scalars used in parallel regions (PR #236384)

Sergey Shcherbinin via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 9 02:39:48 PST 2026


================
@@ -0,0 +1,126 @@
+! Check reuse of storage-selection and host-binding analysis results. Trace
+! checks require assertions; the IR checks also run without the asserts feature.
+! REQUIRES: module-independent
+! RUN: split-file %s %t
+! RUN: %if asserts %{ bbc -fopenmp -pft-test -debug-only=flang-pft %t/saved.f90 2>&1 | FileCheck %s --check-prefix=OFF %}
+! RUN: %flang_fc1 -fopenmp -fno-automatic -emit-hlfir %if asserts %{ -mllvm -debug-only=flang-pft %} %t/nested.f90 -o %t.auto > %t.auto-trace 2>&1
+! RUN: %if asserts %{ FileCheck %s --check-prefix=OFF --allow-empty < %t.auto-trace %}
+! RUN: FileCheck %s --check-prefix=SAVED < %t.auto
+! RUN: %if asserts %{ bbc -fopenmp -pft-test -debug-only=flang-pft %t/pruned.f90 2>&1 | FileCheck %s --check-prefix=PRUNED %}
+! RUN: %if asserts %{ bbc -fopenmp -pft-test -debug-only=flang-pft %t/nested.f90 2>&1 | FileCheck %s --check-prefix=EXPR %}
+! RUN: %if asserts %{ bbc -fopenmp -fno-openmp-main-program-globals -pft-test -debug-only=flang-pft %t/nested.f90 2>&1 | FileCheck %s --check-prefix=OFF %}
+! RUN: %flang_fc1 -fopenmp -emit-hlfir -module-dir %t %if asserts %{ -mllvm -debug-only=flang-lower-bridge,flang-lower-variable,flang-pft,flang-host-assoc %} %t/owner.f90 -o %t.owner > %t.trace 2>&1
+! RUN: FileCheck %s --check-prefix=IR < %t.owner
+! RUN: FileCheck %s --check-prefix=UNUSED < %t.owner
+! RUN: %if asserts %{ FileCheck %s --check-prefix=STORE < %t.trace %}
+! RUN: %if asserts %{ FileCheck %s --check-prefix=CACHE < %t.trace %}
+! RUN: %if asserts %{ FileCheck %s --check-prefix=ROOTS < %t.trace %}
+! RUN: %if asserts %{ FileCheck %s --check-prefix=TAILS < %t.trace %}
+! RUN: %flang_fc1 -fopenmp -fsave-main-program -emit-hlfir %if asserts %{ -mllvm -debug-only=flang-pft %} %t/nested.f90 -o %t.saved > %t.save-trace 2>&1
+! RUN: %if asserts %{ FileCheck %s --check-prefix=OFF --allow-empty < %t.save-trace %}
+! RUN: FileCheck %s --check-prefix=SAVED < %t.saved
+! SAVED-DAG: fir.global internal @_QFEsink : i32
+! SAVED-DAG: fir.global internal @_QFEx1 : i32
+! EXPR-COUNT-18: main-global symbol
----------------
SergeyShch01 wrote:

Done. Removed the test-only debug output and checks that counted it. The tests now check generated IR for selected globals, host-tuple contents, and captured-variable bindings, including their required EQUIVALENCE/COMMON storage.


https://github.com/llvm/llvm-project/pull/236384


More information about the cfe-commits mailing list