summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZhigang Gong <zhigang.gong@intel.com>2015-09-06 14:53:27 +0800
committerZhigang Gong <zhigang.gong@intel.com>2015-09-07 08:18:04 +0800
commit7f5e4e3b5816f0e25c4eef5f3eccd030b2517063 (patch)
treec511d4114a7a5ecae46159b166876a0ea2ca5300
parentba98fdb9d34fbe7b1b1bf7964a5a7176c68287ff (diff)
GBE: Fix one DAG analysis issue and enable multiple round phi copy elimination.
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.gong@intel.com>
-rw-r--r--backend/src/ir/value.cpp2
-rw-r--r--backend/src/llvm/llvm_gen_backend.cpp1
2 files changed, 1 insertions, 2 deletions
diff --git a/backend/src/ir/value.cpp b/backend/src/ir/value.cpp
index 72caa133..027c8de2 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 1d097277..4ac2c53a 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();