Page MenuHomePhabricator

[NFC][AA] Prepare to convert AliasResult to class with PartialAlias offset.

Authored by dfukalov on Mar 5 2021, 3:05 AM.



Main reason is preparation to transform AliasResult to class that contains
offset for PartialAlias case.

Diff Detail

Event Timeline

dfukalov created this revision.Mar 5 2021, 3:05 AM
dfukalov requested review of this revision.Mar 5 2021, 3:05 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 5 2021, 3:05 AM
dfukalov added inline comments.

@rampitec, @arsenm, would you please take a look to this 'typography'? I moved out table comments since the table width increased significantly with AliasResult::s

nikic added a comment.Mar 5 2021, 9:13 AM

This looks fine to me, though I'm not clear on how making it an enum class will help with moving to a class. Do you happen to have the patch for that already?


This paragraph should be dropped.


Could also write this as AA->isNoAlias(L, SL) (same in some following occurrences). No strong preference though.

No, I don't have a patch at the moment, but will upload one since you're generally ok with this step.

I thought to convert the enum to a something like

class AliasResult {
  int16_t Offset : 14;
  uint8_t EnumStorage : 2;
  enum {...};

So after that access to the enum values needs AliasResult:: and I decided to split this NFC part away.
And using scoped enum allowed to find all uses.

bmahjour removed a subscriber: bmahjour.Mar 5 2021, 9:58 AM
rampitec added inline comments.Mar 5 2021, 11:06 AM

Does it work with "using AliasResult;"?

dfukalov added inline comments.Mar 6 2021, 7:42 AM

No, using AliasResult::NoAlias; in a block will be available since C++20.

At the moment I can place using AR = AliasResult; and then use AR:: but it will increase current table width of 120 to 138.

rampitec added inline comments.Mar 6 2021, 12:27 PM

Then I can only think about defines before the block and undefs after.

dfukalov updated this revision to Diff 329681.Mar 10 2021, 8:48 AM
dfukalov retitled this revision from [NFC][AA] Convert AliasResult to scoped enumeration. to [NFC][AA] Prepare to convert AliasResult to class with PartialAlias offset..

Made the enum unscoped back since it going to be unscoped within a class planned
to be new AliasResult.

dfukalov updated this revision to Diff 329701.Mar 10 2021, 10:05 AM
dfukalov marked an inline comment as done.

Converted all AliasAnalysis::alias() == AliasResult::NoAlias to

dfukalov added inline comments.Mar 10 2021, 10:08 AM

I declined to make the enum scoped since it's going to be unscoped in a planned AliasResult class.


@rampitec, I moved the table into the function additionally.
Could you please check defines naming?

rampitec added inline comments.Mar 10 2021, 10:10 AM

Thanks, I am OK with this.

This change looks fine. Could you update the follow-up as well as a dependent patch?

asbirlea accepted this revision.Apr 8 2021, 10:33 PM
This revision is now accepted and ready to land.Apr 8 2021, 10:33 PM
This revision was landed with ongoing or failed builds.Apr 9 2021, 2:54 AM
This revision was automatically updated to reflect the committed changes.