summaryrefslogtreecommitdiff
path: root/lib/CodeGen/VirtRegRewriter.cpp
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2010-05-11 00:20:03 +0000
committerEvan Cheng <evan.cheng@apple.com>2010-05-11 00:20:03 +0000
commit31b9c44cc13bb686010cf6bfbeef8745c39939b9 (patch)
treee324cbea83348dae5ffa8c6f1915855ec7ec14d1 /lib/CodeGen/VirtRegRewriter.cpp
parent0bcccac50481921ab86dfdbaadec79f1db35c662 (diff)
downloadllvm-31b9c44cc13bb686010cf6bfbeef8745c39939b9.tar.gz
llvm-31b9c44cc13bb686010cf6bfbeef8745c39939b9.tar.bz2
llvm-31b9c44cc13bb686010cf6bfbeef8745c39939b9.tar.xz
It's not safe eliminate copies where src and dst have different sub-register indices.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103450 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/VirtRegRewriter.cpp')
-rw-r--r--lib/CodeGen/VirtRegRewriter.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/CodeGen/VirtRegRewriter.cpp b/lib/CodeGen/VirtRegRewriter.cpp
index 9b46273455..9c3248067a 100644
--- a/lib/CodeGen/VirtRegRewriter.cpp
+++ b/lib/CodeGen/VirtRegRewriter.cpp
@@ -2425,7 +2425,8 @@ LocalRewriter::RewriteMBB(LiveIntervals *LIs,
// eliminate this or else the undef marker is lost and it will
// confuses the scavenger. This is extremely rare.
unsigned Src, Dst, SrcSR, DstSR;
- if (TII->isMoveInstr(MI, Src, Dst, SrcSR, DstSR) && Src == Dst &&
+ if (TII->isMoveInstr(MI, Src, Dst, SrcSR, DstSR) &&
+ Src == Dst && SrcSR == DstSR &&
!MI.findRegisterUseOperand(Src)->isUndef()) {
++NumDCE;
DEBUG(dbgs() << "Removing now-noop copy: " << MI);
@@ -2514,7 +2515,8 @@ LocalRewriter::RewriteMBB(LiveIntervals *LIs,
// instruction before considering the dest reg to be changed.
{
unsigned Src, Dst, SrcSR, DstSR;
- if (TII->isMoveInstr(MI, Src, Dst, SrcSR, DstSR) && Src == Dst) {
+ if (TII->isMoveInstr(MI, Src, Dst, SrcSR, DstSR) &&
+ Src == Dst && SrcSR == DstSR) {
++NumDCE;
DEBUG(dbgs() << "Removing now-noop copy: " << MI);
InvalidateKills(MI, TRI, RegKills, KillOps);