diff options
author | Quentin Colombet <qcolombet@apple.com> | 2015-05-28 22:38:40 +0000 |
---|---|---|
committer | Quentin Colombet <qcolombet@apple.com> | 2015-05-28 22:38:40 +0000 |
commit | 75afbfd4a14a31772528918f9d284793e775272a (patch) | |
tree | c863332eefe2b1101c841bbe53fc9072fac9dd48 /llvm/lib/CodeGen/MachineCopyPropagation.cpp | |
parent | cb337035f2b145dbad697ba203bd43a6de32be46 (diff) | |
download | bcm5719-llvm-75afbfd4a14a31772528918f9d284793e775272a.tar.gz bcm5719-llvm-75afbfd4a14a31772528918f9d284793e775272a.zip |
[MachineCopyPropagation] Fix a bug with undef handling when the value is actualy alive.
Test case will follow.
llvm-svn: 238518
Diffstat (limited to 'llvm/lib/CodeGen/MachineCopyPropagation.cpp')
-rw-r--r-- | llvm/lib/CodeGen/MachineCopyPropagation.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/llvm/lib/CodeGen/MachineCopyPropagation.cpp b/llvm/lib/CodeGen/MachineCopyPropagation.cpp index 43c80b7c21b..602c1fa8d00 100644 --- a/llvm/lib/CodeGen/MachineCopyPropagation.cpp +++ b/llvm/lib/CodeGen/MachineCopyPropagation.cpp @@ -252,11 +252,7 @@ bool MachineCopyPropagation::CopyPropagateBlock(MachineBasicBlock &MBB) { report_fatal_error("MachineCopyPropagation should be run after" " register allocation!"); - // 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()) { + if (MO.isDef()) { Defs.push_back(Reg); continue; } @@ -270,6 +266,14 @@ bool MachineCopyPropagation::CopyPropagateBlock(MachineBasicBlock &MBB) { 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 |