This is an archive of the discontinued LLVM Phabricator instance.

[Attributor] Enable heap-to-stack of any size
ClosedPublic

Authored by wsmoses on Mar 3 2021, 10:06 AM.

Details

Summary

Enable Attributor's heap-to-stack to lower unbounded allocations given a max size of -1

Diff Detail

Event Timeline

wsmoses created this revision.Mar 3 2021, 10:06 AM
wsmoses requested review of this revision.Mar 3 2021, 10:07 AM
Herald added a reviewer: baziotis. · View Herald Transcript
Herald added a project: Restricted Project. · View Herald Transcript
jdoerfert accepted this revision.Mar 3 2021, 1:19 PM

LG, two nits.

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

Can you put these 4 lines in a helper lambda, we now replicate it a lot.

llvm/test/Transforms/Attributor/lowerheap.ll
35

can you move this in the heap2stack test case

This revision is now accepted and ready to land.Mar 3 2021, 1:19 PM
This revision was landed with ongoing or failed builds.Mar 4 2021, 2:19 PM
This revision was automatically updated to reflect the committed changes.
wsmoses reopened this revision.Mar 4 2021, 3:19 PM
This revision is now accepted and ready to land.Mar 4 2021, 3:19 PM
wsmoses updated this revision to Diff 328322.Mar 4 2021, 3:20 PM

Fix constant cast bug and test calloc

jdoerfert accepted this revision.Mar 5 2021, 9:52 AM

LG, one nit comment below, address as makes sense.

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

If MaxHeapToStackSize is not -1, we can mark it nuw at least because we checked for overflow.
Should we just call the constructor, going through a builder seems kinda weird, except if we add a constant folder. Also, add a name, "h2s.calloc.size" or something.

This revision was automatically updated to reflect the committed changes.