This is an archive of the discontinued LLVM Phabricator instance.

[clang] Optimize SourceManager::getFileIDLocal [WIP]
AbandonedPublic

Authored by melver on May 22 2020, 4:15 AM.

Details

Reviewers
None
Summary
  • Avoid bit operations to compute Offset by removing bitfields. On 64-bit architectures, SLocEntry's size is unchanged!
  • Move fast-path assignment of LessIndex up, to avoid potential spill.
  • Provide branch-prediction hints to compiler to generate better code.

Tested:

  • Default compiler: clang-9

TDB

Diff Detail

Event Timeline

melver created this revision.May 22 2020, 4:15 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 22 2020, 4:15 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
melver updated this revision to Diff 265717.May 22 2020, 5:51 AM

Extra unlikely hint.

melver retitled this revision from [clang] Optimize getFileIDLocal to [clang] Optimize getFileIDLocal [WIP].May 22 2020, 5:55 AM
melver updated this revision to Diff 265780.May 22 2020, 11:55 AM
melver retitled this revision from [clang] Optimize getFileIDLocal [WIP] to [clang] Optimize SourceManager::getFileIDLocal [WIP].
melver edited the summary of this revision. (Show Details)

Improve code-gen further -- another ~5%.

melver abandoned this revision.May 26 2020, 3:18 AM

More background: https://github.com/ClangBuiltLinux/linux/issues/1032

This approach likely doesn't yield too much benefit. Too much variability is observed when compiling Clang with either Clang or GCC.

Since Nick has a better proposal at the above link, let's abandon this.