diff --git a/llvm/lib/Transforms/Scalar/StraightLineStrengthReduce.cpp b/llvm/lib/Transforms/Scalar/StraightLineStrengthReduce.cpp index a62804d3ef201..e5399bdd767e2 100644 --- a/llvm/lib/Transforms/Scalar/StraightLineStrengthReduce.cpp +++ b/llvm/lib/Transforms/Scalar/StraightLineStrengthReduce.cpp @@ -1275,8 +1275,7 @@ bool StraightLineStrengthReduce::runOnFunction(Function &F) { // Build the dependency graph and sort candidate instructions from dependency // roots to leaves for (auto &C : Candidates) { - if (DependencyGraph.find(C.Ins) == DependencyGraph.end()) - DependencyGraph[C.Ins] = {}; + DependencyGraph.try_emplace(C.Ins); addDependency(C, C.Basis); } sortCandidateInstructions();