[PATCH] D142352: [CodeGen] Filter out available_externally aliases

Jonas Hahnfeld via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 23 05:46:45 PST 2023


Hahnfeld updated this revision to Diff 491330.
Hahnfeld added a comment.

Fix type of function alias.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D142352/new/

https://reviews.llvm.org/D142352

Files:
  llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
  llvm/test/CodeGen/Generic/available_externally_alias.ll


Index: llvm/test/CodeGen/Generic/available_externally_alias.ll
===================================================================
--- /dev/null
+++ llvm/test/CodeGen/Generic/available_externally_alias.ll
@@ -0,0 +1,11 @@
+; RUN: llc < %s
+
+ at v = available_externally global i32 42, align 4
+ at va = available_externally alias i32, ptr @v
+
+define available_externally i32 @f() {
+entry:
+  ret i32 0
+}
+
+ at fa = available_externally alias i32(), ptr @f
Index: llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
===================================================================
--- llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -2235,6 +2235,8 @@
   SmallVector<const GlobalAlias *, 16> AliasStack;
   SmallPtrSet<const GlobalAlias *, 16> AliasVisited;
   for (const auto &Alias : M.aliases()) {
+    if (Alias.hasAvailableExternallyLinkage())
+      continue;
     for (const GlobalAlias *Cur = &Alias; Cur;
          Cur = dyn_cast<GlobalAlias>(Cur->getAliasee())) {
       if (!AliasVisited.insert(Cur).second)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D142352.491330.patch
Type: text/x-patch
Size: 1054 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230123/baa4044f/attachment.bin>


More information about the llvm-commits mailing list