[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
Sat Nov 26 22:04:52 PST 2016


silvas added inline comments.


================
Comment at: ELF/Relocations.def:21-23
+PREDICATE(RPRED_ALWAYS_CONSTANT, 1)
+PREDICATE(RPRED_REFERS_TO_GOT, 2)
+PREDICATE(RPRED_RELAX_MARKER, 3)
----------------
ruiu wrote:
> Are these numbers correct? It seems that
> 
>   PRED_RELAX_MARKER == PRED_ALWAYS_CONSTANT | PRED_REFERS_TO_GOT
> 
> holds, which is odd. Don't you need power-of-twos?
The shifting is done in construction of the enum. Sorry, I should have some comments in this file.
```
enum RelExprPredicate {
#define PREDICATE(Name, PredicateIndex)                                        \
  Name = (1 << (PredicateIndex + NumRelExprIndexBits)),
#include "Relocations.def"
};
```


https://reviews.llvm.org/D27145





More information about the llvm-commits mailing list