[Beignet] [PATCH 2/2] GBE: fixed a potential scalarize bug.

Zhigang Gong zhigang.gong at intel.com
Thu Apr 24 03:18:40 PDT 2014


We need to append extract instruction when do a bitcast to
a vector. Otherwise, we may trigger an assert as the extract
instruction uses a undefined vector.

After this patch, it becomes safe to do many rounds of scalarize
pass.

Signed-off-by: Zhigang Gong <zhigang.gong at intel.com>
---
 backend/src/llvm/llvm_scalarize.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/backend/src/llvm/llvm_scalarize.cpp b/backend/src/llvm/llvm_scalarize.cpp
index 911be30..73817e2 100644
--- a/backend/src/llvm/llvm_scalarize.cpp
+++ b/backend/src/llvm/llvm_scalarize.cpp
@@ -683,8 +683,10 @@ namespace gbe {
   {
     if(bt->getOperand(0)->getType()->isVectorTy())
       bt->setOperand(0, InsertToVector(bt, bt->getOperand(0)));
-    if(bt->getType()->isVectorTy())
+    if(bt->getType()->isVectorTy()) {
+      setAppendPoint(bt);
       extractFromVector(bt);
+    }
     return false;
   }
 
-- 
1.8.3.2



More information about the Beignet mailing list