Page MenuHomePhabricator

[KnownBits] Avoid copying KnownBits objects
Needs ReviewPublic

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

TimeTest
10 msLLVM.Bindings/Go::go.test
Script: -- : 'RUN: at line 1'; llvm-go test llvm.org/llvm/bindings/go/llvm

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.