[llvm] [MachineOutliner] Don't outline ADRP pair to avoid incorrect ICF (PR #160232)

Pranav Kant via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 24 12:48:20 PDT 2025


================
@@ -10179,11 +10179,33 @@ AArch64InstrInfo::getOutliningTypeImpl(const MachineModuleInfo &MMI,
       return outliner::InstrType::Illegal;
   }
 
-  // Special cases for instructions that can always be outlined, but will fail
-  // the later tests. e.g, ADRPs, which are PC-relative use LR, but can always
-  // be outlined because they don't require a *specific* value to be in LR.
-  if (MI.getOpcode() == AArch64::ADRP)
+  // An ADRP instruction referencing a GOT should not be outlined.
----------------
pranavk wrote:

>  Is there an alternative that scans the sequences looking for LDR or ADD instructions with MO_GOT that appear before an ADRP with a MO_PAGE.

You mean that appears _after_ an ADRP with MO_PAGE?

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


More information about the llvm-commits mailing list