[ADCE] Preserve MemorySSA if only debug instructions are removed
authorMikael Holmen <mikael.holmen@ericsson.com>
Fri, 3 Mar 2023 13:20:26 +0000 (14:20 +0100)
committerMikael Holmen <mikael.holmen@ericsson.com>
Wed, 8 Mar 2023 06:32:33 +0000 (07:32 +0100)
commitdb7d8678bcdc440ffd0529f0d970cf10cbcbe984
treef21e24b2672ccafda19c3b127dc5a8f08ccdd5b5
parente09b3be411b0cfbf560edd4e089b2810c1ba2685
[ADCE] Preserve MemorySSA if only debug instructions are removed

As we've seen in
 https://github.com/llvm/llvm-project/issues/58285
throwing away MemorySSA when only debug instructions are removed can lead
to different code when debug info is present or not present.

This is the second attempt at fixing the problem. The first one was
 https://reviews.llvm.org/D145051
which was reverted due to a 15% compile time regression for tramp3d-v4
in NewPM-ReleaseLTO-g.
llvm/lib/Transforms/Scalar/ADCE.cpp
llvm/test/Transforms/ADCE/preserve-memoryssa-if-only-remove-debug.ll [new file with mode: 0644]