[DAE] MarkLive in MarkValue(MaybeLive) if any use is live
authorArthur Eubanks <aeubanks@google.com>
Wed, 30 Sep 2020 05:29:26 +0000 (22:29 -0700)
committerArthur Eubanks <aeubanks@google.com>
Fri, 2 Oct 2020 17:55:08 +0000 (10:55 -0700)
commit7468afe9ca135228f4c5a48f1b061ca57786fad6
tree64cc698bc7d8ab7b732a0794432ed8c994edf702
parenta8938f3da319f4cc17b80ebab582a6c77efa6705
[DAE] MarkLive in MarkValue(MaybeLive) if any use is live

While looping through all args or all return values, we may mark a use
of a later iteration as live. Previously when we got to that later value
it would ignore that and continue adding to Uses instead of marking it
live. For example, when looping through arg#0 and arg#1,
MarkValue(arg#0, Live) may cause some use of arg#1 to be live, but
MarkValue(arg#1, MaybeLive) will not notice that and continue adding
into Uses.

Now MarkValue(RA, MaybeLive) will MarkLive(RA) if any use is live.

Fixes PR47444.

Reviewed By: rnk

Differential Revision: https://reviews.llvm.org/D88529
llvm/include/llvm/Transforms/IPO/DeadArgumentElimination.h
llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp
llvm/test/Transforms/DeadArgElim/preserve-used-ret.ll [new file with mode: 0644]