[llvm] ebb5856 - [CodeGen] Avoid repeated hash lookups (NFC) (#123016)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 15 07:57:07 PST 2025
Author: Kazu Hirata
Date: 2025-01-15T07:57:04-08:00
New Revision: ebb58567e79046afb28a4e657d1b1fd481a595a0
URL: https://github.com/llvm/llvm-project/commit/ebb58567e79046afb28a4e657d1b1fd481a595a0
DIFF: https://github.com/llvm/llvm-project/commit/ebb58567e79046afb28a4e657d1b1fd481a595a0.diff
LOG: [CodeGen] Avoid repeated hash lookups (NFC) (#123016)
Added:
Modified:
llvm/lib/CodeGen/CodeGenPrepare.cpp
Removed:
################################################################################
diff --git a/llvm/lib/CodeGen/CodeGenPrepare.cpp b/llvm/lib/CodeGen/CodeGenPrepare.cpp
index ba1b10ec8b9b1b..a3392b71109897 100644
--- a/llvm/lib/CodeGen/CodeGenPrepare.cpp
+++ b/llvm/lib/CodeGen/CodeGenPrepare.cpp
@@ -7690,8 +7690,8 @@ bool CodeGenPrepare::tryToSinkFreeOperands(Instruction *I) {
// sunk instruction uses, if it is part of a chain that has already been
// sunk.
Instruction *OldI = cast<Instruction>(U->getUser());
- if (NewInstructions.count(OldI))
- NewInstructions[OldI]->setOperand(U->getOperandNo(), NI);
+ if (auto It = NewInstructions.find(OldI); It != NewInstructions.end())
+ It->second->setOperand(U->getOperandNo(), NI);
else
U->set(NI);
Changed = true;
More information about the llvm-commits
mailing list