[Beignet] [PATCH v2 1/2] fix the error that structure would be pushed twice
Lu Guanqun
guanqun.lu at intel.com
Mon Nov 4 21:25:52 PST 2013
From: Yang Rong <rong.r.yang at intel.com>
Signed-off-by: Yang Rong <rong.r.yang at intel.com>
Tested-by: Lu Guanqun <guanqun.lu at intel.com>
Reviewed-by: Lu Guanqun <guanqun.lu at intel.com>
---
backend/src/ir/lowering.cpp | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/backend/src/ir/lowering.cpp b/backend/src/ir/lowering.cpp
index 6cccaf5..013878c 100644
--- a/backend/src/ir/lowering.cpp
+++ b/backend/src/ir/lowering.cpp
@@ -233,8 +233,14 @@ namespace ir {
const PushLocation argLocation(*fn, loadAddImm.argID, offset);
if (inserted.contains(argLocation))
continue;
+ Register pushed;
const Register reg = load->getValue(valueID);
- const Register pushed = fn->newRegister(family);
+ if (offset != 0) {
+ pushed = fn->newRegister(family);
+ this->appendPushedConstant(pushed, argLocation);
+ } else {
+ pushed = fn->getArg(loadAddImm.argID).reg;
+ }
// TODO the MOV instruction can be most of the time avoided if the
// register is never written. We must however support the register
@@ -243,7 +249,6 @@ namespace ir {
const Instruction mov = ir::MOV(type, reg, pushed);
mov.replace(load);
dead.insert(load);
- this->appendPushedConstant(pushed, argLocation);
}
}
More information about the Beignet
mailing list