[llvm] c525168 - [X86] Remove unnecessary #if around call to isCpuIdSupported in getHostCPUName.

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 11 15:14:02 PDT 2020


Author: Craig Topper
Date: 2020-06-11T15:13:28-07:00
New Revision: c52516819073ccc2853a347b28a4e88fa0af9cbb

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

LOG: [X86] Remove unnecessary #if around call to isCpuIdSupported in getHostCPUName.

The exact same #if is already inside isCpuIdSupported and causes
it to return true. The definition of isCpuIdSupported isn't
conditional so we should be able just rely on its body doing
the right thing.

Added: 
    

Modified: 
    llvm/lib/Support/Host.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Support/Host.cpp b/llvm/lib/Support/Host.cpp
index 75b40827338c..930abc3ea1ba 100644
--- a/llvm/lib/Support/Host.cpp
+++ b/llvm/lib/Support/Host.cpp
@@ -1156,14 +1156,9 @@ StringRef sys::getHostCPUName() {
   unsigned EAX = 0, EBX = 0, ECX = 0, EDX = 0;
   unsigned MaxLeaf, Vendor;
 
-#if defined(__GNUC__) || defined(__clang__)
-  //FIXME: include cpuid.h from clang or copy __get_cpuid_max here
-  // and simplify it to not invoke __cpuid (like cpu_model.c in
-  // compiler-rt/lib/builtins/cpu_model.c?
-  // Opting for the second option.
-  if(!isCpuIdSupported())
+  if (!isCpuIdSupported())
     return "generic";
-#endif
+
   if (getX86CpuIDAndInfo(0, &MaxLeaf, &Vendor, &ECX, &EDX) || MaxLeaf < 1)
     return "generic";
   getX86CpuIDAndInfo(0x1, &EAX, &EBX, &ECX, &EDX);


        


More information about the llvm-commits mailing list