This is an archive of the discontinued LLVM Phabricator instance.

[StackProtector] Speed up RequiresStackProtector
ClosedPublic

Authored by nadav on Jul 26 2020, 11:30 PM.

Details

Summary

Speed up the method RequiresStackProtector by checking the intrinsic
value of the call. The original code calls getName() that returns an
allocating std::string on each check. This change removes about 96072 std::string
instances when compiling sqlite3.c; The function was discovered with a
Facebook-internal performance tool.

Diff Detail

Event Timeline

nadav created this revision.Jul 26 2020, 11:30 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 26 2020, 11:30 PM
craig.topper added inline comments.
llvm/lib/CodeGen/StackProtector.cpp
257

Can this just be CI->getIntrinsicID() == Intrinsic::stackprotector?

nadav updated this revision to Diff 280924.Jul 27 2020, 8:15 AM

@craig.topper Good catch. Thank you. I've updated the diff.

nadav edited the summary of this revision. (Show Details)Jul 27 2020, 8:17 AM
nadav updated this revision to Diff 280940.Jul 27 2020, 9:09 AM
This revision is now accepted and ready to land.Jul 27 2020, 9:36 AM
This revision was automatically updated to reflect the committed changes.