[llvm] [BOLT] Move ADRRelaxationPass (PR #101371)

via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 31 10:34:48 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-bolt

Author: Vladislav Khmelevsky (yota9)

<details>
<summary>Changes</summary>

For non-simple functions we need nop instruction to be presented to
transform ADR to ADRP+ADD sequence, so run this pass before remove nops
pass.


---
Full diff: https://github.com/llvm/llvm-project/pull/101371.diff


1 Files Affected:

- (modified) bolt/lib/Rewrite/BinaryPassManager.cpp (+2-2) 


``````````diff
diff --git a/bolt/lib/Rewrite/BinaryPassManager.cpp b/bolt/lib/Rewrite/BinaryPassManager.cpp
index 5dfef0b71cc79..dadb1f4d833b0 100644
--- a/bolt/lib/Rewrite/BinaryPassManager.cpp
+++ b/bolt/lib/Rewrite/BinaryPassManager.cpp
@@ -357,6 +357,8 @@ Error BinaryFunctionPassManager::runAllPasses(BinaryContext &BC) {
 
     Manager.registerPass(
         std::make_unique<VeneerElimination>(PrintVeneerElimination));
+
+    Manager.registerPass(std::make_unique<ADRRelaxationPass>());
   }
 
   if (BC.isRISCV()) {
@@ -490,8 +492,6 @@ Error BinaryFunctionPassManager::runAllPasses(BinaryContext &BC) {
   Manager.registerPass(std::make_unique<ReorderData>());
 
   if (BC.isAArch64()) {
-    Manager.registerPass(std::make_unique<ADRRelaxationPass>());
-
     // Tighten branches according to offset differences between branch and
     // targets. No extra instructions after this pass, otherwise we may have
     // relocations out of range and crash during linking.

``````````

</details>


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


More information about the llvm-commits mailing list