GBE: Correctly process constant for phi instruction
authorRuiling Song <ruiling.song@intel.com>
Wed, 18 Jun 2014 07:59:53 +0000 (15:59 +0800)
committerZhigang Gong <zhigang.gong@intel.com>
Wed, 18 Jun 2014 12:01:08 +0000 (20:01 +0800)
Simply use getRegister which deals with various ConstantExpr.
Thanks to Abrahm Scully who report the bug.

Signed-off-by: Ruiling Song <ruiling.song@intel.com>
Reviewed-by: Zhigang Gong <zhigang.gong@linux.intel.com>
backend/src/llvm/llvm_gen_backend.cpp

index 08fe8b6..8662415 100644 (file)
@@ -1076,9 +1076,7 @@ namespace gbe
           if (CPV && dyn_cast<ConstantVector>(CPV) &&
               isa<UndefValue>(extractConstantElem(CPV, 0)))
             continue;
-          const ir::ImmediateIndex immIndex = this->newImmediate(CP);
-          const ir::Immediate imm = ctx.getImmediate(immIndex);
-          ctx.LOADI(imm.type, dst, immIndex);
+          ctx.MOV(type, dst, getRegister(CP));
         } else if (regTranslator.valueExists(IV,0) || dyn_cast<Constant>(IV)) {
           const ir::Register src = this->getRegister(IV);
           ctx.MOV(type, dst, src);