This is an archive of the discontinued LLVM Phabricator instance.

[LICM] Generalize unwinding check during scalar promotion
ClosedPublic

Authored by nikic on Jan 11 2022, 2:23 AM.

Details

Summary

This generalizes the unwinding check during scalar promotion with the new semantics from D116998. I've extracted a common isNotVisibleOnUnwind() helper into AliasAnalysis, which handles allocas, byval arguments, sret arguments and noalias calls, as we have a few more places that need basically the same logic (DSE and MemCpyOpt at least). The noalias call case is a bit different from the others, because it also requires that the object is not captured.

Diff Detail

Event Timeline

nikic created this revision.Jan 11 2022, 2:23 AM
nikic requested review of this revision.Jan 11 2022, 2:23 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 11 2022, 2:23 AM
reames accepted this revision.Jan 11 2022, 8:48 AM

LGTM now if you remove the sret check (i.e invert the stack). LGTM once the sret patch lands otherwise.

llvm/lib/Transforms/Scalar/LICM.cpp
1937

I find compound conditions more confusing that an extra if check. I'd turn this into a series of early return if-clauses personally.

This revision is now accepted and ready to land.Jan 11 2022, 8:48 AM
This revision was landed with ongoing or failed builds.Jan 26 2022, 2:15 AM
This revision was automatically updated to reflect the committed changes.
nikic added a comment.Jan 26 2022, 5:37 AM

LGTM now if you remove the sret check (i.e invert the stack). LGTM once the sret patch lands otherwise.

Ended up landing this without the sret check, which is split off into D118242.