[PATCH] D28417: [scudo] Separate hardware CRC32 routines

Michał Górny via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 9 13:57:46 PST 2017


mgorny accepted this revision.
mgorny added a comment.
This revision is now accepted and ready to land.

Well, I've tested it and it seems to work for me. I think it's good enough to go as-is.

For a potential future improvement, this is how I'd do it:

1. Make the external file purely `computeHardwareCRC32()`,
2. Create an inline function in allocator that has the conditionals and calls `computeHardwareCRC32` or `computeSoftwareCRC32` appropriately.

This way, the hardware file is used only when hardware is selected, and the inline function can be inlined to avoid extra recurrence.

Furthermore, I would consider just skipping the runtime detection and using hardware code if `__SSE4_2__` is defined in allocator, i.e. `-march=` used to build compiler-rt already enables SSE4.2. In this case random bits of code may require SSE4.2 already, so there's no point in excluding the CRC32.


https://reviews.llvm.org/D28417





More information about the llvm-commits mailing list