[llvm] c96877f - [X86] Remove unnecessary union from getHostCPUFeatures. NFC

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 8 23:45:06 PDT 2020


Author: Craig Topper
Date: 2020-07-08T23:42:05-07:00
New Revision: c96877ff62253aeeaba4ea165861045263d25207

URL: https://github.com/llvm/llvm-project/commit/c96877ff62253aeeaba4ea165861045263d25207
DIFF: https://github.com/llvm/llvm-project/commit/c96877ff62253aeeaba4ea165861045263d25207.diff

LOG: [X86] Remove unnecessary union from getHostCPUFeatures. NFC

This seems to be leftover copied from an older implementation
of getHostCPUName where we needed this to check the name of
CPU vendor. We don't check the CPU vendor at all in
getHostCPUFeatures so this union and the variable are unneeded.

Added: 
    

Modified: 
    llvm/lib/Support/Host.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Support/Host.cpp b/llvm/lib/Support/Host.cpp
index db99612c97b5..adfb599f55ff 100644
--- a/llvm/lib/Support/Host.cpp
+++ b/llvm/lib/Support/Host.cpp
@@ -1361,13 +1361,8 @@ int sys::getHostNumPhysicalCores() {
 bool sys::getHostCPUFeatures(StringMap<bool> &Features) {
   unsigned EAX = 0, EBX = 0, ECX = 0, EDX = 0;
   unsigned MaxLevel;
-  union {
-    unsigned u[3];
-    char c[12];
-  } text;
 
-  if (getX86CpuIDAndInfo(0, &MaxLevel, text.u + 0, text.u + 2, text.u + 1) ||
-      MaxLevel < 1)
+  if (getX86CpuIDAndInfo(0, &MaxLevel, &EBX, &ECX, &EDX) || MaxLevel < 1)
     return false;
 
   getX86CpuIDAndInfo(1, &EAX, &EBX, &ECX, &EDX);


        


More information about the llvm-commits mailing list