This is an archive of the discontinued LLVM Phabricator instance.

[Attributor] Liveness for values
ClosedPublic

Authored by jdoerfert on Oct 13 2019, 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.

Event Timeline

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

Non-exact functions fix + more tests

Minor updates and fixes

Some comments

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

nit: isAssumedDead()

3641

Should this still be here, considering changes from D68934?

4519

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.Oct 14 2019, 12:06 PM
jdoerfert added inline comments.
llvm/lib/Transforms/IPO/Attributor.cpp
3641

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

4519

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.Oct 14 2019, 1:21 PM

LGTM then!

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