[PATCH] D51199: CodeGen: Add two more conditions for adding symbols to the address-significance table.

Peter Collingbourne via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 24 13:38:12 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL340648: CodeGen: Add two more conditions for adding symbols to the address-significance… (authored by pcc, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D51199?vs=162303&id=162466#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D51199

Files:
  llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
  llvm/trunk/test/CodeGen/X86/addrsig.ll


Index: llvm/trunk/test/CodeGen/X86/addrsig.ll
===================================================================
--- llvm/trunk/test/CodeGen/X86/addrsig.ll
+++ llvm/trunk/test/CodeGen/X86/addrsig.ll
@@ -7,6 +7,18 @@
 
 ; CHECK: .addrsig_sym f1
 define void @f1() {
+  %f1 = bitcast void()* @f1 to i8*
+  %f2 = bitcast void()* @f2 to i8*
+  %f3 = bitcast void()* @f3 to i8*
+  %g1 = bitcast i32* @g1 to i8*
+  %g2 = bitcast i32* @g2 to i8*
+  %g3 = bitcast i32* @g3 to i8*
+  %dllimport = bitcast i32* @dllimport to i8*
+  %tls = bitcast i32* @tls to i8*
+  %a1 = bitcast i32* @a1 to i8*
+  %a2 = bitcast i32* @a2 to i8*
+  %i1 = bitcast void()* @i1 to i8*
+  %i2 = bitcast void()* @i2 to i8*
   unreachable
 }
 
@@ -25,6 +37,12 @@
 ; CHECK-NOT: .addrsig_sym g3
 @g3 = external unnamed_addr global i32
 
+; CHECK-NOT: .addrsig_sym unref
+ at unref = external global i32
+
+; CHECK-NOT: .addrsig_sym dllimport
+ at dllimport = external dllimport global i32
+
 ; CHECK-NOT: .addrsig_sym tls
 @tls = thread_local global i32 0
 
Index: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
===================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -1542,7 +1542,8 @@
     // Emit address-significance attributes for all globals.
     OutStreamer->EmitAddrsig();
     for (const GlobalValue &GV : M.global_values())
-      if (!GV.isThreadLocal() && !GV.getName().startswith("llvm.") &&
+      if (!GV.use_empty() && !GV.isThreadLocal() &&
+          !GV.hasDLLImportStorageClass() && !GV.getName().startswith("llvm.") &&
           !GV.hasAtLeastLocalUnnamedAddr())
         OutStreamer->EmitAddrsigSym(getSymbol(&GV));
   }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D51199.162466.patch
Type: text/x-patch
Size: 1729 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180824/83eece3a/attachment.bin>


More information about the llvm-commits mailing list