[all-commits] [llvm/llvm-project] 3597f0: [AMDGPU] Add GlobalDCE before internalization pass

Yaxun (Sam) Liu via All-commits all-commits at lists.llvm.org
Sat Apr 17 08:26:05 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 3597f02fd5c62f7c49c71b92e467128ffe2cf9cd
      https://github.com/llvm/llvm-project/commit/3597f02fd5c62f7c49c71b92e467128ffe2cf9cd
  Author: Yaxun (Sam) Liu <yaxun.liu at amd.com>
  Date:   2021-04-17 (Sat, 17 Apr 2021)

  Changed paths:
    A clang/test/CodeGenCUDA/unused-global-var.cu
    M llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp

  Log Message:
  -----------
  [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


  Commit: d5c0f00e216aa6797499bb4c8aacac930d8a819b
      https://github.com/llvm/llvm-project/commit/d5c0f00e216aa6797499bb4c8aacac930d8a819b
  Author: Yaxun (Sam) Liu <yaxun.liu at amd.com>
  Date:   2021-04-17 (Sat, 17 Apr 2021)

  Changed paths:
    M clang/lib/CodeGen/CGCUDANV.cpp
    A clang/test/CodeGenCUDA/host-used-device-var.cu

  Log Message:
  -----------
  [CUDA][HIP] Mark device var used by host only

Add device variables to llvm.compiler.used if they are
ODR-used by either host or device functions.

This is necessary to prevent them from being
eliminated by whole-program optimization
where the compiler has no way to know a device
variable is used by some host code.

Reviewed by: Artem Belevich

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


Compare: https://github.com/llvm/llvm-project/compare/ae2da68da626...d5c0f00e216a


More information about the All-commits mailing list