diff options
| author | Yaxun Liu <Yaxun.Liu@amd.com> | 2016-11-01 18:45:32 +0000 |
|---|---|---|
| committer | Yaxun Liu <Yaxun.Liu@amd.com> | 2016-11-01 18:45:32 +0000 |
| commit | 7d07ae7c8574cc15051f814ad03a08b137e521d5 (patch) | |
| tree | 2c001b46e33347559b107f738c6dc5c0d7ef12df /clang/lib/CodeGen | |
| parent | cb578f84e091e9198b25c687d0f5f1dc558f27c5 (diff) | |
| download | bcm5719-llvm-7d07ae7c8574cc15051f814ad03a08b137e521d5.tar.gz bcm5719-llvm-7d07ae7c8574cc15051f814ad03a08b137e521d5.zip | |
[OpenCL] Mark group functions as convergent in opencl-c.h
Certain OpenCL builtin functions are supposed to be executed by all threads in a work group or sub group. Such functions should not be made divergent during transformation. It makes sense to mark them with convergent attribute.
The adding of convergent attribute is based on Ettore Speziale's work and the original proposal and patch can be found at https://www.mail-archive.com/cfe-commits@lists.llvm.org/msg22271.html.
Differential Revision: https://reviews.llvm.org/D25343
llvm-svn: 285725
Diffstat (limited to 'clang/lib/CodeGen')
| -rw-r--r-- | clang/lib/CodeGen/CGCall.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp index 86aaad04361..d57fb2eac2e 100644 --- a/clang/lib/CodeGen/CGCall.cpp +++ b/clang/lib/CodeGen/CGCall.cpp @@ -1648,6 +1648,8 @@ void CodeGenModule::ConstructAttributeList( FuncAttrs.addAttribute(llvm::Attribute::NoReturn); if (TargetDecl->hasAttr<NoDuplicateAttr>()) FuncAttrs.addAttribute(llvm::Attribute::NoDuplicate); + if (TargetDecl->hasAttr<ConvergentAttr>()) + FuncAttrs.addAttribute(llvm::Attribute::Convergent); if (const FunctionDecl *Fn = dyn_cast<FunctionDecl>(TargetDecl)) { AddAttributesFromFunctionProtoType( |

