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

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Nov 27 09:31:29 PST 2016


ruiu added a comment.

It is a legitimate concern that the new code is harder to read, especially when compared to the original simple-minded one.

I wonder if a table lookup will work here. A RelExpr is a small integer, so we can do something like this

  static bool refersToGotEntry(RelExpr Expr) {
    return RefersToGotEntry[static_cast<int>(Expr)];
  }

where RefersToGotEntry is defined as

  bool RefersToGotEntry[R_MAX] = {
    .R_GOT = true, .R_GOT_OFF = true, .R_MIPS_GOT_LOCAL_PAGE = true, ...
  }


https://reviews.llvm.org/D27145





More information about the llvm-commits mailing list