[PATCH] D53850: Declares __cpu_model as hidden symbol

Haibo Huang via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 30 11:45:45 PDT 2018


hhb updated this revision to Diff 171748.

https://reviews.llvm.org/D53850

Files:
  lib/CodeGen/CGBuiltin.cpp
  test/CodeGen/builtin-cpu-is.c
  test/CodeGen/builtin-cpu-supports.c


Index: test/CodeGen/builtin-cpu-supports.c
===================================================================
--- test/CodeGen/builtin-cpu-supports.c
+++ test/CodeGen/builtin-cpu-supports.c
@@ -4,6 +4,8 @@
 // global, the bit grab, and the icmp correct.
 extern void a(const char *);
 
+// CHECK: @__cpu_model = external hidden global { i32, i32, i32, [1 x i32] }
+
 int main() {
   __builtin_cpu_init();
 
Index: test/CodeGen/builtin-cpu-is.c
===================================================================
--- test/CodeGen/builtin-cpu-is.c
+++ test/CodeGen/builtin-cpu-is.c
@@ -4,6 +4,8 @@
 // global, the bit grab, and the icmp correct.
 extern void a(const char *);
 
+// CHECK: @__cpu_model = external hidden global { i32, i32, i32, [1 x i32] }
+
 void intel() {
   if (__builtin_cpu_is("intel"))
     a("intel");
Index: lib/CodeGen/CGBuiltin.cpp
===================================================================
--- lib/CodeGen/CGBuiltin.cpp
+++ lib/CodeGen/CGBuiltin.cpp
@@ -9016,6 +9016,8 @@
 
   // Grab the global __cpu_model.
   llvm::Constant *CpuModel = CGM.CreateRuntimeVariable(STy, "__cpu_model");
+  cast<llvm::GlobalValue>(CpuModel)->setVisibility(
+      llvm::GlobalValue::HiddenVisibility);
 
   // Calculate the index needed to access the correct field based on the
   // range. Also adjust the expected value.
@@ -9082,6 +9084,8 @@
 
   // Grab the global __cpu_model.
   llvm::Constant *CpuModel = CGM.CreateRuntimeVariable(STy, "__cpu_model");
+  cast<llvm::GlobalValue>(CpuModel)->setVisibility(
+      llvm::GlobalValue::HiddenVisibility);
 
   // Grab the first (0th) element from the field __cpu_features off of the
   // global in the struct STy.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D53850.171748.patch
Type: text/x-patch
Size: 1684 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20181030/1c032bc6/attachment.bin>


More information about the cfe-commits mailing list