Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[BOLT] Use std::tie to Implment operator< (NFC) #139404

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions bolt/include/bolt/Passes/FrameAnalysis.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#define BOLT_PASSES_FRAMEANALYSIS_H

#include "bolt/Passes/StackPointerTracking.h"
#include <tuple>

namespace llvm {
namespace bolt {
Expand Down Expand Up @@ -53,9 +54,7 @@ struct ArgInStackAccess {
uint8_t Size;

bool operator<(const ArgInStackAccess &RHS) const {
if (StackOffset != RHS.StackOffset)
return StackOffset < RHS.StackOffset;
return Size < RHS.Size;
return std::tie(StackOffset, Size) < std::tie(RHS.StackOffset, RHS.Size);
}
};

Expand Down
4 changes: 1 addition & 3 deletions bolt/include/bolt/Passes/PAuthGadgetScanner.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,7 @@ struct MCInstInBBReference {
return BB == RHS.BB && BBIndex == RHS.BBIndex;
}
bool operator<(const MCInstInBBReference &RHS) const {
if (BB != RHS.BB)
return BB < RHS.BB;
return BBIndex < RHS.BBIndex;
return std::tie(BB, BBIndex) < std::tie(RHS.BB, RHS.BBIndex);
}
operator MCInst &() const {
assert(BB != nullptr);
Expand Down
8 changes: 1 addition & 7 deletions bolt/include/bolt/Profile/DataReader.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,7 @@ struct BranchInfo {
}

bool operator<(const BranchInfo &RHS) const {
if (From < RHS.From)
return true;

if (From == RHS.From)
return (To < RHS.To);

return false;
return std::tie(From, To) < std::tie(RHS.From, RHS.To);
}

/// Merges branch and misprediction counts of \p BI with those of this object.
Expand Down
Loading