From 998a925e0e4720a619bfbd6a5842b4c5ca8a9b63 Mon Sep 17 00:00:00 2001 From: Andrea Di Biagio Date: Tue, 5 Feb 2019 11:36:55 +0000 Subject: [PATCH] [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. llvm-svn: 353162 --- llvm/lib/MCA/Instruction.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/llvm/lib/MCA/Instruction.cpp b/llvm/lib/MCA/Instruction.cpp index f19430c..0e9c709 100644 --- a/llvm/lib/MCA/Instruction.cpp +++ b/llvm/lib/MCA/Instruction.cpp @@ -64,11 +64,7 @@ void WriteState::addUser(ReadState *User, int ReadAdvance) { return; } - if (llvm::find_if(Users, [&User](const std::pair &Use) { - return Use.first == User; - }) == Users.end()) { - Users.emplace_back(User, ReadAdvance); - } + Users.emplace_back(User, ReadAdvance); } void WriteState::addUser(WriteState *User) { -- 2.7.4