[llvm-branch-commits] [llvm] PeepholeOpt: Avoid double map lookup (PR #124531)
Jay Foad via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Mon Jan 27 03:52:46 PST 2025
================
@@ -1035,8 +1035,10 @@ bool PeepholeOptimizer::findNextSource(RegSubRegPair RegSubReg,
return false;
// Insert the Def -> Use entry for the recently found source.
- ValueTrackerResult CurSrcRes = RewriteMap.lookup(CurSrcPair);
- if (CurSrcRes.isValid()) {
+ auto [InsertPt, WasInserted] = RewriteMap.try_emplace(CurSrcPair, Res);
+
+ ValueTrackerResult CurSrcRes = InsertPt->second;
----------------
jayfoad wrote:
Sink this inside the "if"
https://github.com/llvm/llvm-project/pull/124531
More information about the llvm-branch-commits
mailing list