mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-25 13:24:46 +00:00
[MachineCopyPropagation] Fix a bug with undef handling when the value is actualy alive.
Test case will follow. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238518 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -252,11 +252,7 @@ bool MachineCopyPropagation::CopyPropagateBlock(MachineBasicBlock &MBB) {
|
|||||||
report_fatal_error("MachineCopyPropagation should be run after"
|
report_fatal_error("MachineCopyPropagation should be run after"
|
||||||
" register allocation!");
|
" register allocation!");
|
||||||
|
|
||||||
// Treat undef use like defs.
|
if (MO.isDef()) {
|
||||||
// The backends are allowed to do whatever they want with undef value
|
|
||||||
// and we cannot be sure this register will not be rewritten to break
|
|
||||||
// some false dependencies for the hardware for instance.
|
|
||||||
if (MO.isDef() || MO.isUndef()) {
|
|
||||||
Defs.push_back(Reg);
|
Defs.push_back(Reg);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -270,6 +266,14 @@ bool MachineCopyPropagation::CopyPropagateBlock(MachineBasicBlock &MBB) {
|
|||||||
MaybeDeadCopies.remove(CI->second);
|
MaybeDeadCopies.remove(CI->second);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Treat undef use like defs for copy propagation but not for
|
||||||
|
// dead copy. We would need to do a liveness check to be sure the copy
|
||||||
|
// is dead for undef uses.
|
||||||
|
// The backends are allowed to do whatever they want with undef value
|
||||||
|
// and we cannot be sure this register will not be rewritten to break
|
||||||
|
// some false dependencies for the hardware for instance.
|
||||||
|
if (MO.isUndef())
|
||||||
|
Defs.push_back(Reg);
|
||||||
}
|
}
|
||||||
|
|
||||||
// The instruction has a register mask operand which means that it clobbers
|
// The instruction has a register mask operand which means that it clobbers
|
||||||
|
Reference in New Issue
Block a user