[PATCH] D121410: Have cpu-specific variants set 'tune-cpu' as an optimization hint

Erich Keane via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 10 17:25:56 PST 2022


erichkeane added inline comments.


================
Comment at: clang/lib/CodeGen/CodeGenModule.cpp:2067
+      // favor this processor.
+      TuneCPU = SD->getCPUName(GD.getMultiVersionIndex())->getName();
+    }
----------------
andrew.w.kaylor wrote:
> Unfortunately, I don't think it's this easy. The list of names used for cpu_specific doesn't come from the same place as the list of names used by "tune-cpu". For one thing, the cpu_specific names can't contain the '-' character, so we have names like "skylake_avx512" in cpu_specific that would need to be translated to "skylake-avx512" for "tune-cpu". I believe the list of valid names for "tune-cpu" comes from here: https://github.com/llvm/llvm-project/blob/26cd258420c774254cc48330b1f4d23d353baf05/llvm/lib/Support/X86TargetParser.cpp#L294
> 
> Also, some of the aliases supported by cpu_specific don't have any corresponding "tune-cpu" name. You happen to have picked one of these for the test. I believe "core_4th_gen_avx" should map to "haswell".
Hmm... this is unfortunate.  I wonder if we add some 'translation' type field to the X86TargetParser.def entries?  Any idea who the right one to populate said list would be?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D121410/new/

https://reviews.llvm.org/D121410



More information about the cfe-commits mailing list