[all-commits] [llvm/llvm-project] 82e537: [Clang][OpenMP] Fixed an issue that clang crashed ...

Shilei Tian via All-commits all-commits at lists.llvm.org
Tue Jan 19 11:23:03 PST 2021


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 82e537a9d28a2c18bd1637e2eac0e0af658ed829
      https://github.com/llvm/llvm-project/commit/82e537a9d28a2c18bd1637e2eac0e0af658ed829
  Author: Shilei Tian <tianshilei1992 at gmail.com>
  Date:   2021-01-19 (Tue, 19 Jan 2021)

  Changed paths:
    M clang/lib/CodeGen/CGOpenMPRuntime.cpp
    A clang/test/OpenMP/declare_target_device_only_compilation.cpp

  Log Message:
  -----------
  [Clang][OpenMP] Fixed an issue that clang crashed when compiling OpenMP program in device only mode without host IR

D94745 rewrites the `deviceRTLs` using OpenMP and compiles it by directly
calling the device compilation. `clang` crashes because entry in
`OffloadEntriesDeviceGlobalVar` is unintialized. Current design supposes the
device compilation can only be invoked after host compilation with the host IR
such that `clang` can initialize `OffloadEntriesDeviceGlobalVar` from host IR.
This avoids us using device compilation directly, especially when we only have
code wrapped into `declare target` which are all device code. The same issue
also exists for `OffloadEntriesInfoManager`.

In this patch, we simply initialized an entry if it is not in the maps. Not sure
we need an option to tell the device compiler that it is invoked standalone.

Reviewed By: jdoerfert

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




More information about the All-commits mailing list