This is an archive of the discontinued LLVM Phabricator instance.

[PreISelIntrinsicLowering] Use TLI for correct function
ClosedPublic

Authored by nikic on Aug 14 2023, 2:48 AM.

Details

Summary

We should query the subtarget of the calling function, not of the intrinsic.

This probably makes no functional difference (as libcalls are unlikely to vary across subtargets), but fixes minor compile-time regressions from unnecessary subtarget instantiations.

Followup to D157567.

Diff Detail

Event Timeline

nikic created this revision.Aug 14 2023, 2:48 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 14 2023, 2:48 AM
nikic requested review of this revision.Aug 14 2023, 2:48 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 14 2023, 2:48 AM
arsenm accepted this revision.Aug 14 2023, 7:56 AM

I would assume looking up the subtarget per-use is worse for compile time?

This revision is now accepted and ready to land.Aug 14 2023, 7:56 AM

RuntimeLibcalls probably shouldn't belong to the subtarget in the first place

nikic added a comment.Aug 15 2023, 3:44 AM

I would assume looking up the subtarget per-use is worse for compile time?

Looking up the subtarget is cheap if it's already instantiated. Usually all functions have the same features, so there's just the single subtarget. But of course the intrinsics will have different (no) features and will instantiate a separate subtarget. And apparently subtarget instantiation is super expensive.

Doesn't really matter unless you're compiling tiny files, it's just how I happened to notice this.

This revision was landed with ongoing or failed builds.Aug 16 2023, 1:02 AM
This revision was automatically updated to reflect the committed changes.