[rs4gc] don't duplicate existing values which are provably base pointers
authorPhilip Reames <listmail@philipreames.com>
Tue, 16 Mar 2021 19:47:57 +0000 (12:47 -0700)
committerPhilip Reames <listmail@philipreames.com>
Tue, 16 Mar 2021 19:51:21 +0000 (12:51 -0700)
commit5cabf472cb3c434bbf03889623c09b14f5c62f26
treeb38f019a018a1d73a1d1406c549e7eae112245a5
parent40bc309911f0f92ff8b8f64d28cb13a2292695ff
[rs4gc] don't duplicate existing values which are provably base pointers

RS4GC needs to rewrite the IR to ensure that every relocated pointer has an associated base pointer. The existing code isn't particularly smart about avoiding duplication of existing IR when it turns out the original pointer we were asked to materialize a base pointer for is itself a base pointer.

This patch adds a stage to the algorithm which prunes nodes proven (with a simple forward dataflow fixed point) to be base pointers from the list of nodes considered for duplication. This does require changing some of the later invariants slightly, that's probably the riskiest part of the change.

Differential Revision: D98122
llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp
llvm/test/Transforms/RewriteStatepointsForGC/base-inference.ll
llvm/test/Transforms/RewriteStatepointsForGC/base-pointers-4.ll
llvm/test/Transforms/RewriteStatepointsForGC/base-pointers.ll
llvm/test/Transforms/RewriteStatepointsForGC/base-vector-inseltpoison.ll
llvm/test/Transforms/RewriteStatepointsForGC/base-vector.ll
llvm/test/Transforms/RewriteStatepointsForGC/live-vector-nosplit-inseltpoison.ll
llvm/test/Transforms/RewriteStatepointsForGC/live-vector-nosplit.ll
llvm/test/Transforms/RewriteStatepointsForGC/rematerialize-derived-pointers.ll
llvm/test/Transforms/RewriteStatepointsForGC/scalar-base-vector.ll