This is an archive of the discontinued LLVM Phabricator instance.

[NFCI] [TransformUtils] cleanup `CloneFunctionInto`
ClosedPublic

Authored by ldrumm on Mar 19 2021, 8:49 AM.

Details

Summary

This function is full of special casing so some readability improvements
help its digestibility:

  • Fix an incorrect assert message (after 22a52dfddc)
  • Hoist early exit for decl-only function to before analysis over subprogram metadata by DIFinder
  • Give an unweildy repeated expression a name
  • use ranged for basic block iterator
  • clang-format

Diff Detail

Event Timeline

ldrumm created this revision.Mar 19 2021, 8:49 AM
ldrumm requested review of this revision.Mar 19 2021, 8:49 AM
nikic accepted this revision.Mar 19 2021, 9:37 AM

LG

llvm/lib/Transforms/Utils/CloneFunction.cpp
157

Capitalize message for consistency.

This revision is now accepted and ready to land.Mar 19 2021, 9:37 AM
dexonsmith accepted this revision.Mar 22 2021, 8:44 PM

Thanks for cleaning this up!

Mostly LGTM, just please split this up into three separate commits (no need for new reviews; any order seems fine, as they seem fully independent):

  • Move the early return and fixing the assertion message (capitalized, as @nikic mentioned).
  • NFC refactorings.
  • Unrelated whitespace changes (BTW, if you just got these incidentally, you can use git-clang-format in the future to just change the lines your commit is touching...).

Thanks for cleaning this up!

Mostly LGTM, just please split this up into three separate commits (no need for new reviews; any order seems fine, as they seem fully independent):

Good idea. Will do

  • Unrelated whitespace changes (BTW, if you just got these incidentally, you can use git-clang-format in the future to just change the lines your commit is touching...).

Seeing as there is now a whitespace only commit, I've just opted to format the whole file as there are plently of other formatting issues picked up in this file

ldrumm marked an inline comment as done.Mar 23 2021, 5:43 AM