llvm-project/llvm/lib
Bjorn Pettersson 9a8483a4b2 [BranchFolding] Salvage DBG_VALUE instructions from empty blocks
Summary:
This patch will introduce copying of DBG_VALUE instructions
from an otherwise empty basic block to predecessor/successor
blocks in case the empty block is eliminated/bypassed. It
is currently only done in one identified situation in the
BranchFolding pass, before optimizing on empty block.
It can be seen as a light variant of the propagation done
by the LiveDebugValues pass, which unfortunately is executed
after the BranchFolding pass.

We only propagate (copy) DBG_VALUE instructions in a limited
number of situations:
 a) If the empty BB is the only predecessor of a successor
    we can copy the DBG_VALUE instruction to the beginning of
    the successor (because the DBG_VALUE instruction is always
    part of the flow between the blocks).
 b) If the empty BB is the only successor of a predecessor
    we can copy the DBG_VALUE instruction to the end of the
    predecessor (because the DBG_VALUE instruction is always
    part of the flow between the blocks). In this case we add
    the DBG_VALUE just before the first terminator (assuming
    that the terminators do not impact the DBG_VALUE).

A future solution, to handle more situations, could perhaps
be to run the LiveDebugValues pass before branch folding?

This fix is related to PR37234. It is expected to resolve
the problem seen, when applied together with the fix in
SelectionDAG from here: https://reviews.llvm.org/D46129

Reviewers: #debug-info, aprantl, rnk

Reviewed By: #debug-info, aprantl

Subscribers: ormris, gbedwell, llvm-commits

Differential Revision: https://reviews.llvm.org/D46184

llvm-svn: 331183
2018-04-30 14:37:46 +00:00
..
Analysis [SCEV] Touch the unsused stats variables for product build. 2018-04-28 06:41:35 +00:00
AsmParser Add the ShadowCallStack attribute 2018-04-03 20:10:40 +00:00
BinaryFormat Fix build broken by r328090 2018-03-21 12:18:03 +00:00
Bitcode [IR] Upgrade comment token in objc retain release marker for asm call 2018-04-17 04:02:24 +00:00
CodeGen [BranchFolding] Salvage DBG_VALUE instructions from empty blocks 2018-04-30 14:37:46 +00:00
DebugInfo [LLD/PDB] Emit first section contribution for DBI Module Descriptor. 2018-04-20 18:00:46 +00:00
Demangle [demangler] Add a partial demangling API for LLDB. 2018-04-12 20:41:38 +00:00
ExecutionEngine [ORC] Fix an assertion condition from r329934. 2018-04-19 19:30:35 +00:00
FuzzMutate [llvm-opt-fuzzer] Add irce to the fuzzing options 2018-03-20 11:32:13 +00:00
Fuzzer [libFuzzer] Delete llvm/lib/Fuzzer 2017-10-16 20:48:19 +00:00
IR [LLVM-C] Add DIBuilder bindings to create import declarations 2018-04-28 22:32:07 +00:00
IRReader LLParser: add an argument for overriding data layout and do not check alloca addr space 2018-01-30 22:32:39 +00:00
LTO [LTO] Add stats-file option to LTO/Config.h. 2018-04-20 10:18:36 +00:00
LineEditor
Linker [ThinLTO] Recommit of import global variables 2018-03-12 10:30:50 +00:00
MC ELFObjectWriter: Allow one unique symver per symbol 2018-04-27 20:32:34 +00:00
Object s/LLVM_ON_WIN32/_WIN32/, llvm 2018-04-29 00:45:03 +00:00
ObjectYAML [WebAssembly] Write DWARF data into wasm object file 2018-04-26 19:27:28 +00:00
Option [NFC] Replace iterators in PrintHelp with range-based for 2018-03-12 18:31:07 +00:00
Passes NFC, Avoid a warning on pointer casting in PassPlugin.cpp 2018-04-30 14:21:28 +00:00
ProfileData [ProfileData] Change std::sort to llvm::sort in response to r327219 2018-04-13 19:46:36 +00:00
Support Remove a dead #ifdef. 2018-04-30 00:08:06 +00:00
TableGen Let TableGen write output only if it changed, instead of doing so in cmake. 2018-04-24 17:29:05 +00:00
Target Revert "[mips] Fix the predicates of jump and branch and link instructions" 2018-04-30 14:03:35 +00:00
Testing [LLVMTestingSupport] Add explicit linkage to LLVMSupport 2018-04-08 06:49:17 +00:00
ToolDrivers [COFF] Keep the underscore on exported decorated stdcall functions in MSVC mode 2018-01-20 11:44:32 +00:00
Transforms [LV] Use BB::instructionsWithoutDebug to skip DbgInfo (NFC). 2018-04-30 13:28:08 +00:00
WindowsManifest Convert line endings of lib/WindowsManifest/CMakeLists.txt to unix. 2018-04-07 04:28:08 +00:00
XRay [XRay] clarify error messages when parsing broken traces 2018-01-30 13:41:34 +00:00
CMakeLists.txt
LLVMBuild.txt