Improve the effectiveness of ADCE's debug info salvaging
authorAdrian Prantl <aprantl@apple.com>
Sat, 25 Sep 2021 00:16:59 +0000 (17:16 -0700)
committerAdrian Prantl <aprantl@apple.com>
Tue, 28 Sep 2021 17:24:50 +0000 (10:24 -0700)
commit9637b045e6eee71cd34f0f2f80a2ae1ad2a71129
tree79bef2b7c338131d39f51f66aef933c6b9fbc7a4
parent1b998a5f0cd9a4f278dd2d114845379a0fafa0a5
Improve the effectiveness of ADCE's debug info salvaging

This patch improves the effectiveness of ADCE's debug info salvaging
by processing the instructions in reverse order and delaying
dropAllReferences until after debug info salvaging. This allows
salvaging of entire chains of deleted instructions!

Previously we would remove all references from an instruction, which
would make it impossible to use that instruction to salvage a later
instruction in the instruction stream, because its operands were
already removed.

Differential Revision: https://reviews.llvm.org/D110462
llvm/lib/Transforms/Scalar/ADCE.cpp
llvm/test/Transforms/Util/salvage-debuginfo.ll