This is an archive of the discontinued LLVM Phabricator instance.

[CodeGenPrepare] Hoist all getSubtargetImpl calls to the beginning of the pass
ClosedPublic

Authored by igor-laevsky on Feb 2 2017, 7:59 AM.

Details

Summary

Calls to the getSubtargetImpl on X86 tend to have non trivial execution cost. Usually it's negligible but it becomes noticeable when we try to request subtarget from the frequently executed methods, i.e like optimizeMemoryInst. This change saves subtarget, target lowering and target register info at the beginning of the pass and reuses this values during pass execution.

On one of our internal benchmarks this change reduces time spent in the llc by ~20%.

Diff Detail

Repository
rL LLVM

Event Timeline

igor-laevsky created this revision.Feb 2 2017, 7:59 AM
echristo accepted this revision.Feb 2 2017, 11:23 AM

LGTM.

Thanks!

-eric

This revision is now accepted and ready to land.Feb 2 2017, 11:23 AM
This revision was automatically updated to reflect the committed changes.