[llvm-commits] Code hoisting in GVN

Daniel Berlin dberlin at dberlin.org
Wed Aug 1 12:36:18 PDT 2012


On Tue, Jul 31, 2012 at 6:33 PM, Owen Anderson <resistor at mac.com> wrote:
> Nadav,
>
> I have two high-level comments on this patch:
>
> 1) It seems like it should be possible to avoid n^2 behavior by computing a
> set of hoistable instructions for each successor block, and then
> intersecting them.

Well, if the goal is fast code, you should just do real GVN-PRE. The
equations for GVN based PRE are not N^2.
If the goal is code size, just compute Very Busy Expressions (also not
N^2) and use it to hoist.


> 2) It seems like you should be able to re-use GVN's value numbering
> facilities to accelerate the identicality checks.

The issue in the current GVN is the value numbers don't really help
with memory instructions :(
In the rewritten one, they do.

>
> The way I'd envision this working would be to scan each successor block and
> build a map from value numbers to instructions.  Then you find value numbers
> that are in both maps and clone them into the predecessor.

If you wanted to do it that way, i can send her the current work on
the new GVN pass, which already does this.

We have mappings from both instructions to congruence classes, and
congruence class to <instruction, BB>



More information about the llvm-commits mailing list