[AMDGPU] Add GlobalDCE before internalization pass
authorYaxun (Sam) Liu <yaxun.liu@amd.com>
Wed, 17 Mar 2021 14:31:06 +0000 (14:31 +0000)
committerYaxun (Sam) Liu <yaxun.liu@amd.com>
Sat, 17 Apr 2021 15:25:25 +0000 (11:25 -0400)
commit3597f02fd5c62f7c49c71b92e467128ffe2cf9cd
treedba042cf868092216c38477b501ed7ce6bcac948
parentae2da68da62653eddc72084990ef75d39287cefd
[AMDGPU] Add GlobalDCE before internalization pass

The internalization pass only internalizes global variables
with no users. If the global variable has some dead user,
the internalization pass will not internalize it.

To be able to internalize global variables with dead
users, a global dce pass is needed before the
internalization pass.

This patch adds that.

Reviewed by: Artem Belevich, Matt Arsenault

Differential Revision: https://reviews.llvm.org/D98783
clang/test/CodeGenCUDA/unused-global-var.cu [new file with mode: 0644]
llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp