[clang] [clang][OpenMP] Add OpenMP GPU optimization flag framework (PR #178914)

Nicole Aschenbrenner via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 6 00:17:31 PST 2026


================
@@ -4012,6 +4016,21 @@ def fopenmp_target_new_runtime : Flag<["-"], "fopenmp-target-new-runtime">,
   Group<f_Group>, Flags<[HelpHidden]>, Visibility<[ClangOption, CC1Option]>;
 def fno_openmp_target_new_runtime : Flag<["-"], "fno-openmp-target-new-runtime">,
   Group<f_Group>, Flags<[HelpHidden]>, Visibility<[ClangOption, CC1Option]>;
+def fopenmp_target_ignore_env_vars : Flag<["-"], "fopenmp-target-ignore-env-vars">,
+  Group<f_Group>, Flags<[NoArgumentUnused, HelpHidden]>,
+  Visibility<[ClangOption, CC1Option]>,
+  HelpText<"Assume that the OpenMP runtime can ignore environment variables during code generation for GPU offload">,
+  MarshallingInfoFlag<LangOpts<"OpenMPTargetIgnoreEnvVars">>;
+def fno_openmp_target_ignore_env_vars : Flag<["-"], "fno-openmp-target-ignore-env-vars">,
----------------
nicebert wrote:

Good point about consolidating with `defm`. However, the existing positive flags (`fopenmp_assume_no_thread_state`, `fopenmp_assume_no_nested_parallelism`) already have `MarshallingInfoFlag` that generates the corresponding LangOpts. Using `defm` would require restructuring those existing definitions, which goes beyond the scope of just adding negative variants.

For this patch, I've kept the minimal change of just adding the `fno_*` definitions that enable last-wins semantics. We can consider consolidating with `defm` in a follow-up NFC patch that restructures all the assume flags together.

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


More information about the cfe-commits mailing list