[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 04:39:44 PST 2016


silvas added a comment.

Joerg, that transformation is interesting (and Hans' new switch lowering has something like that). However, I don't think we should assume that compilers implement that, nor that we can rely on it to generate code as good as the one with this RPRED mechanism.

One issue that I see with that transformation is that it is not a form of canonizalization and so won't kick in until later (or in the extreme case like Hans' switch lowering, in the backend).
So there is a phase ordering issue because, for example, JumpThreading would like to see the single combined expression in order for needsPlt or refersToGotEntry to get properly jump-threaded in the hot relocation loop.
Even worse, profile-guided branch reordering could easily mangle these expressions, causing them to not CSE appropriately (again, the hot relocation loop has precisely this situation; e.g. needsPlt and refersToGotEntry are duplicated).

With this RPRED mechanism we can get reliable results from any compiler.


https://reviews.llvm.org/D27145





More information about the llvm-commits mailing list