[DebugInfo][InstrRef] Avoid stack-slot-coloring changing codegen due to DI
authorJeremy Morse <jeremy.morse@sony.com>
Wed, 25 Aug 2021 11:04:59 +0000 (12:04 +0100)
committerJeremy Morse <jeremy.morse@sony.com>
Wed, 25 Aug 2021 11:04:59 +0000 (12:04 +0100)
commitcc1e87bf55e73e769e96e6cc3fcfc69f88d94097
tree254f54b2555d9e3f371a26eb7275fc90a0f39a78
parentc8d9e1ce43a71cd1cf97eb57849d692262215ad4
[DebugInfo][InstrRef] Avoid stack-slot-coloring changing codegen due to DI

Stack slot colouring adds "weight" to slots if a non-dbg-value instruction
refers to it. This, unfortunately, means that DBG_PHI instructions can have
an effect on codegen. The fix is very simple, replace isDebugValue with
isDebugInstr.

The regression test contains a scenario that reproduces this problem; I've
represented both normal-debug mode and instr-ref debug mode instructions
in comment lines prefixed with AAAAAA and BBBBBB, and un-comment them with
sed to test that the two different modes produce the same behaviour.

Differential Revision: https://reviews.llvm.org/D108627
llvm/lib/CodeGen/StackSlotColoring.cpp
llvm/test/DebugInfo/MIR/InstrRef/stack-coloring-dbg-phi.mir [new file with mode: 0644]