[Reduce] Rewrite function body delta pass again
authorRoman Lebedev <lebedev.ri@gmail.com>
Sat, 8 Aug 2020 20:21:08 +0000 (23:21 +0300)
committerRoman Lebedev <lebedev.ri@gmail.com>
Sat, 8 Aug 2020 20:48:44 +0000 (23:48 +0300)
commitd4c3f20285aded64e31a4faf6a5a9280352ff6af
treecfca68fe14a65fad0658342772702de92c1df5bb
parent48887c4e81d47ebeaa6dc7888143cc51bd0ed7c5
[Reduce] Rewrite function body delta pass again

It is not enough to replace all uses of users of the function with undef,
the users, we only drop instruction users, so they may stick around.

Let's try different approach - first drop bodies for all the functions
we will drop, which should take care of blockaddress issue the previous
rewrite was dealing with; then, after dropping *all* such bodies,
replace remaining uses with undef (thus all the uses are either
outside of functions, or are in kept functions)
and then finally drop functions.

This seems to work, and passes the *existing* test coverage,
but it is possible that a new issue will be discovered later :)

A new (previously crashing) test added.
llvm/test/Reduce/remove-function-bodies-used-in-globals.ll [new file with mode: 0644]
llvm/tools/llvm-reduce/deltas/ReduceFunctions.cpp