[PATCH] D149028: [Clang] Always pass `-fconvergent-functions` for GPU targets

Joseph Huber via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Apr 23 12:44:54 PDT 2023


jhuber6 updated this revision to Diff 516198.
jhuber6 added a comment.
Herald added subscribers: mattd, asavonic.

Add test


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D149028/new/

https://reviews.llvm.org/D149028

Files:
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/test/CodeGen/nvptx_attributes.c


Index: clang/test/CodeGen/nvptx_attributes.c
===================================================================
--- clang/test/CodeGen/nvptx_attributes.c
+++ clang/test/CodeGen/nvptx_attributes.c
@@ -1,7 +1,7 @@
 // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --function-signature --check-attributes --check-globals
 // RUN: %clang_cc1 -triple nvptx64-nvidia-cuda -target-cpu sm_61 -emit-llvm %s -o - | FileCheck %s
 
-// CHECK: Function Attrs: noinline nounwind optnone
+// CHECK: Function Attrs: convergent noinline nounwind optnone
 // CHECK-LABEL: define {{[^@]+}}@foo
 // CHECK-SAME: (ptr noundef [[RET:%.*]]) #[[ATTR0:[0-9]+]] {
 // CHECK-NEXT:  entry:
Index: clang/lib/Frontend/CompilerInvocation.cpp
===================================================================
--- clang/lib/Frontend/CompilerInvocation.cpp
+++ clang/lib/Frontend/CompilerInvocation.cpp
@@ -3737,7 +3737,7 @@
     && Opts.OpenCLVersion == 200);
 
   Opts.ConvergentFunctions = Opts.OpenCL || (Opts.CUDA && Opts.CUDAIsDevice) ||
-                             Opts.SYCLIsDevice ||
+                             Opts.SYCLIsDevice || T.isNVPTX() || T.isAMDGPU() ||
                              Args.hasArg(OPT_fconvergent_functions);
 
   Opts.NoBuiltin = Args.hasArg(OPT_fno_builtin) || Opts.Freestanding;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D149028.516198.patch
Type: text/x-patch
Size: 1327 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230423/10d777e8/attachment.bin>


More information about the cfe-commits mailing list