[llvm] [ARM][Thumb1] Account for tail duplication in fn size estimation (PR #214228)

Eli Friedman via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 5 11:46:06 PDT 2026


efriedma-quic wrote:

Looking at the -debug-pass=Structure output, the following passes run between PEI and constant islands.  Most of the passes aren't really relevant here, either because they don't apply to Thumb1 targets, or they don't increase codesize.  But we have a separate tail duplication pass as well.  And if conversion is also potentially an issue.

I didn't really think about the fact that we do this many control flow optimizations this late.  I'll try to think through the implications... trying to guess what CFG transforms will trigger seems hard.

```
      Machine Late Instructions Cleanup Pass
      Control Flow Optimizer
      Lazy Machine Block Frequency Analysis
      Tail Duplication
      Machine Copy Propagation Pass
      Post-RA pseudo instruction expansion pass
      ARM load / store optimization pass
      Reaching Definitions Analysis
      ARM Execution Domain Fix
      BreakFalseDeps
      ARM pseudo instruction expansion pass
      Insert KCFI indirect call checks
      Thumb2 instruction size reduce pass
      MachineDominator Tree Construction
      Machine Natural Loop Construction
      Machine Block Frequency Analysis
      If Converter
      Thumb IT blocks insertion pass
      MachineDominator Tree Construction
      Machine Natural Loop Construction
      PostRA Machine Instruction Scheduler
      Post RA top-down list latency scheduler
      MVE VPT block insertion pass
      ARM Indirect Thunks
      ARM sls hardening pass
      Analyze Machine Code For Garbage Collection
      MachineDominator Tree Construction
      Machine Natural Loop Construction
      Machine Block Frequency Analysis
      MachinePostDominator Tree Construction
      Branch Probability Basic Block Placement
      Insert fentry calls
      Insert XRay ops
      Implement the 'patchable-function' attribute
      Thumb2 instruction size reduce pass
      Unpack machine instruction bundles
      MachineDominator Tree Construction
      Machine Natural Loop Construction
      ARM block placement
      optimise barriers pass
      Contiguously Lay Out Funclets
      Remove Loads Into Fake Uses
      StackMap Liveness Analysis
      Live DEBUG_VALUE analysis
      Machine Sanitizer Binary Metadata
    Machine Outliner
    FunctionPass Manager
      Lazy Machine Block Frequency Analysis
      Machine Optimization Remark Emitter
      Stack Frame Layout Analysis
      Reaching Definitions Analysis
      ARM fix for Cortex-A57 AES Erratum 1742098
      ARM Branch Targets
      MachineDominator Tree Construction
```

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


More information about the llvm-commits mailing list