[InstCombine] Fix worklist management in DSE (PR44552)
authorNikita Popov <nikita.ppv@gmail.com>
Wed, 15 Jan 2020 21:24:15 +0000 (22:24 +0100)
committerNikita Popov <nikita.ppv@gmail.com>
Fri, 17 Jan 2020 17:10:56 +0000 (18:10 +0100)
commit522c030aa9b1dd1881feb5a0d0fa2639b4a5feb7
tree41827a27b03b199b2d02f4ea6076c86d206138c9
parent78f82e162ec0d916b5d45943d2b28376b0224dee
[InstCombine] Fix worklist management in DSE (PR44552)

Fixes https://bugs.llvm.org/show_bug.cgi?id=44552. We need to make
sure that the store is reprocessed, because performing DSE may
expose more DSE opportunities.

There is a slight caveat here though: We need to make sure that we
add back the store the worklist first, because that means it will
be processed after the operands of the removed store have been
processed. This is a general bug in InstCombine worklist management
that I hope to address at some point, but for now it means we need
to do this manually rather than just returning the instruction as
changed.

Differential Revision: https://reviews.llvm.org/D72807
llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
llvm/test/Transforms/InstCombine/pr44552.ll [new file with mode: 0644]