This is an archive of the discontinued LLVM Phabricator instance.

[MSAN] Pass Origin by parameter to __msan_warning functions
ClosedPublic

Authored by guiand on Jun 11 2020, 5:07 PM.

Details

Summary

Normally, the Origin is passed over TLS, which seems like it introduces unnecessary overhead. It's in the (extremely) cold path though, so the only overhead is in code size.

But with eager-checks, calls to __msan_warning functions are extremely common, so this becomes a useful optimization.

This can save ~5% code size.

Diff Detail

Event Timeline

guiand created this revision.Jun 11 2020, 5:07 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptJun 11 2020, 5:07 PM
Herald added subscribers: llvm-commits, Restricted Project, hiraditya. · View Herald Transcript
eugenis added inline comments.Jun 11 2020, 5:17 PM
llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
786

This is an unconditional improvement, simply apply it in all cases. Keep __msan_warning_noreturn in the runtime library for backwards compatibility, but never issue a call to it in the instrumentation. Update the tests in test/Instrumentation/MemorySanitizer.

guiand updated this revision to Diff 270281.Jun 11 2020, 6:45 PM
guiand retitled this revision from [MSAN] Under eager-checks, pass Origin by parameter to __msan_warning functions to [MSAN] Pass Origin by parameter to __msan_warning functions.

Removed dependency on eager-checks, and updated the tests

eugenis accepted this revision.Jun 12 2020, 9:35 AM

LGTM

This revision is now accepted and ready to land.Jun 12 2020, 9:35 AM
vitalybuka accepted this revision.Jun 12 2020, 6:17 PM
This revision was automatically updated to reflect the committed changes.