This is an archive of the discontinued LLVM Phabricator instance.

[NFC] [AAPointerInfo] OffsetAndSize is no longer an std::pair
ClosedPublic

Authored by sameerds on Oct 26 2022, 1:18 AM.

Details

Summary

The struct OffsetAndSize is a simple tuple of two int64_t. Treating it as a
derived class of std::pair has no special benefit, but it makes the code
verbose since we need get/set functions that avoid using "first" and "second" in
client code. Eliminating the std::pair makes this more readable.

Diff Detail

Event Timeline

sameerds created this revision.Oct 26 2022, 1:18 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 26 2022, 1:18 AM
sameerds requested review of this revision.Oct 26 2022, 1:18 AM
Herald added a reviewer: sstefan1. · View Herald Transcript
Herald added a project: Restricted Project. · View Herald Transcript

It's a nice cleanup. I have one concern below.

llvm/include/llvm/Transforms/IPO/Attributor.h
266
llvm/lib/Transforms/IPO/AttributorAttributes.cpp
732

Do we need to ensure empty and tombstone key do not clash with unknown/unassigned?

sameerds updated this revision to Diff 470849.Oct 26 2022, 10:02 AM

Addressed comments about special constants and operator!=

sameerds added inline comments.Oct 26 2022, 10:08 AM
llvm/lib/Transforms/IPO/AttributorAttributes.cpp
732

That kinda goes without saying whenever a DenseMap is used. But I've now added comments to the place where Unknown and Unsigned are declared.

sameerds added inline comments.Oct 26 2022, 10:15 AM
llvm/include/llvm/Transforms/IPO/Attributor.h
256

Note: I mixed up MAX and MIN here, but I've fixed it in my local change that is ready to commit.

jdoerfert accepted this revision.Oct 26 2022, 10:46 AM

LG

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

In case these are all compile time constants we could even use a static_assert.

This revision is now accepted and ready to land.Oct 26 2022, 10:46 AM