[all-commits] [llvm/llvm-project] e8c0ae: [OpenMP] Add optimization to remove the RPC client...

Joseph Huber via All-commits all-commits at lists.llvm.org
Tue Oct 31 15:23:38 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: e8c0ae60d7020dabd6edbf3635080a6f65c60151
      https://github.com/llvm/llvm-project/commit/e8c0ae60d7020dabd6edbf3635080a6f65c60151
  Author: Joseph Huber <jhuber6 at vols.utk.edu>
  Date:   2023-10-31 (Tue, 31 Oct 2023)

  Changed paths:
    M llvm/lib/Transforms/IPO/OpenMPOpt.cpp
    A llvm/test/Transforms/OpenMP/keep_rpc_client.ll
    A llvm/test/Transforms/OpenMP/remove_rpc_client.ll

  Log Message:
  -----------
  [OpenMP] Add optimization to remove the RPC client (#70683)

Summary:
Part of the work done in the `libc` project is to provide host services
for things like `printf` or `malloc`, or generally any syscall-like
behaviour. This scheme works by emitting an externally visible global
called `__llvm_libc_rpc_client` that the host runtime can pick up to get
a handle to the global memory associated with the client. We use the
presence of this symbol to indicate whether or not we need to run an RPC
server. Normally, this symbol is only present if something requiring an
RPC server was linked in, such as `printf`. However, if this call to
`printf` was subsequently optimizated out, the symbol would remain and
cannot be removed (rightfully so) because of its linkage. This patch
adds a special-case optimization to remove this symbol so we can
indicate that an RPC server is no longer needed.

This patch puts this logic in `OpenMPOpt` as the most readily available
place for it. In the future, we should think how to move this somewhere
more generic. Furthermore, we use a hard-coded runtime name (which isn't
uncommon given all the other magic symbol names). But it might be nice
to abstract that part away.




More information about the All-commits mailing list