This is an archive of the discontinued LLVM Phabricator instance.

Cache memory buffer's name length
ClosedPublic

Authored by serge-sans-paille on Nov 23 2022, 2:01 AM.

Details

Summary

This avoids repeated calls to strlen while we already know its value.

When preprocessing sqlite3.c, this gives a surprising 2% speedup.

Full benchmark available here: https://llvm-compile-time-tracker.com/compare.php?from=5279e6a7d677cdf4488883b77aacab911318100c&to=389601b0dbdf23cf25167ddfc49b3af5742ebd9a&stat=instructions:u

Diff Detail

Event Timeline

Herald added a project: Restricted Project. · View Herald TranscriptNov 23 2022, 2:01 AM
Herald added a subscriber: hiraditya. · View Herald Transcript
serge-sans-paille requested review of this revision.Nov 23 2022, 2:01 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 23 2022, 2:01 AM
labath accepted this revision.Nov 29 2022, 2:17 AM
This revision is now accepted and ready to land.Nov 29 2022, 2:17 AM
This revision was landed with ongoing or failed builds.Nov 29 2022, 5:01 AM
This revision was automatically updated to reflect the committed changes.
fhahn added a subscriber: fhahn.Nov 29 2022, 5:23 AM

Unfortunately it looks like this commit triggers an assertion when building Clang on macOS. I reverted the commit for now with more details about the crash in the commit message.

also breaks amdgpu hip and openmp buildbots

thakis added a subscriber: thakis.Nov 29 2022, 5:30 AM

Thanks for the quick revert!

Should be very easy to repro by just building clang, or llvm-mt, or any target that depends on anything tablegen'd on any platform (linux: http://45.33.8.238/linux/92677/step_4.txt win: http://45.33.8.238/win/70883/step_4.txt)