MachineSink: Fix sinking VGPR def out of a divergent loop
authorMatt Arsenault <Matthew.Arsenault@amd.com>
Fri, 14 Jul 2023 15:05:24 +0000 (11:05 -0400)
committerMatt Arsenault <Matthew.Arsenault@amd.com>
Tue, 18 Jul 2023 10:15:50 +0000 (06:15 -0400)
commit3f8ef57bede94445b1a1042c987cc914a886e7ff
treed9bbfee859f349a0a7ee3b9309e63bfa855fbfc9
parentd5ab379506252f4955c74841f1e12caa97317a57
MachineSink: Fix sinking VGPR def out of a divergent loop

This fixes sinking a VGPR def out of a loop past the reconvergence
point at the SI_END_CF. There was a prior fix which introduced
blockPrologueInterferes (D121277) to fix the same basic problem for
the post RA sink. This also had the special case isIgnorableUse case
which was incorrect, because in some contexts the exec use is not
ignorable.

I'm thinking about a new way to represent this which will avoid
needing hasIgnorableUse and isBasicBlockPrologue, which would function
more like the exception handling.

Fixes: SWDEV-407790

https://reviews.llvm.org/D155343
llvm/lib/CodeGen/MachineSink.cpp
llvm/test/CodeGen/AMDGPU/machine-sink-loop-var-out-of-divergent-loop-swdev407790.ll
llvm/test/CodeGen/AMDGPU/machine-sink-loop-var-out-of-divergent-loop-swdev407790.mir
llvm/test/CodeGen/AMDGPU/sink-after-control-flow.mir