[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)
commit6628713f4f83c41dd910aec817f17370d8b2a6bd
tree12fcbe92f41493a5cc02f1997526f9236d7afcd0
parent6380a28248f8b1a86f08a505027285c5dcc45b45
[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

llvm-svn: 247210
llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp
llvm/test/Transforms/RewriteStatepointsForGC/base-vector.ll