[InstCombine] Improve simplify demanded bits worklist management
authorNikita Popov <nikita.ppv@gmail.com>
Thu, 20 Feb 2020 21:19:10 +0000 (22:19 +0100)
committerNikita Popov <nikita.ppv@gmail.com>
Fri, 21 Feb 2020 17:51:41 +0000 (18:51 +0100)
commitb178555318cdccecc9d3fb4af89b4a765cb0e48c
tree14e00423c8c50cecacb6277c73b34cb7ae65fa42
parent0e3e242209c7f84009c9d88fe52982f8ba21c68b
[InstCombine] Improve simplify demanded bits worklist management

This fixes a small mistake from D72944: The worklist add should
happen before assigning the new operand, not after.

In case an actual replacement happens, the old operand needs to
be added for DCE. If no actual replacement happens, then old/new
are the same, so it doesn't matter.

This drops one iteration from the annotated test case.
llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp
llvm/test/Transforms/InstCombine/2010-11-01-lshr-mask.ll