[04/19] GBE: remove image type's access qual from image type name.

Submitted by Yang, Rong R on Nov. 28, 2016, 11:32 a.m.

Details

Message ID 1480332765-3271-4-git-send-email-rong.r.yang@intel.com
State New
Headers show
Series "Series without cover letter" ( rev: 2 1 ) in Beignet

Not browsing as part of any series.

Commit Message

Yang, Rong R Nov. 28, 2016, 11:32 a.m.
OpenCL spec require type name don't include access qual, so remove it.

Signed-off-by: Yang Rong <rong.r.yang@intel.com>
---
 backend/src/llvm/llvm_gen_backend.cpp | 8 ++++++++
 1 file changed, 8 insertions(+)

Patch hide | download patch | download mbox

diff --git a/backend/src/llvm/llvm_gen_backend.cpp b/backend/src/llvm/llvm_gen_backend.cpp
index dea031b..17eaec6 100644
--- a/backend/src/llvm/llvm_gen_backend.cpp
+++ b/backend/src/llvm/llvm_gen_backend.cpp
@@ -2351,6 +2351,14 @@  namespace gbe
         }
         if(typeNameNode) {
           llvmInfo.typeName = (cast<MDString>(typeNameNode->getOperand(opID)))->getString();
+          //LLVM 3.9 image's type name include access qual, don't match OpenCL spec, erase them.
+          std::vector<std::string> filters = {"__read_only ", "__write_only "};
+          for (uint32_t i = 0; i < filters.size(); i++) {
+            size_t pos = llvmInfo.typeName.find(filters[i]);
+            if (pos != std::string::npos) {
+              llvmInfo.typeName = llvmInfo.typeName.erase(pos, filters[i].length());
+            }
+          }
         }
         if(typeBaseNameNode){
           llvmInfo.typeBaseName = (cast<MDString>(typeBaseNameNode->getOperand(opID)))->getString();