[Statepoints][ISEL] gc.relocate uniquification should be based on SDValue, not IR...
authorDenis Antrushin <dantrushin@gmail.com>
Tue, 15 Sep 2020 14:10:07 +0000 (21:10 +0700)
committerDenis Antrushin <dantrushin@gmail.com>
Mon, 21 Sep 2020 12:44:46 +0000 (19:44 +0700)
commitee86688b81751c57ca5b24e462194ea5522345c4
tree46a481a6aaa0fed911e7287e4d1b7cd0975c3563
parent4fc0214a10140fa77449677e8094ea22d3d17701
[Statepoints][ISEL] gc.relocate uniquification should be based on SDValue, not IR Value.

When exporting statepoint results to virtual registers we try to avoid
generating exports for duplicated inputs. But we erroneously use
IR Value* to check if inputs are duplicated. Instead, we should use
SDValue, because even different IR values can get lowered to the same
SDValue.
I'm adding a (degenerate) test case which emphasizes importance of this
feature for invoke statepoints.
If we fail to export only unique values we will end up with something
like that:

  %0 = STATEPOINT
  %1 = COPY %0

landing_pad:
  <use of %1>

And when exceptional path is taken, %1 is left uninitialized (COPY is never
execute).

Reviewed By: reames

Differential Revision: https://reviews.llvm.org/D87695
llvm/lib/CodeGen/SelectionDAG/StatepointLowering.cpp
llvm/test/CodeGen/X86/statepoint-vreg-details.ll