[MachineCopyPropagation] Fix differences in code gen when compiling with -g
authorAlexandru Octavian Butiu <alexandru.octavian.butiu@gmail.com>
Fri, 2 Jul 2021 10:50:07 +0000 (18:50 +0800)
committerKai Luo <lkail@cn.ibm.com>
Fri, 2 Jul 2021 11:27:06 +0000 (19:27 +0800)
commite90c6f559637446330335ce6638ae3e3827992e8
treee46fb7e756fb43cbf0ffcf0da93e756ecc2d7034
parentc142c06c19b3725f26f33652db098a2302586f22
[MachineCopyPropagation] Fix differences in code gen when compiling with -g

Fixes bugs [[ https://bugs.llvm.org/show_bug.cgi?id=50580 | 50580 ]] and [[ https://bugs.llvm.org/show_bug.cgi?id=49446 | 49446  ]]

When compiling with -g "DBG_VALUE <reg>"  instructions are added in the MIR, if such a instruction is inserted between instructions that use <reg> then MachineCopyPropagation invalidates <reg> , this causes some copies  to not be propagated and causes differences in code generation (ex bugs 50580 and 49446 ).  DBG_VALUE instructions should be ignored  since they don't actually modify the register.

Reviewed By: lkail

Differential Revision: https://reviews.llvm.org/D104394
llvm/lib/CodeGen/MachineCopyPropagation.cpp
llvm/test/CodeGen/X86/machine-copy-dbgvalue.mir [new file with mode: 0644]