This is an archive of the discontinued LLVM Phabricator instance.

[PM] Edit comments on PM Proxy and utility classes.
ClosedPublic

Authored by jlebar on Dec 6 2016, 8:27 PM.

Diff Detail

Repository
rL LLVM

Event Timeline

jlebar updated this revision to Diff 80536.Dec 6 2016, 8:27 PM
jlebar retitled this revision from to [PM] Edit comments on PM Proxy and utility classes..
jlebar updated this object.
jlebar added a reviewer: chandlerc.
jlebar added a subscriber: llvm-commits.
jlebar added a comment.Dec 6 2016, 8:28 PM

@chandlerc, Per our conversation on IRC: I'm sending this now just for informational purposes. I will rebase after you submit your outstanding patches.

jlebar updated this revision to Diff 80537.Dec 6 2016, 8:28 PM

Remove leftover comment.

jlebar updated this revision to Diff 83162.Jan 4 2017, 4:23 PM

Rebase.

chandlerc added inline comments.Jan 4 2017, 6:43 PM
llvm/include/llvm/IR/PassManager.h
882–883 ↗(On Diff #83162)

FWIW, I continue to prefer "outer" and "inner". There is an inherent requirement that the smaller IR units in question be *contained* by the larger units. I'd like words that help indicate that relationship which is a stronger statement than their size IMO.

885–895 ↗(On Diff #83162)

All of this is fantastic though. =]

903 ↗(On Diff #83162)

Why the less precise member name?

There are places where 'AM' is used and is *not* the same as the member, so it seems less ambiguous to give it some more specific name.

904 ↗(On Diff #83162)

I dislike using RHS for something that is not a binary operator. A lot of this delta isn't comment-only edits...

994–995 ↗(On Diff #83162)

s/update/invalidate/

1132 ↗(On Diff #83162)

on Function units -> on Functions

1239 ↗(On Diff #83162)

This isn't common for full-file-scoped namespaces in LLVM. See the last paragraph of http://llvm.org/docs/CodingStandards.html#namespace-indentation

mehdi_amini added inline comments.Jan 4 2017, 8:30 PM
llvm/include/llvm/IR/PassManager.h
882–883 ↗(On Diff #83162)

+1 with this and all the other naming remarks below.

1239 ↗(On Diff #83162)

I believe it is quite common, in llvm/include there are 941 "namespace llvm" and 478 have a closing comment.

jlebar added inline comments.Jan 5 2017, 10:01 AM
llvm/include/llvm/IR/PassManager.h
882–883 ↗(On Diff #83162)

I agree that containment is the relationship we ideally want to express.

However I don't think that "outer" and "inner" are the right words to express that relationship. Consider two cases:

  • Every function is contained in a module, and functions together (mostly) comprise a module. We (or, I, anyway) would not say "a module is outside a function", or "a function's outer module". I would say "a function's containing module".
  • Every loop is contained in a function. But loops are not the primary component of functions. In this case too I would not say "a function is outside a loop" or "a loop's outer function". I would say "a loop's containing function".

I am happy talking about inner and outer AMs, but I think we're overloading those words in a confusing way when we try to talk about inner/outer IR units.

I've thought about this since last night and unfortunately I don't have a concrete suggestion other than "bigger" / "smaller" (written in quotes, as currently in the patch, to indicate the somewhat figurative use of these words).

What if we just said

An analysis over a "larger" IR unit that provides access to an analysis manager over a "smaller" IR unit, which the larger unit must contain.

? Is that sufficient? If not I'll keep pondering this.

chandlerc added inline comments.Jan 5 2017, 10:28 AM
llvm/include/llvm/IR/PassManager.h
882–883 ↗(On Diff #83162)

I see the confusion you're hitting.

For me, "smaller" and "larger" are if anything more confusing though, so I don't think they are an effective way to address the confusion. It just replaces one with another.

I also don't have any concrete suggestions yet, but currently I would leave it as-is until we do have something that isn't such a tradeoff.

I also wonder how much renaming these would help focus on the AMs being "inner" and "outer" rather than the IR units and address the confusion in that way.

mehdi_amini added inline comments.Jan 5 2017, 10:36 AM
llvm/include/llvm/IR/PassManager.h
882–883 ↗(On Diff #83162)

I'm fairly sure that outer and inner are the terms for nesting of loops in the literature, so it is what seems the less confusing to me when extended for other nested IRUnits.

jlebar updated this revision to Diff 83310.Jan 5 2017, 2:56 PM
jlebar marked 12 inline comments as done.

Address review comments, and in particular change smaller/larger -> inner/outer.

llvm/include/llvm/IR/PassManager.h
882–883 ↗(On Diff #83162)

OK, I've rewritten to use "inner" and "outer" -- what do you think?

903 ↗(On Diff #83162)

Changed back; I don't feel strongly. In fact I reverted the comment deletion here too.

904 ↗(On Diff #83162)

Changed back to Arg -- I actually have no idea why I made that change in the first place.

I'd offer to split out the non-comment changes, but in the patch I'm about to upload, they're (all?) gone anyway.

1239 ↗(On Diff #83162)

I got rid of it so there's no controversy.

jlebar added a comment.Jan 5 2017, 2:57 PM

Thank you both for the review!

chandlerc accepted this revision.Jan 6 2017, 3:41 PM
chandlerc edited edge metadata.

LGTM, thanks!

This revision is now accepted and ready to land.Jan 6 2017, 3:41 PM
This revision was automatically updated to reflect the committed changes.