[MergeFunc] removeUsers: call remove() only on direct users
authorFangrui Song <maskray@google.com>
Fri, 19 Apr 2019 07:57:51 +0000 (07:57 +0000)
committerFangrui Song <maskray@google.com>
Fri, 19 Apr 2019 07:57:51 +0000 (07:57 +0000)
commit884f557bb216030769d40c00f55977e262b761a4
treeb4ef2be41db8ab5bd8bbd9ecf16d6f970b044a96
parent72e2960e525a30bd8a105bd474b5c38267de02fc
[MergeFunc] removeUsers: call remove() only on direct users

removeUsers uses a work list to collect indirect users and call remove()
on those functions. However it has a bug (`if (!Visited.insert(UU).second)`).

Actually, we don't have to collect indirect users.
After the merge of F and G, G's callers will be considered (added to
Deferred). If G's callers can be merged, G's callers' callers will be
considered.

Update the test unnamed-addr-reprocessing.ll to make it clear we can
still merge indirect callers.

llvm-svn: 358741
llvm/lib/Transforms/IPO/MergeFunctions.cpp
llvm/test/Transforms/MergeFunc/unnamed-addr-reprocessing.ll