This is an archive of the discontinued LLVM Phabricator instance.

[PowerPC] Merge the constant pool on Power PC AIX.
Needs RevisionPublic

Authored by stefanp on Apr 13 2023, 6:30 PM.

Details

Reviewers
nemanjai
lei
amyk
arsenm
RKSimon
Group Reviewers
Restricted Project
Summary

On AIX we currently have one TOC entry for each constant in the constant
pool. This can create an issue in cases where there are a lot of
constants and we fill the TOC with constant pool entries.

This patch will try to merge the constant pool enties on the module
level. A struct will be created with all of the constants in that
module and the base address of that struct will be stored as a gobal
variable. All accesses to the constants in the struct will be done via
the base address of the global struct and and offset.

This pass was added after instruction selection. It was not easy to
decide where to place this pass as it doesn't fit well anywhere in the
piplelne. If this were to be done before instruction selection all
constants that may have been materialized or may have been folded away
in some fashion will be included in a merged constant pool. If this was
to be added as a feature in instruction selection it would be a module
level feature incuded in a basic block level pass.

Diff Detail

Event Timeline

stefanp created this revision.Apr 13 2023, 6:30 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 13 2023, 6:30 PM
stefanp requested review of this revision.Apr 13 2023, 6:30 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 13 2023, 6:30 PM
stefanp added reviewers: Restricted Project, arsenm, RKSimon.Apr 13 2023, 6:32 PM
arsenm added inline comments.May 18 2023, 10:27 AM
llvm/include/llvm/CodeGen/MachineConstantPool.h
22

Prefer llvm set types

152–153

Why use a set at all if it's sorted? Also pass by value?

llvm/lib/Target/PowerPC/PPCMergeConstPoolEntries.cpp
262–267

Seems like a workaround that shouldn't require chaining through all the constant types

298

tuple decompose syntax

329

getTypeStoreSize

356–359

Can merge these into one LLVM_DEBUG block

377–379

Can directly dbgs() << *MI in the first print

arsenm requested changes to this revision.Aug 23 2023, 5:26 PM
This revision now requires changes to proceed.Aug 23 2023, 5:26 PM