Page MenuHomePhabricator

[CodeGenPrepare] Don't call getSubtargetImpl quite as often
Needs ReviewPublic

Authored by loladiro on Nov 1 2015, 9:57 PM.
This revision needs review, but all reviewers have resigned.



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


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.


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!


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


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.

arsenm resigned from this revision.Jun 2 2020, 10:33 AM

Patch looks obsolete

echristo resigned from this revision.Jun 2 2020, 1:24 PM
This revision now requires review to proceed.Jun 2 2020, 1:24 PM