Page MenuHomePhabricator

[CodeGenPrepare] Don't call getSubtargetImpl quite as often
AcceptedPublic

Authored by loladiro on Nov 1 2015, 9:57 PM.

Details

Reviewers
echristo
arsenm
Summary

While profiling LLVM's memory allocation, I noticed that getSubtargetImpl was called quite often (and it allocates heap memory by doing string operations). This simple change to cache the TargetLowering/TargetRegisterInfo in CodeGenPrepare reduces the total number of allocations in my test compile by about 3%

Diff Detail

Repository
rL LLVM

Event Timeline

loladiro updated this revision to Diff 38869.Nov 1 2015, 9:57 PM
loladiro retitled this revision from to [CodeGenPrepare] Don't call getSubtargetImpl quite as often .
loladiro updated this object.
loladiro set the repository for this revision to rL LLVM.
loladiro added a subscriber: llvm-commits.
arsenm accepted this revision.Nov 1 2015, 10:05 PM
arsenm added a reviewer: arsenm.
arsenm added a subscriber: arsenm.

LGTM

This revision is now accepted and ready to land.Nov 1 2015, 10:05 PM

+echristo, who did a bunch of this subtarget stuff, in case he has some
extra insight (and/or just so he knows in case other similar things come up)

echristo accepted this revision.Nov 9 2015, 2:39 PM
echristo added a reviewer: echristo.
echristo added a subscriber: echristo.

LGTM. Thanks!

-eric

Alternately, btw, you can just cache the STI in the pass as well btw. Either works for me.

-eric

Looks like patch was not committed.

ping to commit this?

Herald added a project: Restricted Project. · View Herald TranscriptJan 20 2020, 2:23 PM
Herald added a subscriber: wdng. · View Herald Transcript

Still looks good to me.