This is an archive of the discontinued LLVM Phabricator instance.

[FunctionAttrs] Replace MemoryAccessKind with FMRB.
ClosedPublic

Authored by fhahn on Mar 11 2022, 6:07 AM.

Details

Summary

Update FunctionAttrs to use FunctionModRefBehavior instead
MemoryAccessKind.

This allows for adding support for inferring argmemonly and others,
see D121415.

Diff Detail

Event Timeline

fhahn created this revision.Mar 11 2022, 6:07 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 11 2022, 6:07 AM
fhahn requested review of this revision.Mar 11 2022, 6:07 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 11 2022, 6:07 AM
nikic added a comment.Mar 11 2022, 6:12 AM

Hm, could we maybe replace MemoryAccessKind with FunctionModRefBehavior? That's basically ArgMemOnly + InaccessibleMemOnly + ModRef, which seems like where we'll want to end up here as well?

fhahn updated this revision to Diff 414671.Mar 11 2022, 8:42 AM

Hm, could we maybe replace MemoryAccessKind with FunctionModRefBehavior? That's basically ArgMemOnly + InaccessibleMemOnly + ModRef, which seems like where we'll want to end up here as well?

Yeah that seems to work and overall less work. I updated this patch to replace MemoryAccessKind with FunctionModRefBehavior.

fhahn retitled this revision from [FunctionAttrs] Turn MemoryAccessKind into class (NFC). to [FunctionAttrs] Replace MemoryAccessKind with FMRB..Mar 11 2022, 8:46 AM
fhahn edited the summary of this revision. (Show Details)

It looks like some changes to support argmemonly made into this patch. If you want to remove those, and land the refactoring, LGTM to that.

nikic added inline comments.Mar 11 2022, 8:56 AM
llvm/include/llvm/Transforms/IPO/FunctionAttrs.h
23

Why?

llvm/lib/Transforms/IPO/FunctionAttrs.cpp
131–132

I think you can just return MRB in this whole branch.

183

This is presumably not supposed to be part of this patch, as it's not used?

fhahn updated this revision to Diff 414679.Mar 11 2022, 9:11 AM
fhahn edited the summary of this revision. (Show Details)

It looks like some changes to support argmemonly made into this patch. If you want to remove those, and land the refactoring, LGTM to that.

Oh yes, I removed those and the stale cstdint include.

fhahn marked 3 inline comments as done.Mar 11 2022, 9:11 AM
fhahn added inline comments.
llvm/include/llvm/Transforms/IPO/FunctionAttrs.h
23

leftover, removed

llvm/lib/Transforms/IPO/FunctionAttrs.cpp
131–132

updated

183

Yes, that made it in by accident. Removed

nikic accepted this revision.Mar 11 2022, 12:34 PM

LGTM

This revision is now accepted and ready to land.Mar 11 2022, 12:34 PM
This revision was landed with ongoing or failed builds.Mar 15 2022, 12:36 PM
This revision was automatically updated to reflect the committed changes.
fhahn marked 3 inline comments as done.