From: Yang Rong Date: Tue, 5 Nov 2013 05:55:23 +0000 (+0800) Subject: fix the error that structure would be pushed twice X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7dcf5a6c052e2a5402e92809661a52dc30a9e8fa;p=contrib%2Fbeignet.git fix the error that structure would be pushed twice Signed-off-by: Yang Rong Tested-by: Lu Guanqun Reviewed-by: Lu Guanqun --- 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); } }