This is an archive of the discontinued LLVM Phabricator instance.

[Opt] Smart pointer lifetime optimizations pass.
AbandonedPublic

Authored by zoecarver on Jun 5 2020, 11:35 AM.

Details

Reviewers
jfb
ldionne
EricWF
Group Reviewers
Restricted Project
Summary

This pass does one thing: constant fold away the destructor of unique_ptr based on ownership information we get form move semantics.

However, it is also (hopefully) the scaffolding for many more lifetime optimizations both around unique_ptr and other smart pointers.

Diff Detail

Event Timeline

zoecarver created this revision.Jun 5 2020, 11:35 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptJun 5 2020, 11:35 AM
Herald added a reviewer: Restricted Project. · View Herald Transcript
zoecarver marked an inline comment as done.Jun 5 2020, 11:39 AM
zoecarver added inline comments.
libcxx/include/memory
2412

Obviously these won't be part of the final patch. This is just an easy way to figure out which methods are important (both for me and the pass).

In Swift, there's a @_semantics decorator that can be applied to functions so the compiler can apply specific optimizations. Is there anything like that in clang? If not, would something like that be welcome and/or possible? If so, I'm happy to implement it.

zoecarver abandoned this revision.Jun 8 2020, 7:34 PM

Closing this based on the discussion on the mailing list.