[llvm-branch-commits] [llvm] [BOLT] Accept PLT fall-throughs as valid traces (PR #129481)
Amir Ayupov via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Fri Apr 11 17:56:33 PDT 2025
https://github.com/aaupov updated https://github.com/llvm/llvm-project/pull/129481
>From b0da5dc1e277381c3819e1980b97199286f9208d Mon Sep 17 00:00:00 2001
From: Amir Ayupov <aaupov at fb.com>
Date: Mon, 3 Mar 2025 07:20:10 -0800
Subject: [PATCH 1/2] format
Created using spr 1.3.4
---
bolt/test/link_fdata.py | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/bolt/test/link_fdata.py b/bolt/test/link_fdata.py
index 4555e6b0479ae..67117a751b32f 100755
--- a/bolt/test/link_fdata.py
+++ b/bolt/test/link_fdata.py
@@ -85,7 +85,9 @@
# Read nm output: <symbol value> <symbol type> <symbol name>
nm_output = subprocess.run(
- [args.nmtool, "--defined-only", "--synthetic", args.objfile], text=True, capture_output=True
+ [args.nmtool, "--defined-only", "--synthetic", args.objfile],
+ text=True,
+ capture_output=True,
).stdout
# Populate symbol map
symbols = {}
>From 8c90ebcba6a4f85087bec2d80047a3c9c00b43a4 Mon Sep 17 00:00:00 2001
From: Amir Ayupov <aaupov at fb.com>
Date: Mon, 3 Mar 2025 10:46:47 -0800
Subject: [PATCH 2/2] updated comment, fix link_fdata
Created using spr 1.3.4
---
bolt/lib/Profile/DataAggregator.cpp | 9 ++++++---
bolt/test/link_fdata.py | 9 ++++++++-
2 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/bolt/lib/Profile/DataAggregator.cpp b/bolt/lib/Profile/DataAggregator.cpp
index dec82a3c06083..ed66191343a7f 100644
--- a/bolt/lib/Profile/DataAggregator.cpp
+++ b/bolt/lib/Profile/DataAggregator.cpp
@@ -852,9 +852,12 @@ DataAggregator::getFallthroughsInTrace(BinaryFunction &BF,
if (From > To)
return std::nullopt;
- // Accept fall-throughs inside pseudo functions (PLT/thunks). Such functions
- // are marked as ignored and so lack CFG, which means fallthroughs in them are
- // reported as mismatching traces which they are not.
+ // Accept fall-throughs inside pseudo functions (PLT/thunks).
+ // This check has to be above BF.empty as pseudo functions would pass it:
+ // pseudo => ignored => CFG not built => empty.
+ // If we return nullopt, trace would be reported as mismatching disassembled
+ // function contents which it is not. To avoid this, return an empty
+ // fall-through list instead.
if (BF.isPseudo())
return Branches;
diff --git a/bolt/test/link_fdata.py b/bolt/test/link_fdata.py
index 67117a751b32f..f1d83458346d6 100755
--- a/bolt/test/link_fdata.py
+++ b/bolt/test/link_fdata.py
@@ -8,6 +8,7 @@
"""
import argparse
+import os
import subprocess
import sys
import re
@@ -84,8 +85,14 @@
exit("ERROR: unexpected input:\n%s" % line)
# Read nm output: <symbol value> <symbol type> <symbol name>
+is_llvm_nm = os.path.basename(args.nmtool) == "llvm-nm"
nm_output = subprocess.run(
- [args.nmtool, "--defined-only", "--synthetic", args.objfile],
+ [
+ args.nmtool,
+ "--defined-only",
+ "--special-syms" if is_llvm_nm else "--synthetic",
+ args.objfile,
+ ],
text=True,
capture_output=True,
).stdout
More information about the llvm-branch-commits
mailing list