-
Notifications
You must be signed in to change notification settings - Fork 14.4k
[BOLT] Guard llvm-bolt-wrapper logic of NFC-Mode behind a flag #146209
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
[BOLT] Guard llvm-bolt-wrapper logic of NFC-Mode behind a flag #146209
Conversation
@llvm/pr-subscribers-bolt Author: Paschalis Mpeis (paschalis-mpeis) ChangesBuildbot (
Background: The
Current behaviour and wrapper issue: However, if Ninja reports:
the wrapper remains in place. If the next commit also does no work, Removing the wrapper logic prevents this scenario and simplifies the flow. Full diff: https://github.com/llvm/llvm-project/pull/146209.diff 1 Files Affected:
diff --git a/bolt/utils/nfc-check-setup.py b/bolt/utils/nfc-check-setup.py
index 275ac7b886d00..9e4fc8bc101b1 100755
--- a/bolt/utils/nfc-check-setup.py
+++ b/bolt/utils/nfc-check-setup.py
@@ -48,8 +48,7 @@ def main():
description=textwrap.dedent(
"""
This script builds two versions of BOLT (with the current and
- previous revision) and sets up symlink for llvm-bolt-wrapper.
- Passes the options through to llvm-bolt-wrapper.
+ previous revision).
"""
)
)
@@ -76,7 +75,7 @@ def main():
default="HEAD^",
help="Revision to checkout to compare vs HEAD",
)
- args, wrapper_args = parser.parse_known_args()
+ args = parser.parse_args()
bolt_path = f"{args.build_dir}/bin/llvm-bolt"
source_dir = None
@@ -90,7 +89,6 @@ def main():
sys.exit("Source directory is not found")
script_dir = os.path.dirname(os.path.abspath(__file__))
- wrapper_path = f"{script_dir}/llvm-bolt-wrapper.py"
# build the current commit
subprocess.run(
shlex.split("cmake --build . --target llvm-bolt"), cwd=args.build_dir
@@ -131,15 +129,6 @@ def main():
)
# rename llvm-bolt
os.replace(bolt_path, f"{bolt_path}.old")
- # set up llvm-bolt-wrapper.ini
- ini = subprocess.check_output(
- shlex.split(f"{wrapper_path} {bolt_path}.old {bolt_path}.new") + wrapper_args,
- text=True,
- )
- with open(f"{args.build_dir}/bin/llvm-bolt-wrapper.ini", "w") as f:
- f.write(ini)
- # symlink llvm-bolt-wrapper
- os.symlink(wrapper_path, bolt_path)
if args.switch_back:
if stash:
subprocess.run(shlex.split("git stash pop"), cwd=source_dir)
|
Put the symlinking logic under an option, disabled in a buildbot? |
✅ With the latest revision this PR passed the Python code formatter. |
Hey Amir, Thanks for providing use cases for the wrapper. |
Buildbot (
BOLTBuilder
) no longer relies on a wrapper script to run tests. Thispatch guards the wrapper logic under a flag that is disabled by default. This
it allows to:
Background:
Previously, tests ran unconditionally, which also compiled any missing utilities
and the unit tests.
The
nfc-check-setup.py
created:llvm-bolt.new
, renamed from the current compilationllvm-bolt.old
, built from the previous SHAllvm-bolt
: a python wrapper pointing tollvm-bolt.new
Current behaviour and wrapper issue:
As before, the old/new binaries identify whether a patch affects BOLT. If so,
ninja check-bolt
builds missing dependencies and run tests, overwriting thellvm-bolt
wrapper with a binary.However, if Ninja reports:
the wrapper remains in place. If the next commit also does no work,
nfc-check-setup.py
renames the existing wrapper tollvm-bolt.new
, causing aninfinite loop.
Allowing to disable the wrapper logic prevents this scenario and simplifies the flow.
Test plan:
Creates llvm-bolt.new and llvm-bolt.old and stays on previous revision:
Creates llvm-bolt.new and llvm-bolt.old and returns on current revision:
Creates llvm-bolt.new and llvm-bolt.old, returns on current revision, and
creates a wrapper:
Creates llvm-bolt.new and llvm-bolt.old, and passes an invalid argument to the
wrapper: