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

Joerg Sonnenberger via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Nov 27 15:47:50 PST 2016


joerg added a comment.

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.


https://reviews.llvm.org/D27145





More information about the llvm-commits mailing list