[PATCH] D12001: Implement __emutls_get_address

Saleem Abdulrasool via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 28 19:52:07 PDT 2015


compnerd accepted this revision.
compnerd added a reviewer: compnerd.
compnerd added a comment.
This revision is now accepted and ready to land.

LG with the one comment about the growth function.


================
Comment at: compiler-rt/lib/builtins/emutls.c:151
@@ +150,3 @@
+    */
+    return ((index + 1 + 15) & ~((uintptr_t)15)) - 1;
+}
----------------
If you are trying to round up to 16, shouldn't this be more like:

    (index + 16 - 1) & ~(16 - 1)

Which would be ideal as an inline function:

    inline size_t align_up(size_t value, unsigned alignment) {
      return (value + alignment - 1) & ~(size_t)(alignment - 1);
    }


http://reviews.llvm.org/D12001





More information about the llvm-commits mailing list