
The goal of this patch is to enable utilizing LLVM plugin passes and remarks for GPU offload code at link time. Specifically, this patch extends clang-linker-wrapper's `--offload-opt` (and consequently `-mllvm`) to accept the various LLVM pass options that tools like opt usually accept. Those options include `--passes`, `--load-pass-plugin`, and various remarks options. Unlike many other LLVM options that are inherited from linked code by clang-linker-wrapper (e.g., `-pass-remarks` is already implemented in `llvm/lib/IR/DiagnosticHandler.cpp`), these options are implemented separately as needed by each tool (e.g., opt, llc). Fortunately, this patch is able to handle most of the implementation by passing the option values to `lto::Config`. For testing plugin support, this patch uses the simple `Bye` plugin from LLVM core, but that requires several small Clang test suite config extensions.
11 lines
434 B
C
11 lines
434 B
C
// Check that these simple command lines for listing LLVM options are supported,
|
|
// as claimed by 'clang-linker-wrapper --help'.
|
|
|
|
// RUN: clang-linker-wrapper -mllvm --help 2>&1 | FileCheck %s
|
|
// RUN: clang-linker-wrapper --offload-opt=--help 2>&1 | FileCheck %s
|
|
|
|
// Look for a few options supported only after -mllvm and --offload-opt.
|
|
// CHECK: OPTIONS:
|
|
// CHECK-DAG: --passes=<string>
|
|
// CHECK-DAG: --load-pass-plugin=<string>
|