[llvm] [BOLT] Add support for safe-icf (PR #116275)

Alexander Yermolovich via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 3 17:02:53 PST 2024


================
@@ -1945,6 +2017,28 @@ static void printDebugInfo(raw_ostream &OS, const MCInst &Instruction,
     OS << " discriminator:" << Row.Discriminator;
 }
 
+/// Skip instructions that are not interesting for safe ICF.
+static bool skipInstruction(const MCInst &Inst, const BinaryContext &BC) {
----------------
ayermolo wrote:

You mentioned I should leverage BinaryFunction::scanExternalRefs(). This is why I removed parsing code from the ICF pass and added processInstructionForFuncReferences, which relies on this function.
If I move skipInstruction to pass then Core will depend on Pass. This will create a circular dependency as LLVMBOLTPasses relies on LLVMBOLTCore.

https://github.com/llvm/llvm-project/pull/116275


More information about the llvm-commits mailing list