[all-commits] [llvm/llvm-project] 1e2f87: [AArch64][GlobalISel] Move the localizer to run be...

Amara Emerson via All-commits all-commits at lists.llvm.org
Mon Apr 3 20:42:08 PDT 2023

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 1e2f87868f6fb64179b02c1076c6b3cd26576907
  Author: Amara Emerson <amara at apple.com>
  Date:   2023-04-03 (Mon, 03 Apr 2023)

  Changed paths:
    M llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
    M llvm/lib/Target/AArch64/AArch64TargetMachine.cpp
    M llvm/test/CodeGen/AArch64/GlobalISel/arm64-atomic.ll
    M llvm/test/CodeGen/AArch64/GlobalISel/arm64-pcsections.ll
    M llvm/test/CodeGen/AArch64/GlobalISel/gisel-commandline-option.ll
    M llvm/test/CodeGen/AArch64/GlobalISel/invoke-region.ll
    M llvm/test/CodeGen/AArch64/GlobalISel/legalize-exceptions.ll
    M llvm/test/CodeGen/AArch64/GlobalISel/localizer-arm64-tti.ll
    R llvm/test/CodeGen/AArch64/GlobalISel/localizer-in-O0-pipeline.mir
    M llvm/test/CodeGen/AArch64/GlobalISel/postlegalizer-lowering-swap-compare-operands.mir
    M llvm/test/CodeGen/AArch64/O0-pipeline.ll
    M llvm/test/CodeGen/AArch64/aarch64-mops-mte.ll
    M llvm/test/CodeGen/AArch64/aarch64-mops.ll
    M llvm/test/CodeGen/AArch64/popcount.ll
    M llvm/test/Other/print-changed-machine.ll

  Log Message:
  [AArch64][GlobalISel] Move the localizer to run before the legalizer, and always localize globals.

Our strategy for localizing globals in the entry block breaks down when we have
large functions with high register pressure, using lots of globals. When this
happens, our heuristics say that globals with many uses should not be localized,
leading us to cause excessive spills and stack usage. These situations are also
exacerbated by LTO which tends to generate large functions.

For now, moving to a strategy that's simpler and more akin to SelectionDAG
fixes these issues and makes our codegen more similar. This has an overall
neutral effect on size on CTMark, while showing slight improvements with -Os -flto
on benchmarks. For low level firmware software though we see big improvements.

The reason this is neutral, and not an improvement, is because we give up the
gains from CSE'ing globals in cases where we low register pressure. I think
this can be addressed in future with some better heuristics.

Differential Revision: https://reviews.llvm.org/D147484

More information about the All-commits mailing list