[llvm] [BOLT][AArch64] Fix strict usage during ADR Relax (PR #71377)

Vladislav Khmelevsky via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 12 01:19:01 PST 2024


================
@@ -72,14 +72,17 @@ void ADRRelaxationPass::runOnFunction(BinaryFunction &BF) {
 
       if (It != BB.begin() && BC.MIB->isNoop(*std::prev(It))) {
         It = BB.eraseInstruction(std::prev(It));
-      } else if (opts::StrictMode && !BF.isSimple()) {
+      } else if (std::next(It) != BB.end() && BC.MIB->isNoop(*std::next(It))) {
+        BB.eraseInstruction(std::next(It));
+      } else if (!opts::StrictMode && !BF.isSimple()) {
----------------
yota9 wrote:

Although the name of the option might suggests to be more "strict" to the binary input, the options description says the opposite "trust the input to be from a well-formed source". So the option expands the number of binary functions we're processing, rather the shrinks it. Although it doesn't really matter, I've only fixed the option usage here, but the option choice here was not the best from the beginning.

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


More information about the llvm-commits mailing list