[PATCH] Move easily derivable pointers optimization from CodeGenPrepare to RewriteStatepointPass
Igor Laevsky
igor at azulsystems.com
Thu May 14 09:59:31 PDT 2015
Hi reames, sanjoy, pgavlin, AndyAyers,
In CodeGen prepare we have optimization which re-creates some derived pointers instead of using gc.relocates for them. I.e if we had following code:
```
%derived = gep %base, 15
safepoint(base, derived)
%base.rel = gc.relocate(%base)
%derived.rel = gc.relocate(%derived)
```
It transforms it into:
```
%derived = gep %base, 15
safepoint(base, derived)
%base.rel = gc.relocate(%base)
%derived.rel = gep %base.rel, 15
```
This is profitable for pointers which are cheaply computed from their bases.
In this changeset I am moving this optimization from CodeGenPrepare into RewriteSafepointPass. Basic motivation here is that by doing it before gc.relocate insertion we can catch substantially more cases. For example if pointer is located inside a loop with statepoint.
Also I am extending it to happen not only on geps with small constant indices, but on all geps and noop casts.
REPOSITORY
rL LLVM
http://reviews.llvm.org/D9774
Files:
lib/CodeGen/CodeGenPrepare.cpp
lib/Transforms/Scalar/RewriteStatepointsForGC.cpp
test/Transforms/CodeGenPrepare/statepoint-relocate.ll
test/Transforms/RewriteStatepointsForGC/basics.ll
test/Transforms/RewriteStatepointsForGC/liveness-basics.ll
test/Transforms/RewriteStatepointsForGC/relocation.ll
test/Transforms/RewriteStatepointsForGC/rematerialize-derived-pointers.ll
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D9774.25781.patch
Type: text/x-patch
Size: 37282 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150514/d437ec7c/attachment.bin>
More information about the llvm-commits
mailing list