This is an archive of the discontinued LLVM Phabricator instance.

[KnownBits] Avoid copying KnownBits objects
AbandonedPublic

Authored by foad on Feb 13 2020, 2:47 AM.

Details

Summary

Avoid copying KnownBits objects in some cases where we can move them or
use a slightly simpler constructor instead. NFC.

I found these cases by temporarily deleting KnownBits's copy constructor
and copy assignment operator.

Diff Detail

Unit TestsFailed

Event Timeline

foad created this revision.Feb 13 2020, 2:47 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 13 2020, 2:47 AM

Are you actually seeing a performance delta from this?

foad added a comment.Feb 13 2020, 3:28 AM

Are you actually seeing a performance delta from this?

No, I was just doing it as a kind of drive-by clean-up, since @bjope expressed some concern that we might be copying these objects too much in comments on D74482.

RKSimon added inline comments.Feb 19 2020, 7:10 AM
llvm/lib/Analysis/ValueTracking.cpp
1097

Not sure about the std::move but using BitWidth makes sense to me.

foad abandoned this revision.Apr 9 2020, 1:33 AM
foad marked an inline comment as done.
foad added inline comments.
llvm/lib/Analysis/ValueTracking.cpp
1097

I took the liberty of committing these bits in 94cc9eccf65f2282ae780c3e98d19c5b3b6b9069.

RKSimon added inline comments.Apr 9 2020, 10:37 AM
llvm/lib/Analysis/ValueTracking.cpp
1097

LGTM, cheers