Skip to content

Commit 7006a8f

Browse files
committed
[clang] Delay checking of -fopenmp-host-ir-file-path
1 parent 7e1e133 commit 7006a8f

File tree

5 files changed

+10
-16
lines changed

5 files changed

+10
-16
lines changed

clang/include/clang/Basic/DiagnosticDriverKinds.td

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -361,9 +361,6 @@ def err_drv_optimization_remark_format : Error<
361361
def err_drv_no_neon_modifier : Error<"[no]neon is not accepted as modifier, please use [no]simd instead">;
362362
def err_drv_invalid_omp_target : Error<"OpenMP target is invalid: '%0'">;
363363
def err_drv_incompatible_omp_arch : Error<"OpenMP target architecture '%0' pointer size is incompatible with host '%1'">;
364-
def err_drv_omp_host_ir_file_not_found : Error<
365-
"provided host compiler IR file '%0' is required to generate code for OpenMP "
366-
"target regions but cannot be found">;
367364
def err_drv_omp_host_target_not_supported : Error<
368365
"target '%0' is not a supported OpenMP host target">;
369366
def err_drv_expecting_fopenmp_with_fopenmp_targets : Error<

clang/include/clang/Basic/DiagnosticFrontendKinds.td

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,9 @@ def err_target_unsupported_type_for_abi
312312
: Error<"%0 requires %1 type support, but ABI '%2' does not support it">;
313313
}
314314

315+
def err_omp_host_ir_file_not_found : Error<
316+
"provided host compiler IR file '%0' is required to generate code for OpenMP "
317+
"target regions but cannot be found">;
315318
def err_alias_to_undefined : Error<
316319
"%select{alias|ifunc}0 must point to a defined "
317320
"%select{variable or |}1function">;

clang/include/clang/Driver/Options.td

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8719,7 +8719,8 @@ def fopenmp_is_target_device : Flag<["-"], "fopenmp-is-target-device">,
87198719
HelpText<"Generate code only for an OpenMP target device.">;
87208720
def : Flag<["-"], "fopenmp-is-device">, Alias<fopenmp_is_target_device>;
87218721
def fopenmp_host_ir_file_path : Separate<["-"], "fopenmp-host-ir-file-path">,
8722-
HelpText<"Path to the IR file produced by the frontend for the host.">;
8722+
HelpText<"Path to the IR file produced by the frontend for the host.">,
8723+
MarshallingInfoString<LangOpts<"OMPHostIRFile">>;
87238724

87248725
} // let Visibility = [CC1Option, FC1Option]
87258726

clang/lib/CodeGen/CodeGenModule.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -582,6 +582,11 @@ void CodeGenModule::createOpenCLRuntime() {
582582
}
583583

584584
void CodeGenModule::createOpenMPRuntime() {
585+
if (!LangOpts.OMPHostIRFile.empty() &&
586+
!llvm::sys::fs::exists(LangOpts.OMPHostIRFile))
587+
Diags.Report(diag::err_omp_host_ir_file_not_found)
588+
<< LangOpts.OMPHostIRFile;
589+
585590
// Select a specialized code generation class based on the target, if any.
586591
// If it does not exist use the default implementation.
587592
switch (getTriple().getArch()) {

clang/lib/Frontend/CompilerInvocation.cpp

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3919,9 +3919,6 @@ void CompilerInvocationBase::GenerateLangArgs(const LangOptions &Opts,
39193919
GenerateArg(Consumer, OPT_offload_targets_EQ, Targets);
39203920
}
39213921

3922-
if (!Opts.OMPHostIRFile.empty())
3923-
GenerateArg(Consumer, OPT_fopenmp_host_ir_file_path, Opts.OMPHostIRFile);
3924-
39253922
if (Opts.OpenMPCUDAMode)
39263923
GenerateArg(Consumer, OPT_fopenmp_cuda_mode);
39273924

@@ -4388,15 +4385,6 @@ bool CompilerInvocation::ParseLangArgs(LangOptions &Opts, ArgList &Args,
43884385
}
43894386
}
43904387

4391-
// Get OpenMP host file path if any and report if a non existent file is
4392-
// found
4393-
if (Arg *A = Args.getLastArg(options::OPT_fopenmp_host_ir_file_path)) {
4394-
Opts.OMPHostIRFile = A->getValue();
4395-
if (!llvm::sys::fs::exists(Opts.OMPHostIRFile))
4396-
Diags.Report(diag::err_drv_omp_host_ir_file_not_found)
4397-
<< Opts.OMPHostIRFile;
4398-
}
4399-
44004388
// Set CUDA mode for OpenMP target NVPTX/AMDGCN if specified in options
44014389
Opts.OpenMPCUDAMode = Opts.OpenMPIsTargetDevice &&
44024390
(T.isNVPTX() || T.isAMDGCN()) &&

0 commit comments

Comments
 (0)