This is an archive of the discontinued LLVM Phabricator instance.

[BOLT] Add isParentOf and isParentOrChildOf BF checks
ClosedPublic

Authored by Amir on Jan 26 2023, 2:11 PM.

Details

Summary

Add helper methods and simplify cases where we want to check if two functions
are parent-child of each other (function-fragment relationship).

Diff Detail

Event Timeline

Amir created this revision.Jan 26 2023, 2:11 PM
Herald added a reviewer: maksfb. · View Herald Transcript
Herald added a project: Restricted Project. · View Herald Transcript
Amir requested review of this revision.Jan 26 2023, 2:11 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 26 2023, 2:11 PM
Amir updated this revision to Diff 492572.Jan 26 2023, 2:41 PM

Remove doesBelongToFunction lambda

rafauler added inline comments.Jan 27 2023, 2:46 PM
bolt/include/bolt/Core/BinaryFunction.h
1766

sibling?

Amir added inline comments.Feb 16 2023, 4:04 PM
bolt/include/bolt/Core/BinaryFunction.h
1766

Yes, it's a bit confusing term, but it's useful in context of stripped binaries where we can't tell which function is a parent and which is a child, hence sibling (as we treat them as equal). For parent-child relationship, I don't know of a good unambiguous term: "isRelativeOf"? Kins? isParentOrChildOf? I would go with sibling unless you strongly disagree.

rafauler added inline comments.Feb 17 2023, 10:55 AM
bolt/include/bolt/Core/BinaryFunction.h
1766

I think "sibling" introduces more confusion than helps, but you can ask what's Maksim's take on this if you would like to keep sibling. After you explained, I get why you chose this name, but for someone reading this with no context, it's not clear the intent is to treat them as equals, someone might read this as if you were trying to say these two fragments have a common parent. For the lack of a better word, I would go with "isParentOrChildOf()"

Amir updated this revision to Diff 523876.May 19 2023, 11:36 AM

s/isSiblingOf/isParentOrChildOf

Amir marked 2 inline comments as done.May 19 2023, 11:37 AM
Amir retitled this revision from [BOLT] Add isParentOf and isSiblingOf BinaryFunction methods to [BOLT] Add isParentOf and isParentOrChildOf BF checks.May 19 2023, 11:38 AM
Amir edited the summary of this revision. (Show Details)
Amir updated this revision to Diff 523878.May 19 2023, 11:43 AM

clang-format

rafauler accepted this revision.May 19 2023, 4:16 PM
This revision is now accepted and ready to land.May 19 2023, 4:16 PM
This revision was automatically updated to reflect the committed changes.