[PATCH] D17475: MachineCopyPropagation: Catch copies of the form A<-B; A<-B

Matthias Braun via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 24 15:46:11 PST 2016

MatzeB marked an inline comment as done.

Comment at: lib/CodeGen/MachineCopyPropagation.cpp:212
@@ -193,3 +211,3 @@
       // Copy is now a candidate for deletion.
       if (!MRI->isReserved(Def))
junbuml wrote:
> Shouldn't we need to add  !MRI->isReserved(Src) as well ?
This is fine. Elminating a redundant copy of a reserved register is bad because you either write to a reserved register which may have effects you don't know about so you just cannot erase the write, or the redundant copy reads from a reserved register in which case we cannot be sure that is still has the previous value.

In the case of a dead copy reading form a reserved register we do not care though: We don't know the value that is read but nobody reads the value produced by the dead copy anyway.



More information about the llvm-commits mailing list