[PATCH] D22599: GVN-hoist: improve code generation for recursive GEPs
Sebastian Pop via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 20 14:50:15 PDT 2016
sebpop created this revision.
sebpop added reviewers: majnemer, dberlin.
sebpop added subscribers: hiraditya, llvm-commits.
sebpop set the repository for this revision to rL LLVM.
When loading or storing in a field of a struct like "a.b.c", GVN is able to detect the equivalent expressions, and GVN-hoist would fail in the code generation.
This is because the GEPs are not hoisted as scalar operations to avoid moving the GEPs too far from their ld/st instruction when the ld/st is not movable.
So we end up having to generate code for the GEP of a ld/st when we move the ld/st.
In the case of a GEP referring to another GEP as in "a.b.c" we need to code generate all the GEPs necessary to make all the operands available at the new location for the ld/st.
With this patch we recursively walk through the GEP operands checking whether all operands are available, and in the case of a GEP operand, it recursively makes all its operands available. Code generation happens from the inner GEPs out until reaching the GEP that appears as an operand of the ld/st.
Tested on x86_64-linux with clang/libc++ bootstrap binary comparing stages 2 and 3, make check-all, test-suite, and cpu2006.
Ok to commit?
Repository:
rL LLVM
https://reviews.llvm.org/D22599
Files:
llvm/lib/Transforms/Scalar/GVNHoist.cpp
llvm/test/Transforms/GVN/hoist-recursive-geps.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D22599.64763.patch
Type: text/x-patch
Size: 7337 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160720/42f552c4/attachment.bin>
More information about the llvm-commits
mailing list