From cab7428869d0532dcba90cb78ef8bb8f1679fedb Mon Sep 17 00:00:00 2001 From: Zhigang Gong Date: Thu, 24 Apr 2014 18:18:40 +0800 Subject: [PATCH] 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" --- 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; } -- 2.7.4