mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-17 04:24:00 +00:00
[MachineCopyPropagation] Handle undef flags conservatively so that we do not
remove copies that are useful after breaking some hardware dependencies. In other words, handle this kind of situations conservatively by assuming reg2 is redefined by the undef flag. reg1 = copy reg2 = inst reg2<undef> reg2 = copy reg1 Copy propagation used to remove the last copy. This is incorrect because the undef flag on reg2 in inst, allows next passes to put whatever trashed value in reg2 that may help. In practice we end up with this code: reg1 = copy reg2 reg2 = 0 = inst reg2<undef> reg2 = copy reg1 This fixes PR21743. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235647 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -252,7 +252,11 @@ bool MachineCopyPropagation::CopyPropagateBlock(MachineBasicBlock &MBB) {
|
||||
report_fatal_error("MachineCopyPropagation should be run after"
|
||||
" register allocation!");
|
||||
|
||||
if (MO.isDef()) {
|
||||
// Treat undef use like defs.
|
||||
// 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);
|
||||
continue;
|
||||
}
|
||||
|
Reference in New Issue
Block a user