This is an archive of the discontinued LLVM Phabricator instance.

[MemoryEffects][NFCI] Make the MemoryEffects class reusable
ClosedPublic

Authored by jdoerfert on Jun 19 2023, 2:11 PM.

Details

Summary

In a follow up we will reuse the logic in MemoryEffectsBase to merge
moryLocation and AAMemoryBehavior without duplicating all the bit
ling code already available in MemoryEffectsBase.

This is part of an effort to match FunctionAttr performance with a lightweight Attributor pass, and this should also speed it up as we need less AAs.

Diff Detail

Event Timeline

jdoerfert created this revision.Jun 19 2023, 2:11 PM
jdoerfert requested review of this revision.Jun 19 2023, 2:11 PM
Herald added a project: Restricted Project. · View Herald Transcript

I can upload this again w/ context. This needs to wait for the AA commit to be cleaned up anyway.

Looks reasonable. A bit unfortunate to lose the ability to forward declare.

llvm/include/llvm/Support/ModRef.h
58

Why the enum wrapped in a class here?

224

This function assumes that there are only three locations. You need to make it getWithoutLoc(Location::InaccessibleMem).getWithoutLoc(Location::ArgMem).doesNotAccessMemory() to gracefully handle extra locations.

jdoerfert added inline comments.Jun 20 2023, 7:11 PM
llvm/include/llvm/Support/ModRef.h
58

Just to keep the sth::Location syntax around. A namespace would work, or I just rename the location into IRLocation and remove the class. No good reason not to do that.

224

good catch

Fix oversight, rename location

Looks fine to me, apart from the question about reinterpret_cast.

llvm/include/llvm/Support/ModRef.h
73–74

Broken indentation?

231

Why does this need a reinterpret_cast?

jdoerfert marked 2 inline comments as done.Jun 24 2023, 3:57 PM

Fixed both comments, can't upload, phab error.

nikic accepted this revision.Jun 25 2023, 9:36 AM

LGTM

This revision is now accepted and ready to land.Jun 25 2023, 9:36 AM
This revision was landed with ongoing or failed builds.Jul 3 2023, 10:07 AM
This revision was automatically updated to reflect the committed changes.
yrouban added a subscriber: yrouban.Jul 5 2023, 8:18 PM
yrouban added inline comments.
llvm/include/llvm/Support/ModRef.h
65

These unscoped enumerators expose very generic identifiers Other, First, Last in the namespace llvm.
So all sources using llvm namespace may get a compilation error if they use these identifiers for their own purposes.

yrouban added inline comments.Jul 5 2023, 8:44 PM
llvm/include/llvm/Support/ModRef.h
65

These unscoped enumerators expose very generic identifiers Other, First, Last in the namespace llvm.
So all sources using llvm namespace may get a compilation error if they use these identifiers for their own purposes.

65

I suggest that we use a scoped enumerators:

enum class IRMemLocation { ... }