]> granicus.if.org Git - llvm/commit
[DebugInfo] Don't salvage load operations (PR40628).
authorJeremy Morse <jeremy.morse.llvm@gmail.com>
Tue, 12 Feb 2019 10:54:30 +0000 (10:54 +0000)
committerJeremy Morse <jeremy.morse.llvm@gmail.com>
Tue, 12 Feb 2019 10:54:30 +0000 (10:54 +0000)
commit814924db549473262fb9a7b93ce431e95583b1ca
tree0b875a80e5c4df73d6619d28c4b474d34e5aceb1
parentbbe8122a3ca229c5b4f5c46d5423dcb638f0f37f
[DebugInfo] Don't salvage load operations (PR40628).

Salvaging a redundant load instruction into a debug expression hides a
memory read from optimisation passes. Passes that alter memory behaviour
(such as LICM promoting memory to a register) aren't aware of these debug
memory reads and leave them unaltered, making the debug variable location
point somewhere unsafe.

Teaching passes to know about these debug memory reads would be challenging
and probably incomplete. Finding dbg.value instructions that need to be fixed
would likely be computationally expensive too, as more analysis would be
required. It's better to not generate debug-memory-reads instead, alas.

Changed tests:
 * DeadStoreElim: test for salvaging of intermediate operations contributing
   to the dead store, instead of salvaging of the redundant load,
 * GVN: remove debuginfo behaviour checks completely, this behaviour is still
   covered by other tests,
 * InstCombine: don't test for salvaged loads, we're removing that behaviour.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@353824 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Utils/Local.cpp
test/DebugInfo/Generic/pr40628.ll [new file with mode: 0644]
test/Transforms/DeadStoreElimination/debuginfo.ll
test/Transforms/GVN/fence.ll
test/Transforms/InstCombine/debuginfo-dce.ll