diff options
author | Alexey Bader <alexey.bader@intel.com> | 2017-11-15 11:38:17 +0000 |
---|---|---|
committer | Alexey Bader <alexey.bader@intel.com> | 2017-11-15 11:38:17 +0000 |
commit | bed400957bfec6f342a65646f4dd7c5e7f270c95 (patch) | |
tree | ecf13a8feb2c3d63c4327723bfd4bb9a246b5823 /clang/lib/CodeGen/CGDecl.cpp | |
parent | 294e689509fac4ce335b5abae944684b76ee7cdc (diff) | |
download | bcm5719-llvm-bed400957bfec6f342a65646f4dd7c5e7f270c95.tar.gz bcm5719-llvm-bed400957bfec6f342a65646f4dd7c5e7f270c95.zip |
[OpenCL] Fix code generation of function-scope constant samplers.
Summary:
Constant samplers are handled as static variables and clang's code generation
library, which leads to llvm::unreachable. We bypass emitting sampler variable
as static since it's translated to a function call later.
Reviewers: yaxunl, Anastasia
Reviewed By: yaxunl, Anastasia
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D34342
llvm-svn: 318290
Diffstat (limited to 'clang/lib/CodeGen/CGDecl.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGDecl.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CGDecl.cpp b/clang/lib/CodeGen/CGDecl.cpp index 44a6db4750f..e9f58cfac68 100644 --- a/clang/lib/CodeGen/CGDecl.cpp +++ b/clang/lib/CodeGen/CGDecl.cpp @@ -162,6 +162,10 @@ void CodeGenFunction::EmitVarDecl(const VarDecl &D) { // needs to be emitted like a static variable, e.g. a function-scope // variable in constant address space in OpenCL. if (D.getStorageDuration() != SD_Automatic) { + // Static sampler variables translated to function calls. + if (D.getType()->isSamplerT()) + return; + llvm::GlobalValue::LinkageTypes Linkage = CGM.getLLVMLinkageVarDefinition(&D, /*isConstant=*/false); |