[AMDGPU] Fix isReallyTriviallyReMaterializable for V_MOV_*
authorJay Foad <jay.foad@amd.com>
Wed, 10 Mar 2021 13:53:07 +0000 (13:53 +0000)
committerJay Foad <jay.foad@amd.com>
Wed, 10 Mar 2021 16:18:12 +0000 (16:18 +0000)
commit70f013fd3b48087e793be7dc8fd79820556876e5
tree0324935ed17aa4c61625cc0531aece75c3fd0c4b
parente64f3ccca3c2d4cb122a8db3d22e0d885286ea16
[AMDGPU] Fix isReallyTriviallyReMaterializable for V_MOV_*

D57708 changed SIInstrInfo::isReallyTriviallyReMaterializable to reject
V_MOVs with extra implicit operands, but it accidentally rejected all
V_MOVs because of their implicit use of exec. Fix it but avoid adding a
moderately expensive call to MI.getDesc().getNumImplicitUses().

In real graphics shaders this changes quite a few vgpr copies into move-
immediates, which is good for avoiding stalls on GFX10.

Differential Revision: https://reviews.llvm.org/D98347
llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
llvm/test/CodeGen/AMDGPU/vgpr-remat.mir [new file with mode: 0644]