[Beignet] [PATCH] GBE: fix two mix pointer bug.

Yang Rong rong.r.yang at intel.com
Fri Jan 6 14:59:15 UTC 2017


1. When update pointerOrigMap, only non-select and non-phi insn need
update second[0], if update select or phi's second[0], will over write the
info.
2. For legacy A64 mix pointer, tmp register is start from insn.extra.elem.

Signed-off-by: Yang Rong <rong.r.yang at intel.com>
---
 backend/src/backend/gen_context.cpp   | 4 ++--
 backend/src/llvm/llvm_gen_backend.cpp | 6 ++++--
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/backend/src/backend/gen_context.cpp b/backend/src/backend/gen_context.cpp
index 0c1f82a..bb104cf 100644
--- a/backend/src/backend/gen_context.cpp
+++ b/backend/src/backend/gen_context.cpp
@@ -2063,8 +2063,8 @@ namespace gbe
     if (bti.file == GEN_IMMEDIATE_VALUE) {
       p->UNTYPED_READ(dst, src, bti, elemNum);
     } else {
-      const GenRegister tmp = ra->genReg(insn.dst(elemNum));
-      const GenRegister btiTmp = ra->genReg(insn.dst(elemNum + 1));
+      const GenRegister tmp = ra->genReg(insn.dst(insn.extra.elem));
+      const GenRegister btiTmp = ra->genReg(insn.dst(insn.extra.elem + 1));
       unsigned desc = p->generateUntypedReadMessageDesc(0, elemNum);
 
       unsigned jip0 = beforeMessage(insn, bti, tmp, btiTmp, desc);
diff --git a/backend/src/llvm/llvm_gen_backend.cpp b/backend/src/llvm/llvm_gen_backend.cpp
index 467b1de..1e7b140 100644
--- a/backend/src/llvm/llvm_gen_backend.cpp
+++ b/backend/src/llvm/llvm_gen_backend.cpp
@@ -929,7 +929,8 @@ namespace gbe
               pointerOrigMap.insert(std::make_pair(work, pointers));
             } else {
               // update the pointer source here,
-              (*ptrIter).second[0] = ptr;
+              if ((!isa<SelectInst>(work) && !isa<PHINode>(work)))
+                (*ptrIter).second[0] = ptr;
             }
 
             continue;
@@ -975,7 +976,8 @@ namespace gbe
             pointerOrigMap.insert(std::make_pair(pointer, pointers));
           } else {
             // update the pointer source here,
-            (*ptrIter).second[0] = ptr;
+            if ((!isa<SelectInst>(pointer) && !isa<PHINode>(pointer)))
+              (*ptrIter).second[0] = ptr;
           }
         } else {
           workList.push_back(theUser);
-- 
2.1.4



More information about the Beignet mailing list