[DebugInfo][InstrRef] Avoid a crash from mixed variable location modes
commitfb6596f1ecab652b5b90cf2e395d64112504c1f8
authorJeremy Morse <jeremy.morse@sony.com>
Wed, 6 Apr 2022 10:50:51 +0000 (6 11:50 +0100)
committerJeremy Morse <jeremy.morse@sony.com>
Wed, 6 Apr 2022 10:55:38 +0000 (6 11:55 +0100)
treeb2e178b03419634acb3782d7aff857a15039cac3
parent77c74fd877b27418171693f187b8db865567b8dc
[DebugInfo][InstrRef] Avoid a crash from mixed variable location modes

Variable locations now come in two modes, instruction referencing and
DBG_VALUE. At -O0 we pick DBG_VALUE to allow fast construction of variable
information. Unfortunately, SelectionDAG edits the optimisation level in
the presence of opt-bisect-limit, meaning different passes have different
views of what variable location mode we should use. That causes assertions
when they're mixed.

This patch plumbs through a boolean in SelectionDAG from start to
instruction emission, so that we don't rely on the current optimisation
level for correctness.

Differential Revision: https://reviews.llvm.org/D123033
llvm/include/llvm/CodeGen/FastISel.h
llvm/include/llvm/CodeGen/SelectionDAG.h
llvm/include/llvm/CodeGen/SelectionDAGISel.h
llvm/lib/CodeGen/MachineFunction.cpp
llvm/lib/CodeGen/SelectionDAG/FastISel.cpp
llvm/lib/CodeGen/SelectionDAG/InstrEmitter.cpp
llvm/lib/CodeGen/SelectionDAG/InstrEmitter.h
llvm/lib/CodeGen/SelectionDAG/ScheduleDAGFast.cpp
llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp
llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
llvm/test/DebugInfo/X86/instr-ref-opt-bisect.ll [new file with mode: 0644]