[clang] [Clang] Check features of tune CPU against target CPU (PR #68861)

Qiu Chaofan via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 17 01:49:53 PDT 2023


================
@@ -833,6 +833,22 @@ TargetInfo::CreateTargetInfo(DiagnosticsEngine &Diags,
   if (!Target->handleTargetFeatures(Opts->Features, Diags))
     return nullptr;
 
+  // If TuneCPU is set, check if it contains all instruction sets needed by
+  // current feature map.
+  if (!Opts->TuneCPU.empty() && Opts->TuneCPU != Opts->CPU) {
----------------
ecnelises wrote:

If `TuneCPU` is empty, this check won't happen. If no `-mcpu` set, `CPU` here depends on triple: for `powerpc64le-unknown-linux-gnu`, that's `ppc64le` (not `pwr8`); for `powerpc64-ibm-aix`, that's `pwr7` (not `ppc64`). Here the comparison is reliable.

https://github.com/llvm/llvm-project/pull/68861


More information about the cfe-commits mailing list