[compiler-rt] [compiler-rt] Restore unsigned value in struct, use enum only in function (PR #165048)

Evgenii Kudriashov via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 24 17:21:45 PDT 2025


================
@@ -661,14 +677,22 @@ static const char *getIntelProcessorTypeAndSubtype(
     break; // Unknown.
   }
 
+  if (Type != CPU_TYPE_MAX)
+    __cpu_model.__cpu_type = Type;
+  if (Subtype != CPU_SUBTYPE_MAX)
+    __cpu_model.__cpu_subtype = Subtype;
+
----------------
e-kud wrote:

I won't block the PR but I don't like this kind of refactor. Previously it was pure static function that touched no context. Now it implicitly modifies the global variable. References to `__cpu_type`  and `__cpu_subtype` were additional return values. 

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


More information about the llvm-commits mailing list