This is an archive of the discontinued LLVM Phabricator instance.

[sanitizer] Minor refactor of ThreadDescriptorSize
ClosedPublic

Authored by cryptoad on Apr 17 2018, 8:49 AM.

Details

Summary

While I was sifting through dead code findings, I stumbled on this function.

First, for __s390__ it always returned 0 for the 1st call, which doesn't seem
right. 2nd call & beyond would return the correct value though.
Then it duplicated the atomic_store multiple times, sometimes with a if,
sometimes without. Finally it used a capitalized variable name starting with k
which indicates a constant, and it is not.

So:

  • rename the static global variable;
  • change the atomic functions to their relaxed version;
  • move the store to the end, and make sure we return val all the time.

Diff Detail

Event Timeline

cryptoad created this revision.Apr 17 2018, 8:49 AM
Herald added subscribers: Restricted Project, delcypher, kubamracek. · View Herald TranscriptApr 17 2018, 8:49 AM
alekseyshl accepted this revision.Apr 17 2018, 9:22 AM
This revision is now accepted and ready to land.Apr 17 2018, 9:22 AM
This revision was automatically updated to reflect the committed changes.