Rollup merge of #151071 - gen-openmp-metadata, r=nnethercote
Generate openmp metadata LLVM has an openmp-opt pass, which is part of the default O3 pipeline. The pass bails if we don't have a global called openmp, so let's generate it if people enable our experimental offload feature. openmp is a superset of the offload feature, so they share optimizations. In follow-up PRs I'll start verifying that LLVM optimizes Rust the way we want it. r? compiler
This commit is contained in:
commit
a56e2d3037
2 changed files with 6 additions and 0 deletions
|
|
@ -55,6 +55,10 @@ impl<'ll> OffloadGlobals<'ll> {
|
|||
let init_ty = cx.type_func(&[], cx.type_void());
|
||||
let init_rtls = declare_offload_fn(cx, "__tgt_init_all_rtls", init_ty);
|
||||
|
||||
// We want LLVM's openmp-opt pass to pick up and optimize this module, since it covers both
|
||||
// openmp and offload optimizations.
|
||||
llvm::add_module_flag_u32(cx.llmod(), llvm::ModuleFlagMergeBehavior::Max, "openmp", 51);
|
||||
|
||||
OffloadGlobals {
|
||||
launcher_fn,
|
||||
launcher_ty,
|
||||
|
|
|
|||
|
|
@ -104,3 +104,5 @@ pub fn _kernel_1(x: &mut [f32; 256]) {
|
|||
// CHECK-NEXT: call void @__tgt_unregister_lib(ptr nonnull %EmptyDesc)
|
||||
// CHECK-NEXT: ret void
|
||||
// CHECK-NEXT: }
|
||||
|
||||
// CHECK: !{i32 7, !"openmp", i32 51}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue