For instructions that reference an undef value, we simply
allocate a register to the undef operand and set as 0.

Signed-off-by: Ruiling Song <[email protected]>
---
 backend/src/llvm/llvm_gen_backend.cpp |    7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/backend/src/llvm/llvm_gen_backend.cpp 
b/backend/src/llvm/llvm_gen_backend.cpp
index 62d6eab..b06ca33 100644
--- a/backend/src/llvm/llvm_gen_backend.cpp
+++ b/backend/src/llvm/llvm_gen_backend.cpp
@@ -879,6 +879,13 @@ namespace gbe
     if(isa<GlobalValue>(c)) {
       return regTranslator.getScalar(c, elemID);
     }
+    if(isa<UndefValue>(c)) {
+      ir::Type dstType = getType(ctx, c->getType());
+      ir::Register reg = ctx.reg(getFamily(dstType));
+      ir::ImmediateIndex immIndex = ctx.newIntegerImmediate(0, dstType);
+      ctx.LOADI(dstType, reg, immIndex);
+      return reg;
+    }
 
     if(isa<ConstantExpr>(c)) {
       ConstantExpr * ce = dyn_cast<ConstantExpr>(c);
-- 
1.7.9.5

_______________________________________________
Beignet mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/beignet

Reply via email to