This is an archive of the discontinued LLVM Phabricator instance.

[Attributor] Reorganize AAHeapToStack
ClosedPublic

Authored by jdoerfert on Jun 27 2021, 9:40 AM.

Details

Summary

In order to simplify future extensions, e.g., the merge of
AAHeapToShared in to AAHeapToStack, we reorganize AAHeapToStack and the
state we keep for each malloc-like call. The result is also less
confusing as we only track malloc-like calls, not all calls. Further, we
only perform the updates necessary for a malloc-like to argue it can go
to the stack, e.g., we won't check all uses if we moved on to the
"must-be-freed" argument.

This patch also uses Attributor helps to simplify the allocated size,
alignment, and the potentially freed objects.

Overall, this is mostly a reorganization and only the use of the
optimistic helpers should change (=improve) the capabilities a bit.

Diff Detail

Event Timeline

jdoerfert created this revision.Jun 27 2021, 9:40 AM
jdoerfert requested review of this revision.Jun 27 2021, 9:40 AM
Herald added a reviewer: baziotis. · View Herald Transcript
Herald added a project: Restricted Project. · View Herald Transcript
Herald added subscribers: bbn, sstefan1. · View Herald Transcript
jdoerfert updated this revision to Diff 354767.Jun 27 2021, 1:34 PM

Rebase, precommit test

jhuber6 accepted this revision.Jun 28 2021, 11:20 AM

LG with a few nits.

llvm/lib/Transforms/IPO/AttributorAttributes.cpp
4852

I feel like this should be given a name inside an enum class.

4902

Couldn't this be a unique_ptr?

5331
This revision is now accepted and ready to land.Jun 28 2021, 11:20 AM
jdoerfert marked an inline comment as done.Jun 28 2021, 12:02 PM
jdoerfert added inline comments.
llvm/lib/Transforms/IPO/AttributorAttributes.cpp
4902

The Attributor has a bump allocator that lives as long as the Attributor. This way allocations are pretty much free and the lifetime matches the AA lifetime nicely.

I like this reorganisation. LGTM!

llvm/lib/Transforms/IPO/AttributorAttributes.cpp
4897

I feel like this could have a better name

sstefan1 accepted this revision.Jul 1 2021, 1:12 PM
This revision was landed with ongoing or failed builds.Jul 10 2021, 10:33 AM
This revision was automatically updated to reflect the committed changes.
jdoerfert marked 4 inline comments as done.