GBE: fixed a potential scalarize bug.
authorZhigang Gong <zhigang.gong@intel.com>
Thu, 24 Apr 2014 10:18:40 +0000 (18:18 +0800)
committerZhigang Gong <zhigang.gong@intel.com>
Mon, 28 Apr 2014 02:55:59 +0000 (10:55 +0800)
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@intel.com>
Tested-by: "Song, Ruiling" <ruiling.song@intel.com>
backend/src/llvm/llvm_scalarize.cpp

index 911be30..73817e2 100644 (file)
@@ -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;
   }