This is an archive of the discontinued LLVM Phabricator instance.

[lldb/Utility] Simplify Scalar::PromoteToMaxType
ClosedPublic

Authored by labath on Aug 13 2020, 6:55 AM.

Details

Summary

The function had very complicated signature, because it was trying to
avoid making unnecessary copies of the Scalar object. However, this
class is not hot enough to worry about these kinds of optimizations. My
making copies unconditionally, we can simplify the function and all of
its call sites.

Diff Detail

Event Timeline

labath created this revision.Aug 13 2020, 6:55 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 13 2020, 6:55 AM
labath requested review of this revision.Aug 13 2020, 6:55 AM
labath added inline comments.
lldb/include/lldb/Utility/Scalar.h
268–276

If we're worried about the seemingly random usage of const&, we could also make the copies inside the functions, or change everything to use value parameters...

JDevlieghere accepted this revision.Aug 13 2020, 8:46 AM

Yeah, I think this is worth the overhead of making a few copies. LGTM.

This revision is now accepted and ready to land.Aug 13 2020, 8:46 AM
This revision was landed with ongoing or failed builds.Aug 14 2020, 2:09 AM
This revision was automatically updated to reflect the committed changes.