Page MenuHomePhabricator

[Attributor] Liveness for values
ClosedPublic

Authored by jdoerfert on Sun, Oct 13, 1:13 AM.

Details

Summary

This patch introduces liveness (AAIsDead) for all positions, thus for
all kinds of values. For now, we say an instruction is dead if it would
be removed assuming all users are dead. A call site return is different
as we just look at the users. If all call site returns have been
eliminated, the return values can return undef instead of their original
value, eliminating uses.

We try to recursively delete dead instructions now and we introduce a
simple check-like interface for use-traversal.

More explicit tests will be added.

This is the idea tried out in D68626 but implemented in the right way.

Diff Detail

Event Timeline

jdoerfert created this revision.Sun, Oct 13, 1:13 AM
Herald added a project: Restricted Project. · View Herald TranscriptSun, Oct 13, 1:13 AM
jdoerfert updated this revision to Diff 224772.Sun, Oct 13, 1:24 AM

Non-exact functions fix + more tests

Minor updates and fixes

Some comments

llvm/lib/Transforms/IPO/Attributor.cpp
2110

nit: isAssumedDead()

3562

Should this still be here, considering changes from D68934?

4466

Can we have a value parameter here that maybe defaults to nullptr. In the default case we take AssociatedValue and in others the value parameter? Maybe this is not the best solution, but for example, h2s doesn't work with AssociatedValue.

jdoerfert marked 2 inline comments as done.Mon, Oct 14, 12:06 PM
jdoerfert added inline comments.
llvm/lib/Transforms/IPO/Attributor.cpp
3562

I think D68934 replaces all this, I will undo this change here.

4466

Sure, we don't even need a default. Though we can also do this after the patch. I'll change the interface now here though.

sstefan1 accepted this revision.Mon, Oct 14, 1:21 PM

LGTM then!

This revision is now accepted and ready to land.Mon, Oct 14, 1:21 PM
This revision was automatically updated to reflect the committed changes.