[clang] [llvm] [NFC][clang][FMV][TargetInfo] Refactor API for FMV feature priority. (PR #116257)

Phoebe Wang via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 25 21:47:32 PST 2024


================
@@ -4303,21 +4288,15 @@ void CodeGenModule::emitMultiVersionFunctions() {
                 continue;
 
               llvm::Function *Func = createFunction(CurFD, I);
-              StringRef Architecture;
               Feats.clear();
-              if (getTarget().getTriple().isAArch64())
-                TC->getFeatures(Feats, I);
-              else if (getTarget().getTriple().isRISCV()) {
-                StringRef Version = TC->getFeatureStr(I);
-                Feats.push_back(Version);
+              if (getTarget().getTriple().isX86()) {
+                TC->getAddedFeatures(Feats, I);
----------------
phoebewang wrote:

I'm not familar with TargetClones. I saw two test cases in https://github.com/llvm/llvm-project/blob/main/clang/test/CodeGen/attr-target-clones.c
```
inline int __attribute__((target_clones("arch=sandybridge,default,sse4.2")))
foo_inline2(void){ return 0; }

__attribute__((target_clones("default", "arch=x86-64", "arch=x86-64-v2", "arch=x86-64-v3", "arch=x86-64-v4")))
int isa_level(int) { return 0; }
```

Is there differece to `I` here? If `I` already split by `,`, what's the reason to split it in `getAddedFeatures/getArchitecture`?

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


More information about the cfe-commits mailing list