[rs4gc] avoid insert base computation instructions for deopt uses
authorPhilip Reames <listmail@philipreames.com>
Fri, 5 Mar 2021 17:55:36 +0000 (09:55 -0800)
committerPhilip Reames <listmail@philipreames.com>
Fri, 5 Mar 2021 17:55:36 +0000 (09:55 -0800)
commit99f93dd3a502568441da3db04ddf0655a2e38c24
tree01d634eb387c2c34d33ba1cc087bbebb02b0cddd
parent2b50ce152417286e0091a1683482457473d4d7a8
[rs4gc] avoid insert base computation instructions for deopt uses

If we have a value live over a call which is used for deopt at the call, we know that the value must be a base pointer. We can avoid potentially inserting IR to materialize a base for this value.

In it's current form, this is mostly a compile time optimization.   Building the base pointer graph (and then optimizing it away again) is a relatively expensive operation.  We also sometimes end up with better codegen in practice - due to failures in optimizing away the inserted base pointer propogation - but those are optimization bugs we're fixing concurrently.

The alternative to this would be to extend the base pointer inference with the ability to generally reuse multiple-base input instructions (phis and selects).  That's somewhat invasive and complicated, so we're defering it a bit longer.

Differential Revision: https://reviews.llvm.org/D97885
llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp
llvm/test/Transforms/RewriteStatepointsForGC/base-pointers.ll
llvm/test/Transforms/RewriteStatepointsForGC/scalar-base-vector.ll