This is an archive of the discontinued LLVM Phabricator instance.

[scudo] Minor code generation improvement
ClosedPublic

Authored by cryptoad on Dec 7 2017, 11:32 AM.

Details

Summary

It looks like clang was generating somewhat weird assembly with the current
code. FromPrimary, even though const, was replaced every time with the code
generated for size <= SizeClassMap::kMaxSize instead of using a variable or
register, and FromPrimary didn't induce ClassId != 0 for the compiler, so a
dead branch was generated for getActuallyAllocatedSize(Ptr, ClassId) since
it's never called for ClassId = 0 (Secondary backed allocations) [this one
was more wishful thinking on my side than anything else].

I rearranged the code bit so that the generated assembly is less clunky.

Also changed 2 whitespace inconsistencies that were bothering me.

Diff Detail

Event Timeline

cryptoad created this revision.Dec 7 2017, 11:32 AM
Herald added a subscriber: Restricted Project. · View Herald TranscriptDec 7 2017, 11:32 AM
flowerhack accepted this revision.Dec 7 2017, 12:51 PM
This revision is now accepted and ready to land.Dec 7 2017, 12:51 PM
cryptoad edited the summary of this revision. (Show Details)Dec 7 2017, 3:31 PM
This revision was automatically updated to reflect the committed changes.