@@ -1515,15 +1515,15 @@ void RuntimeDyldELF::resolveAArch64Branch(unsigned SectionID,
15151515 uint64_t Offset = RelI->getOffset ();
15161516 unsigned RelType = RelI->getType ();
15171517 // Look for an existing stub.
1518- StubMap::const_iterator i = Stubs.find (Value);
1519- if (i != Stubs. end () ) {
1518+ auto [It, Inserted] = Stubs.try_emplace (Value);
1519+ if (!Inserted ) {
15201520 resolveRelocation (Section, Offset,
1521- Section.getLoadAddressWithOffset (i ->second ), RelType, 0 );
1521+ Section.getLoadAddressWithOffset (It ->second ), RelType, 0 );
15221522 LLVM_DEBUG (dbgs () << " Stub function found\n " );
15231523 } else if (!resolveAArch64ShortBranch (SectionID, RelI, Value)) {
15241524 // Create a new stub function.
15251525 LLVM_DEBUG (dbgs () << " Create a new stub function\n " );
1526- Stubs[Value] = Section.getStubOffset ();
1526+ It-> second = Section.getStubOffset ();
15271527 uint8_t *StubTargetAddr = createStubFunction (
15281528 Section.getAddressWithOffset (Section.getStubOffset ()));
15291529
@@ -1837,15 +1837,15 @@ RuntimeDyldELF::processRelocationRef(
18371837 SectionEntry &Section = Sections[SectionID];
18381838
18391839 // Look up for existing stub.
1840- StubMap::const_iterator i = Stubs.find (Value);
1841- if (i != Stubs. end () ) {
1842- RelocationEntry RE (SectionID, Offset, RelType, i ->second );
1840+ auto [It, Inserted] = Stubs.try_emplace (Value);
1841+ if (!Inserted ) {
1842+ RelocationEntry RE (SectionID, Offset, RelType, It ->second );
18431843 addRelocationForSection (RE, SectionID);
18441844 LLVM_DEBUG (dbgs () << " Stub function found\n " );
18451845 } else {
18461846 // Create a new stub function.
18471847 LLVM_DEBUG (dbgs () << " Create a new stub function\n " );
1848- Stubs[Value] = Section.getStubOffset ();
1848+ It-> second = Section.getStubOffset ();
18491849
18501850 unsigned AbiVariant = Obj.getPlatformFlags ();
18511851
@@ -2075,10 +2075,10 @@ RuntimeDyldELF::processRelocationRef(
20752075 SectionEntry &Section = Sections[SectionID];
20762076
20772077 // Look for an existing stub.
2078- StubMap::const_iterator i = Stubs.find (Value);
2078+ auto [It, Inserted] = Stubs.try_emplace (Value);
20792079 uintptr_t StubAddress;
2080- if (i != Stubs. end () ) {
2081- StubAddress = uintptr_t (Section.getAddressWithOffset (i ->second ));
2080+ if (!Inserted ) {
2081+ StubAddress = uintptr_t (Section.getAddressWithOffset (It ->second ));
20822082 LLVM_DEBUG (dbgs () << " Stub function found\n " );
20832083 } else {
20842084 // Create a new stub function.
@@ -2089,7 +2089,7 @@ RuntimeDyldELF::processRelocationRef(
20892089 alignTo (BaseAddress + Section.getStubOffset (), getStubAlignment ());
20902090 unsigned StubOffset = StubAddress - BaseAddress;
20912091
2092- Stubs[Value] = StubOffset;
2092+ It-> second = StubOffset;
20932093 createStubFunction ((uint8_t *)StubAddress);
20942094 RelocationEntry RE (SectionID, StubOffset + 8 , ELF::R_390_64,
20952095 Value.Offset );
0 commit comments