Even if one value is killed in current BB, we still need to pass predecessor's definition into this BB. Otherwise, we will miss one definition.
BB0: MOV %foo, %src0 BB1: MUL %foo, %src1, %f00 ... BR BB1 In the above case, both BB1 and BB0 are the predecessors of BB1. When pass the definition of %foo in BB0 to BB1, the previous implementation will ignore it because %foo is killed in BB1, this is a bug. This patch fixes it. And thus we can enable multiple round phi copy elimination safely. Signed-off-by: Zhigang Gong <zhigang.g...@intel.com> --- backend/src/ir/value.cpp | 2 +- backend/src/llvm/llvm_gen_backend.cpp | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/backend/src/ir/value.cpp b/backend/src/ir/value.cpp index 75a100f..7b54763 100644 --- a/backend/src/ir/value.cpp +++ b/backend/src/ir/value.cpp @@ -242,7 +242,7 @@ namespace ir { const BasicBlock &pbb = pred.bb; for (auto reg : curr.liveOut) { if (pred.inLiveOut(reg) == false) continue; - if (curr.inVarKill(reg) == true) continue; + if (curr.inVarKill(reg) == true && curr.inUpwardUsed(reg) == false) continue; RegDefSet &currSet = this->getDefSet(&bb, reg); RegDefSet &predSet = this->getDefSet(&pbb, reg); diff --git a/backend/src/llvm/llvm_gen_backend.cpp b/backend/src/llvm/llvm_gen_backend.cpp index 1d09727..4ac2c53 100644 --- a/backend/src/llvm/llvm_gen_backend.cpp +++ b/backend/src/llvm/llvm_gen_backend.cpp @@ -2403,7 +2403,6 @@ namespace gbe } else break; - break; nextRedundant->clear(); replacedRegs.clear(); revReplacedRegs.clear(); -- 1.9.1 _______________________________________________ Beignet mailing list Beignet@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/beignet