mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-05-22 03:39:03 +00:00
Fix a logic error. An instruction that has a live physical register def cannot be CSE'ed, but it *can* be used to replace a common subexpression.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97688 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
a92dced4a1
commit
67bda7215b
@ -128,8 +128,6 @@ bool MachineCSE::ProcessBlock(MachineDomTreeNode *Node) {
|
|||||||
if (TII->isMoveInstr(*MI, SrcReg, DstReg, SrcSubIdx, DstSubIdx) ||
|
if (TII->isMoveInstr(*MI, SrcReg, DstReg, SrcSubIdx, DstSubIdx) ||
|
||||||
MI->isExtractSubreg() || MI->isInsertSubreg() || MI->isSubregToReg())
|
MI->isExtractSubreg() || MI->isInsertSubreg() || MI->isSubregToReg())
|
||||||
continue;
|
continue;
|
||||||
if (hasLivePhysRegDefUse(MI))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
bool FoundCSE = VNT.count(MI);
|
bool FoundCSE = VNT.count(MI);
|
||||||
if (!FoundCSE) {
|
if (!FoundCSE) {
|
||||||
@ -138,6 +136,11 @@ bool MachineCSE::ProcessBlock(MachineDomTreeNode *Node) {
|
|||||||
FoundCSE = VNT.count(MI);
|
FoundCSE = VNT.count(MI);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If the instruction defines a physical register and the value *may* be
|
||||||
|
// used, then it's not safe to replace it with a common subexpression.
|
||||||
|
if (FoundCSE && hasLivePhysRegDefUse(MI))
|
||||||
|
FoundCSE = false;
|
||||||
|
|
||||||
if (!FoundCSE) {
|
if (!FoundCSE) {
|
||||||
VNT.insert(MI, CurrVN++);
|
VNT.insert(MI, CurrVN++);
|
||||||
Exps.push_back(MI);
|
Exps.push_back(MI);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user