diff options
author | Yang Rong <rong.r.yang@intel.com> | 2015-05-11 14:02:52 +0800 |
---|---|---|
committer | Zhigang Gong <zhigang.gong@intel.com> | 2015-05-12 15:15:15 +0800 |
commit | 348262f0a905dd66f2ffca67127fa605c12791cb (patch) | |
tree | a0e82533b39a19ca1ae3192ecf1426801d0f706d | |
parent | 83f8739b6fc4893fac60145326052ccb5cf653dc (diff) |
Fix two argument lowering bug.
1. When there are some mismatch AddImm/Load, may be a indirect load, should return false.
2. Can't remove load in REMOVE_INSN, because load's use is not empty. Force remove it.
Signed-off-by: Yang Rong <rong.r.yang@intel.com>
Reviewed-by: Zhigang Gong <zhigang.gong@linux.intel.com>
-rw-r--r-- | backend/src/ir/lowering.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/backend/src/ir/lowering.cpp b/backend/src/ir/lowering.cpp index 73b1dd2b..0e36907b 100644 --- a/backend/src/ir/lowering.cpp +++ b/backend/src/ir/lowering.cpp @@ -259,11 +259,12 @@ namespace ir { replaced = true; } - if (replaced) + if (replaced) { dead.insert(load); + load->remove(); + } } - REMOVE_INSN(load) REMOVE_INSN(add) REMOVE_INSN(loadImm) } @@ -298,6 +299,7 @@ namespace ir { { const FunctionArgument &arg = fn->getArg(argID); LoadAddImmSeq tmpSeq; + bool match = true; // Inspect all uses of the function argument pointer const UseSet &useSet = dag->getUse(&arg); @@ -345,7 +347,8 @@ namespace ir { if (matchLoad(insn, add, loadImm, offset, argID, loadAddImm)) { tmpSeq.push_back(loadAddImm); continue; - } + } else + match = false; } } @@ -353,7 +356,7 @@ namespace ir { // direct load definitions we found for (const auto &loadImmSeq : tmpSeq) seq.push_back(loadImmSeq); - return true; + return match; } ArgUse FunctionArgumentLowerer::getArgUse(uint32_t argID) |