summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/MachineCopyPropagation.cpp
diff options
context:
space:
mode:
authorAlexander Timofeev <Alexander.Timofeev@amd.com>2017-10-16 14:35:29 +0000
committerAlexander Timofeev <Alexander.Timofeev@amd.com>2017-10-16 14:35:29 +0000
commit3828242c7e6527aaacff32f0c42b0e0fd37a20a6 (patch)
tree5c272ccc509575bb0c7334ce6d7f7571e55e622d /llvm/lib/CodeGen/MachineCopyPropagation.cpp
parent259b190f0dfe1f076c5fdf080c9beb55a37945c7 (diff)
downloadbcm5719-llvm-3828242c7e6527aaacff32f0c42b0e0fd37a20a6.tar.gz
bcm5719-llvm-3828242c7e6527aaacff32f0c42b0e0fd37a20a6.zip
[AMDGPU] Prevent Machine Copy Propagation from replacing live copy with the dead one
Differential revision: https://reviews.llvm.org/D38754 llvm-svn: 315908
Diffstat (limited to 'llvm/lib/CodeGen/MachineCopyPropagation.cpp')
-rw-r--r--llvm/lib/CodeGen/MachineCopyPropagation.cpp24
1 files changed, 13 insertions, 11 deletions
diff --git a/llvm/lib/CodeGen/MachineCopyPropagation.cpp b/llvm/lib/CodeGen/MachineCopyPropagation.cpp
index 4655b5ba704..030db4366e9 100644
--- a/llvm/lib/CodeGen/MachineCopyPropagation.cpp
+++ b/llvm/lib/CodeGen/MachineCopyPropagation.cpp
@@ -275,18 +275,20 @@ void MachineCopyPropagation::CopyPropagateBlock(MachineBasicBlock &MBB) {
ClobberRegister(Reg);
}
- // Remember Def is defined by the copy.
- for (MCSubRegIterator SR(Def, TRI, /*IncludeSelf=*/true); SR.isValid();
- ++SR) {
- CopyMap[*SR] = MI;
- AvailCopyMap[*SR] = MI;
- }
+ if (!MI->getOperand(0).isDead() && !MI->getOperand(1).isUndef()) {
+ // Remember Def is defined by the copy.
+ for (MCSubRegIterator SR(Def, TRI, /*IncludeSelf=*/true); SR.isValid();
+ ++SR) {
+ CopyMap[*SR] = MI;
+ AvailCopyMap[*SR] = MI;
+ }
- // Remember source that's copied to Def. Once it's clobbered, then
- // it's no longer available for copy propagation.
- RegList &DestList = SrcMap[Src];
- if (!is_contained(DestList, Def))
- DestList.push_back(Def);
+ // Remember source that's copied to Def. Once it's clobbered, then
+ // it's no longer available for copy propagation.
+ RegList &DestList = SrcMap[Src];
+ if (!is_contained(DestList, Def))
+ DestList.push_back(Def);
+ }
continue;
}
OpenPOWER on IntegriCloud