@@ -1618,6 +1618,23 @@ static std::vector<OptSpecifier> getUnsupportedOpts(void) {
16181618 return UnsupportedOpts;
16191619}
16201620
1621+ // Currently supported options by SYCL NativeCPU device compilation
1622+ static inline bool SupportedByNativeCPU (const SYCLToolChain &TC,
1623+ const OptSpecifier &Opt) {
1624+ if (!TC.IsSYCLNativeCPU )
1625+ return false ;
1626+
1627+ switch (Opt.getID ()) {
1628+ case options::OPT_fcoverage_mapping:
1629+ case options::OPT_fno_coverage_mapping:
1630+ case options::OPT_fprofile_instr_generate:
1631+ case options::OPT_fprofile_instr_generate_EQ:
1632+ case options::OPT_fno_profile_instr_generate:
1633+ return true ;
1634+ }
1635+ return false ;
1636+ }
1637+
16211638SYCLToolChain::SYCLToolChain (const Driver &D, const llvm::Triple &Triple,
16221639 const ToolChain &HostTC, const ArgList &Args)
16231640 : ToolChain(D, Triple, Args), HostTC(HostTC),
@@ -1629,6 +1646,9 @@ SYCLToolChain::SYCLToolChain(const Driver &D, const llvm::Triple &Triple,
16291646 // Diagnose unsupported options only once.
16301647 for (OptSpecifier Opt : getUnsupportedOpts ()) {
16311648 if (const Arg *A = Args.getLastArg (Opt)) {
1649+ // Native CPU can support options unsupported by other targets.
1650+ if (SupportedByNativeCPU (*this , Opt))
1651+ continue ;
16321652 // All sanitizer options are not currently supported, except
16331653 // AddressSanitizer
16341654 if (A->getOption ().getID () == options::OPT_fsanitize_EQ &&
@@ -1669,6 +1689,9 @@ SYCLToolChain::TranslateArgs(const llvm::opt::DerivedArgList &Args,
16691689 bool Unsupported = false ;
16701690 for (OptSpecifier UnsupportedOpt : getUnsupportedOpts ()) {
16711691 if (Opt.matches (UnsupportedOpt)) {
1692+ // NativeCPU should allow most normal cpu options.
1693+ if (SupportedByNativeCPU (*this , Opt.getID ()))
1694+ continue ;
16721695 if (Opt.getID () == options::OPT_fsanitize_EQ &&
16731696 A->getValues ().size () == 1 ) {
16741697 std::string SanitizeVal = A->getValue ();
0 commit comments