-
Notifications
You must be signed in to change notification settings - Fork 13.6k
[BOLT] Don't remove nops in non-simple functions #101964
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?
Conversation
@llvm/pr-subscribers-bolt Author: Vladislav Khmelevsky (yota9) ChangesFollow the logic of https://reviews.llvm.org/D143887 patch (fixed later Full diff: https://github.com/llvm/llvm-project/pull/101964.diff 1 Files Affected:
diff --git a/bolt/lib/Passes/BinaryPasses.cpp b/bolt/lib/Passes/BinaryPasses.cpp
index fa95ad7324ac1..fbbbe1e05df2c 100644
--- a/bolt/lib/Passes/BinaryPasses.cpp
+++ b/bolt/lib/Passes/BinaryPasses.cpp
@@ -1923,7 +1923,7 @@ Error RemoveNops::runOnFunctions(BinaryContext &BC) {
};
ParallelUtilities::PredicateTy SkipFunc = [&](const BinaryFunction &BF) {
- return BF.shouldPreserveNops();
+ return BF.shouldPreserveNops() || (!opts::StrictMode && !BF.isSimple());
};
ParallelUtilities::runOnEachFunction(
|
Hold on, it looks like there are test failures.
|
Yeah, thanks @peterwaller-arm . I would need to build bolt with riscv support one day :) I probably fixed it, would check it now. But anyway I'm not ready to submit without one of meta team members approve - I'm pretty sure some of their internal test would fail and it probably needs some kind of test which I don't currently have (the reason it is NFC) |
2a184fa
to
89940e9
Compare
Add test, so now it is not NFC patch. Looking forward to meta team comments about this patch and their internal tests passed |
Follow the logic of https://reviews.llvm.org/D143887 patch (fixed later by llvm#71377) we don't want to remove nops in non-simple function just in case there is undetected jump table to minimize chances to break offsets in it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is non-NFC, and probably a regression, at least on X86.
we don't want to remove nops in non-simple function just in case there is undetected jump table to minimize chances to break offsets in it.
I think that should be covered by relocation mode. If there are issues with jump table identification, that should be fixed separately.
Let's hear from @maksfb @rafaelauler
@aaupov Could you please check that the regression is not caused by the tests (e.g. function size, instruction sequence & etc)? |
Hi @yota9, I've tried the test case for AArch64 and it succeeds even without applying the fix. I have some other changes in my repo, by I doubt they are related. Could you please double check that the test case is valid? |
We currently set I general, I agree that we should preserve an internal function layout for non-simple functions, i.e. maintain offsets of all potential branch destinations. This should be done for all platforms. |
Follow the logic of https://reviews.llvm.org/D143887 patch (fixed later
by #71377) we don't want to remove nops in non-simple function just in
case there is undetected jump table to minimize chances to break offsets
in it.