[all-commits] [llvm/llvm-project] 922331: [DeviceRTL] Allow IsSPMDMode to be optimized out i...

Joseph Huber via All-commits all-commits at lists.llvm.org
Wed Oct 5 12:40:21 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 92233159035d1b50face95d886901cf99035bd99
      https://github.com/llvm/llvm-project/commit/92233159035d1b50face95d886901cf99035bd99
  Author: Joseph Huber <jhuber6 at vols.utk.edu>
  Date:   2022-10-05 (Wed, 05 Oct 2022)

  Changed paths:
    M openmp/libomptarget/DeviceRTL/CMakeLists.txt
    M openmp/libomptarget/DeviceRTL/include/Types.h
    M openmp/libomptarget/DeviceRTL/src/Mapping.cpp
    M openmp/libomptarget/DeviceRTL/src/Utils.cpp
    M openmp/libomptarget/DeviceRTL/src/exports

  Log Message:
  -----------
  [DeviceRTL] Allow IsSPMDMode to be optimized out in LTO mode

A previous patch merged the static and bitcode versions of the
deviceRTL. We previously used the static library's separate compilation
to set a special flag that prevented `IsSPMDMode` from being put in the
used list and preventing it from being optimized out. When they were
merged we could no longer do this separate compilation that allowed
users of LTO to get more optimal code.

This patch rearranges the code. The `IsSPMDMode` global is now
transitively used by its inclusion in the changed `__keep_alive`
function. This allows us to then manually delete the `__keep_alive`
function from the module when building the static library via
`llvm-extract`. The result is that the bitcode library correctly will
maintain the needed shared state, while the static library will be able
to internalize it and optimize it out.

Reviewed By: jdoerfert

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




More information about the All-commits mailing list