This is an archive of the discontinued LLVM Phabricator instance.

[clang] Speedup LineOffsetMapping::get
ClosedPublic

Authored by serge-sans-paille on Nov 21 2022, 10:24 PM.

Details

Summary

LineOffsetMapping::get is a critical function that consistently appears
in the top 5 more computation intensive functions when running the
preprocessor.

This change brings consistent speedup of ~.5% on, preprocessing time,
see

https://llvm-compile-time-tracker.com/compare.php?from=0745b0c0354a0c8e1fefb68a3876d15db6c2e27a&to=460f3f04dac025e6952d78fce104a88151508a29&stat=instructions:u

for detailed statistics.

Diff Detail

Event Timeline

Herald added a project: Restricted Project. · View Herald TranscriptNov 21 2022, 10:24 PM
serge-sans-paille requested review of this revision.Nov 21 2022, 10:24 PM
Herald added a project: Restricted Project. · View Herald TranscriptNov 21 2022, 10:24 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
aaron.ballman accepted this revision.Nov 29 2022, 9:13 AM

LGTM, thank you!

This revision is now accepted and ready to land.Nov 29 2022, 9:13 AM
This revision was automatically updated to reflect the committed changes.
error: comparison of integers of different signs: 'long' and 'unsigned long' [-Werror,-Wsign-compare]
 if (End - Start > sizeof(Word)) {
clang/lib/Basic/SourceManager.cpp
1292

Sorry for being late. This comparison has issues.

dyung added a subscriber: dyung.Dec 2 2022, 10:06 PM

@serge-sans-paille, one of our internal tests hit an assertion failure which I bisected back to your change. I have filed issue 59321 with a repro. Can you take a look?