[clang] [Clang] Automatically enable `-fconvergent-functions` on GPU targets (PR #111076)

Matt Arsenault via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 3 23:59:39 PDT 2024


================
@@ -4106,9 +4106,10 @@ bool CompilerInvocation::ParseLangArgs(LangOptions &Opts, ArgList &Args,
   Opts.Blocks = Args.hasArg(OPT_fblocks) || (Opts.OpenCL
     && Opts.OpenCLVersion == 200);
 
-  Opts.ConvergentFunctions = Args.hasArg(OPT_fconvergent_functions) ||
-                             Opts.OpenCL || (Opts.CUDA && Opts.CUDAIsDevice) ||
-                             Opts.SYCLIsDevice || Opts.HLSL;
+  Opts.ConvergentFunctions = Args.hasFlag(
+      OPT_fconvergent_functions, OPT_fno_convergent_functions,
+      Opts.OpenMPIsTargetDevice || T.isAMDGPU() || T.isNVPTX() || Opts.OpenCL ||
+          Opts.CUDAIsDevice || Opts.SYCLIsDevice || Opts.HLSL);
----------------
arsenm wrote:

Sort all the language checks together, before the target list. We probably should have a hasConvergentOperations() predicate somewhere 

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


More information about the cfe-commits mailing list