This is an archive of the discontinued LLVM Phabricator instance.

[BOLT][NFC] Use llvm::make_second_range
ClosedPublic

Authored by Amir on Jan 31 2023, 2:34 PM.

Details

Reviewers
rafauler
maksfb
Group Reviewers
Restricted Project
Commits
rG72e5b14fe76b: [BOLT][NFC] Use llvm::make_second_range

Diff Detail

Event Timeline

Amir created this revision.Jan 31 2023, 2:34 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 31 2023, 2:34 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 31 2023, 2:34 PM
rafauler added inline comments.Feb 1 2023, 11:47 AM
bolt/lib/Core/BinaryContext.cpp
1521–1523

Shouldn't this be

llvm::copy(llvm::make_second_range(BinaryFunctions), std::back_inserter(AllFunctions));

like you did in IndirectCallPromotion.cpp? Similarly for other changes.

Amir added inline comments.Feb 1 2023, 3:36 PM
bolt/lib/Core/BinaryContext.cpp
1521–1523

It can't be a copy. We take a pointer here (&BF), hence transform is needed (that applies a lambda to each element before storing the result).

Oh I see, there's still a transform going on. Thanks.

rafauler accepted this revision.Feb 2 2023, 9:44 AM

LGTM

This revision is now accepted and ready to land.Feb 2 2023, 9:44 AM
This revision was automatically updated to reflect the committed changes.