OSDN Git Service

[MachineCopyPropagation] Handle COPY with overlapping source/dest.
authorEli Friedman <efriedma@codeaurora.org>
Fri, 30 Mar 2018 00:56:03 +0000 (00:56 +0000)
committerEli Friedman <efriedma@codeaurora.org>
Fri, 30 Mar 2018 00:56:03 +0000 (00:56 +0000)
commit033a78e4eb421dd8518061ae18a01139f1285573
tree026d22c058a35d691afd43cdeef6f8b5215aaede
parentae117790607b67363804cb4714fc0050391fed1e
[MachineCopyPropagation] Handle COPY with overlapping source/dest.

MachineCopyPropagation::CopyPropagateBlock has a bunch of special
handling for COPY instructions. This handling assumes that COPY
instructions do not modify the source of the copy; this is wrong if
the COPY destination overlaps the source.

To fix the bug, check explicitly for this situation, and fall back to
the generic instruction handling.

This bug can't happen for most register classes because they don't
have this sort of overlap, but there are a few register classes
where this is possible. The testcase uses the AArch64 QQQQ register
class.

Differential Revision: https://reviews.llvm.org/D44911

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@328851 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/MachineCopyPropagation.cpp
test/CodeGen/AArch64/machine-dead-copy.mir