This is an archive of the discontinued LLVM Phabricator instance.

[Target] Cache the command line derived feature map in TargetOptions.
ClosedPublic

Authored by craig.topper on Aug 11 2020, 9:45 PM.

Details

Summary

We can use this to remove some calls to initFeatureMap from Sema
and CodeGen when a function doesn't have a target attribute.

Diff Detail

Event Timeline

craig.topper created this revision.Aug 11 2020, 9:45 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 11 2020, 9:45 PM
craig.topper requested review of this revision.Aug 11 2020, 9:45 PM
nickdesaulniers accepted this revision.Aug 12 2020, 10:27 AM

LGTM; comparing the report at the bottom of https://reviews.llvm.org/D85257#2197114, repasted (before this patch):

+    3.59%  clang-12                   [.] llvm::X86::getImpliedFeatures
-    3.36%  clang-12                   [.] llvm::StringMapImpl::LookupBucketFor
   - 3.32% llvm::StringMapImpl::LookupBucketFor
      - 1.24% llvm::StringMap<bool, llvm::MallocAllocator>::try_emplace<>
         + 1.24% clang::targets::X86TargetInfo::setFeatureEnabled
Elapsed (wall clock) time (h:mm:ss or m:ss): 0:53.39

(After this patch):
A profile of a full x86_64 build with this applied, none of the above appear in the profile. clang::targets::X86TargetInfo::setFeatureEnabled, does but near at the bottom with < 0.00%. So this shaves another ~5% off build times!

Elapsed (wall clock) time (h:mm:ss or m:ss): 0:50.98
This revision is now accepted and ready to land.Aug 12 2020, 10:27 AM
This revision was landed with ongoing or failed builds.Aug 12 2020, 12:39 PM
This revision was automatically updated to reflect the committed changes.