[RewriteStatepointsForGC] Extend base pointer inference to handle insertelement
authorPhilip Reames <listmail@philipreames.com>
Wed, 9 Sep 2015 23:40:12 +0000 (23:40 +0000)
committerPhilip Reames <listmail@philipreames.com>
Wed, 9 Sep 2015 23:40:12 +0000 (23:40 +0000)
commitb04fde370896a848d1e0de2489fe7d05f4226b4e
tree676f6df7047e514abb5fc6582913e5b76f2771f8
parentb4f6a50926a9b2c684594f1ec4366cae09a82976
[RewriteStatepointsForGC] Extend base pointer inference to handle insertelement

This change is simply enhancing the existing inference algorithm to handle insertelement instructions by conservatively inserting a new instruction to propagate the vector of associated base pointers. In the process, I'm ripping out the peephole optimizations which mostly helped cover the fact this hadn't been done.

Note that most of the newly inserted nodes will be nearly immediately removed by the post insertion optimization pass introduced in 246718. Arguably, we should be trying harder to avoid the malloc traffic here, but I'd rather get the code correct, then worry about compile time.

Unlike previous extensions of the algorithm to handle more case, I discovered the existing code was causing miscompiles in some cases. In particular, we had an implicit assumption that the peephole covered *all* insert element instructions, so if we had a value directly based on a insert element the peephole didn't cover, we proceeded as if it were a base anyways. Not good. I believe we had the same issue with shufflevector which is why I adjusted the predicate for them as well.

Differential Revision: http://reviews.llvm.org/D12583

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247210 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Scalar/RewriteStatepointsForGC.cpp
test/Transforms/RewriteStatepointsForGC/base-vector.ll