[PATCH] D27145: Add "RPRED" mechanism for relocation predicates. (5% speedup for `ld.lld -O0`)

Sean Silva via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Nov 27 15:59:25 PST 2016


silvas added a comment.

In https://reviews.llvm.org/D27145#606254, @joerg wrote:

> You can build the preciate functions with a constexpr helper? E.g.
>
>   static bool refersToGotEntry(RelExpr Expr) {
>     if (uint64_t(Expr) > 63)
>       return false;
>     return (uint64_t(1) << Expr) & buildMask({R_GOT, R_GOT_OFF, ...});
>   }
>
>
> where buildMask computes `(uint64_t(1) << R_GOT) | (uint64_t(1) << R_GOT_OFF) | ...` via constexpr.
>
> I don't think precomputing the shift and passing that around is much help -- it's a single cheap assembler instruction without any memory access. It can also be trivially CSEed. The first check can likely be replaced by an assert, assuming input is sanitzed already here.


Oh, nice. Sorry, I misunderstood what you meant. That sounds really nice actually.


https://reviews.llvm.org/D27145





More information about the llvm-commits mailing list