From: Zhigang Gong Date: Thu, 24 Apr 2014 10:18:40 +0000 (+0800) Subject: GBE: fixed a potential scalarize bug. X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=cab7428869d0532dcba90cb78ef8bb8f1679fedb;p=contrib%2Fbeignet.git GBE: fixed a potential scalarize bug. 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 Tested-by: "Song, Ruiling" --- 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; }