[gvn] CSE gc.relocates based on meaning, not spelling
authorPhilip Reames <listmail@philipreames.com>
Fri, 5 Mar 2021 18:16:12 +0000 (10:16 -0800)
committerPhilip Reames <listmail@philipreames.com>
Fri, 5 Mar 2021 18:16:12 +0000 (10:16 -0800)
commit51b13a7ea0b9123a405a51241763ed388d68a46f
tree66934e97193b6d2007a1d1f80d001f6de6259580
parentf352463ade6e49c3b0275f296d9190d828b7630b
[gvn] CSE gc.relocates based on meaning, not spelling

The last two operands to a gc.relocate represent indices into the associated gc.statepoint's gc bundle list. (Effectively, gc.relocates are projections from the gc.statepoints multiple return values.)

We can use this to recognize when two gc.relocates are equivalent (and can be CSEd), even when the indices are non-equal. This is particular useful when considering a chain of multiple statepoints as it lets us eliminate all duplicate gc.relocates in a single pass.

Differential Revision: https://reviews.llvm.org/D97974

(Note: Part of the reviewed change was split and landed as f352463a)
llvm/lib/Transforms/Scalar/GVN.cpp
llvm/test/Transforms/GVN/gc_relocate.ll