diff --git a/bolt/include/bolt/Core/BinaryFunction.h b/bolt/include/bolt/Core/BinaryFunction.h --- a/bolt/include/bolt/Core/BinaryFunction.h +++ b/bolt/include/bolt/Core/BinaryFunction.h @@ -1466,8 +1466,6 @@ ArrayRef getLSDATypeIndexTable() const { return LSDATypeIndexTable; } - const LabelsMapType &getLabels() const { return Labels; } - IslandInfo &getIslandInfo() { assert(Islands && "function expected to have constant islands"); return *Islands; diff --git a/bolt/lib/Core/BinaryFunction.cpp b/bolt/lib/Core/BinaryFunction.cpp --- a/bolt/lib/Core/BinaryFunction.cpp +++ b/bolt/lib/Core/BinaryFunction.cpp @@ -2902,16 +2902,12 @@ void BinaryFunction::setTrapOnEntry() { clearDisasmState(); - auto addTrapAtOffset = [&](uint64_t Offset) { + forEachEntryPoint([&](uint64_t Offset, const MCSymbol *Label) -> bool { MCInst TrapInstr; BC.MIB->createTrap(TrapInstr); addInstruction(Offset, std::move(TrapInstr)); - }; - - addTrapAtOffset(0); - for (const std::pair &KV : getLabels()) - if (getSecondaryEntryPointSymbol(KV.second)) - addTrapAtOffset(KV.first); + return true; + }); TrapsOnEntry = true; }