[llvm] r353162 - [MCA] Simplify the logic in method WriteState::addUser. NFCI
Andrea Di Biagio via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 5 03:36:55 PST 2019
Author: adibiagio
Date: Tue Feb 5 03:36:55 2019
New Revision: 353162
URL: http://llvm.org/viewvc/llvm-project?rev=353162&view=rev
Log:
[MCA] Simplify the logic in method WriteState::addUser. NFCI
In some cases, it is faster to just grow the set of 'Users' rather than
performing a llvm::find_if every time a new user is added to
the set. No functional change intended.
Modified:
llvm/trunk/lib/MCA/Instruction.cpp
Modified: llvm/trunk/lib/MCA/Instruction.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MCA/Instruction.cpp?rev=353162&r1=353161&r2=353162&view=diff
==============================================================================
--- llvm/trunk/lib/MCA/Instruction.cpp (original)
+++ llvm/trunk/lib/MCA/Instruction.cpp Tue Feb 5 03:36:55 2019
@@ -64,11 +64,7 @@ void WriteState::addUser(ReadState *User
return;
}
- if (llvm::find_if(Users, [&User](const std::pair<ReadState *, int> &Use) {
- return Use.first == User;
- }) == Users.end()) {
- Users.emplace_back(User, ReadAdvance);
- }
+ Users.emplace_back(User, ReadAdvance);
}
void WriteState::addUser(WriteState *User) {
More information about the llvm-commits
mailing list