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

Amir Ayupov via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 13 12:40:51 PST 2024


================
@@ -1513,6 +1513,20 @@ MCSymbol *BinaryFunction::registerBranch(uint64_t Src, uint64_t Dst) {
   return Target;
 }
 
+void BinaryFunction::processInstructionsForFuncReferences(BinaryContext &BC,
+                                                          const MCInst &Inst) {
+  for (const MCOperand &Op : MCPlus::primeOperands(Inst)) {
+    if (!Op.isExpr())
+      continue;
+    const MCExpr &Expr = *Op.getExpr();
+    if (Expr.getKind() == MCExpr::SymbolRef) {
----------------
aaupov wrote:

Flip the condition and bail early

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


More information about the llvm-commits mailing list