[llvm] [GlobalISel] Optimized MatchData Handling (PR #92115)

Amara Emerson via llvm-commits llvm-commits at lists.llvm.org
Tue May 14 23:32:15 PDT 2024


aemerson wrote:

One thing I just noticed was that the binary sizes for clang w/ thinlto were quite different.
Before: 181781160
After: 182051240

That's a -0.15% size regression which is significant for such a relatively small change. Using a script to analyze function size diffs I see this as the top regressions:
```
__ZNK12_GLOBAL__N_125AMDGPURegBankCombinerImpl15runCustomActionEjRKN4llvm20GIMatchTableExecutor12MatcherStateERNS1_11SmallVectorINS1_19MachineInstrBuilderELj4EEE 940 1824 884
__ZNK12_GLOBAL__N_129RISCVPreLegalizerCombinerImpl18testMIPredicate_MIEjRKN4llvm12MachineInstrERKNS1_20GIMatchTableExecutor12MatcherStateE 8376 9552 1176
__ZNK12_GLOBAL__N_132AArch64PostLegalizerLoweringImpl15runCustomActionEjRKN4llvm20GIMatchTableExecutor12MatcherStateERNS1_11SmallVectorINS1_19MachineInstrBuilderELj4EEE 7712 8996 1284
__ZN12_GLOBAL__N_19Demangler10parseLNameEPN4llvm16itanium_demangle12OutputBufferERNSt3__117basic_string_viewIcNS5_11char_traitsIcEEEEm 46275648 46277264 1616
__ZNK12_GLOBAL__N_130AMDGPUPreLegalizerCombinerImpl18testMIPredicate_MIEjRKN4llvm12MachineInstrERKNS1_20GIMatchTableExecutor12MatcherStateE 8500 10168 1668
__ZNK12_GLOBAL__N_131AArch64PreLegalizerCombinerImpl18testMIPredicate_MIEjRKN4llvm12MachineInstrERKNS1_20GIMatchTableExecutor12MatcherStateE 8708 10416 1708
__ZNK12_GLOBAL__N_131AMDGPUPostLegalizerCombinerImpl18testMIPredicate_MIEjRKN4llvm12MachineInstrERKNS1_20GIMatchTableExecutor12MatcherStateE 9004 10736 1732
__ZNK12_GLOBAL__N_132AArch64PostLegalizerCombinerImpl15runCustomActionEjRKN4llvm20GIMatchTableExecutor12MatcherStateERNS1_11SmallVectorINS1_19MachineInstrBuilderELj4EEE 3720 6948 3228
__ZNK12_GLOBAL__N_129RISCVPreLegalizerCombinerImpl15runCustomActionEjRKN4llvm20GIMatchTableExecutor12MatcherStateERNS1_11SmallVectorINS1_19MachineInstrBuilderELj4EEE 4296 7624 3328
__ZNK12_GLOBAL__N_130AMDGPUPreLegalizerCombinerImpl15runCustomActionEjRKN4llvm20GIMatchTableExecutor12MatcherStateERNS1_11SmallVectorINS1_19MachineInstrBuilderELj4EEE 4424 7760 3336
__ZNK12_GLOBAL__N_131AMDGPUPostLegalizerCombinerImpl15runCustomActionEjRKN4llvm20GIMatchTableExecutor12MatcherStateERNS1_11SmallVectorINS1_19MachineInstrBuilderELj4EEE 4812 8248 3436
__ZNK12_GLOBAL__N_131AArch64PreLegalizerCombinerImpl15runCustomActionEjRKN4llvm20GIMatchTableExecutor12MatcherStateERNS1_11SmallVectorINS1_19MachineInstrBuilderELj4EEE 4676 8328 3652
```
demangled:
```
(anonymous namespace)::AMDGPURegBankCombinerImpl::runCustomAction(unsigned int, llvm::GIMatchTableExecutor::MatcherState const&, llvm::SmallVector<llvm::MachineInstrBuilder, 4u>&) const 940 1824 884
(anonymous namespace)::RISCVPreLegalizerCombinerImpl::testMIPredicate_MI(unsigned int, llvm::MachineInstr const&, llvm::GIMatchTableExecutor::MatcherState const&) const 8376 9552 1176
(anonymous namespace)::AArch64PostLegalizerLoweringImpl::runCustomAction(unsigned int, llvm::GIMatchTableExecutor::MatcherState const&, llvm::SmallVector<llvm::MachineInstrBuilder, 4u>&) const 7712 8996 1284
(anonymous namespace)::Demangler::parseLName(llvm::itanium_demangle::OutputBuffer*, std::__1::basic_string_view<char, std::__1::char_traits<char>>&, unsigned long) 46275648 46277264 1616
(anonymous namespace)::AMDGPUPreLegalizerCombinerImpl::testMIPredicate_MI(unsigned int, llvm::MachineInstr const&, llvm::GIMatchTableExecutor::MatcherState const&) const 8500 10168 1668
(anonymous namespace)::AArch64PreLegalizerCombinerImpl::testMIPredicate_MI(unsigned int, llvm::MachineInstr const&, llvm::GIMatchTableExecutor::MatcherState const&) const 8708 10416 1708
(anonymous namespace)::AMDGPUPostLegalizerCombinerImpl::testMIPredicate_MI(unsigned int, llvm::MachineInstr const&, llvm::GIMatchTableExecutor::MatcherState const&) const 9004 10736 1732
(anonymous namespace)::AArch64PostLegalizerCombinerImpl::runCustomAction(unsigned int, llvm::GIMatchTableExecutor::MatcherState const&, llvm::SmallVector<llvm::MachineInstrBuilder, 4u>&) const 3720 6948 3228
(anonymous namespace)::RISCVPreLegalizerCombinerImpl::runCustomAction(unsigned int, llvm::GIMatchTableExecutor::MatcherState const&, llvm::SmallVector<llvm::MachineInstrBuilder, 4u>&) const 4296 7624 3328
(anonymous namespace)::AMDGPUPreLegalizerCombinerImpl::runCustomAction(unsigned int, llvm::GIMatchTableExecutor::MatcherState const&, llvm::SmallVector<llvm::MachineInstrBuilder, 4u>&) const 4424 7760 3336
(anonymous namespace)::AMDGPUPostLegalizerCombinerImpl::runCustomAction(unsigned int, llvm::GIMatchTableExecutor::MatcherState const&, llvm::SmallVector<llvm::MachineInstrBuilder, 4u>&) const 4812 8248 3436
(anonymous namespace)::AArch64PreLegalizerCombinerImpl::runCustomAction(unsigned int, llvm::GIMatchTableExecutor::MatcherState const&, llvm::SmallVector<llvm::MachineInstrBuilder, 4u>&) const 4676 8328 3652
```

I'm not sure what happened here, my guess this is all overeager inlining related.

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


More information about the llvm-commits mailing list