diff options
author | Zhigang Gong <zhigang.gong@intel.com> | 2015-09-24 09:14:43 +0800 |
---|---|---|
committer | Yang Rong <rong.r.yang@intel.com> | 2015-10-08 16:36:06 +0800 |
commit | 9c55764768009ff6d2c30878ef595b3cc247867f (patch) | |
tree | 3513bf4578554d3bcee43fa5c682727f4ed6c9ff /backend | |
parent | dac74b637918b4a498a7a67de69cc15373fc9eba (diff) |
GBE: Don't try to remove instructions when liveness is in dynamic update phase.
As we want to avoid liveness update all the time, we maintain the liveness
information dynamically during the phi mov optimization. Instruction(self-copy)
remving bring unecessary complexity here. Let's avoid do that here, and do
the self-copy removing latter in removeMOVs().
v2:
forgot to remove incorrect liveness checking for special registers.
Now remove them.
Signed-off-by: Zhigang Gong <zhigang.gong@intel.com>
Reviewed-by: Ruiling Song <ruiling.song@intel.com>
Diffstat (limited to 'backend')
-rw-r--r-- | backend/src/llvm/llvm_gen_backend.cpp | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/backend/src/llvm/llvm_gen_backend.cpp b/backend/src/llvm/llvm_gen_backend.cpp index b0b97e7e..dc2e3e81 100644 --- a/backend/src/llvm/llvm_gen_backend.cpp +++ b/backend/src/llvm/llvm_gen_backend.cpp @@ -2149,6 +2149,11 @@ namespace gbe // destinations) uint32_t insnID = 2; bb.foreach([&](ir::Instruction &insn) { + if (insn.getOpcode() == ir::OP_MOV && + insn.getDst(0) == insn.getSrc(0)) { + insn.remove(); + return; + } const uint32_t dstNum = insn.getDstNum(); const uint32_t srcNum = insn.getSrcNum(); for (uint32_t srcID = 0; srcID < srcNum; ++srcID) { @@ -2245,8 +2250,7 @@ namespace gbe ++iter; } if (!phiPhiCopySrcInterfere) { - // phiCopy source can be coaleased with phiCopy - const_cast<Instruction *>(phiCopyDefInsn)->remove(); + replaceSrc(const_cast<Instruction *>(phiCopyDefInsn), phiCopySrc, phiCopy); for (auto &s : *phiCopySrcDef) { const Instruction *phiSrcDefInsn = s->getInstruction(); @@ -2300,7 +2304,7 @@ namespace gbe // coalease phi and phiCopy if (isOpt) { for (auto &x : *phiDef) { - const_cast<Instruction *>(x->getInstruction())->remove(); + replaceDst(const_cast<Instruction *>(x->getInstruction()), phi, phiCopy); } for (auto &x : *phiUse) { const Instruction *phiUseInsn = x->getInstruction(); @@ -2361,21 +2365,11 @@ namespace gbe const ir::UseSet *phiCopySrcUse = dag->getRegUse(phiCopySrc); for (auto &s : *phiCopySrcDef) { const Instruction *phiSrcDefInsn = s->getInstruction(); - if (phiSrcDefInsn->getOpcode() == ir::OP_MOV && - phiSrcDefInsn->getSrc(0) == phiCopy) { - const_cast<Instruction *>(phiSrcDefInsn)->remove(); - continue; - } replaceDst(const_cast<Instruction *>(phiSrcDefInsn), phiCopySrc, phiCopy); } for (auto &s : *phiCopySrcUse) { const Instruction *phiSrcUseInsn = s->getInstruction(); - if (phiSrcUseInsn->getOpcode() == ir::OP_MOV && - phiSrcUseInsn->getDst(0) == phiCopy) { - const_cast<Instruction *>(phiSrcUseInsn)->remove(); - continue; - } replaceSrc(const_cast<Instruction *>(phiSrcUseInsn), phiCopySrc, phiCopy); } @@ -2405,7 +2399,6 @@ namespace gbe } else break; - break; nextRedundant->clear(); replacedRegs.clear(); revReplacedRegs.clear(); |