The bug ticket backward copy propagation failed w/ -g
1856B renamable $rbp = nuw LEA64r %stack.5.agg.tmp.i, 1, $noreg, 8, $noreg DBG_VALUE $rbp, $noreg, !"this", !DIExpression(), debug-location !293; hot.cpp:0 @[ hot.cpp:84:39 @[ hot.cpp:108:11 ] ] line no:0 1864B renamable $rbx = COPY killed renamable $rbp
Current backward copy propagation does clobber $rbp early when it sees DBG_VALUE which makes it failed to propagate. DebugInfo shouldn't affect opt.
After machine-cp pass
renamable $rbx = nuw LEA64r %stack.5.agg.tmp.i, 1, $noreg, 8, $noreg DBG_VALUE $rbp, $noreg, !"this", !DIExpression(), debug-location !293; hot.cpp:0 @[ hot.cpp:84:39 @[ hot.cpp:108:11 ] ] line no:0
The DBG_VALUE instruction still remains here.
clang++ hot.cc -o dbg.o -O3 -g llvm-dwarfdump dbg.o
shows that the %rbp formal parameter debug entry is erased.
Is it worth using MachineInstr::isMetaInstruction instead of MachineInstr::isDebugValue to catch other MIR instructions which don't produce executable code too?