[PATCH] D120382: [Mangler] Mangle aliases to fastcall/vectorcall functions correctly

Amanieu d'Antras via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 23 05:51:54 PST 2022


Amanieu updated this revision to Diff 410789.
Amanieu added a comment.

Fixed to use dyn_cast_or_null.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D120382

Files:
  llvm/lib/IR/Mangler.cpp
  llvm/test/CodeGen/X86/fastcall-correct-mangling.ll


Index: llvm/test/CodeGen/X86/fastcall-correct-mangling.ll
===================================================================
--- llvm/test/CodeGen/X86/fastcall-correct-mangling.ll
+++ llvm/test/CodeGen/X86/fastcall-correct-mangling.ll
@@ -31,3 +31,7 @@
 ; CHECK64-LABEL: {{^}}.LdontCrash:
   ret void
 }
+
+ at alias = alias void(i64, i8, i8, i16), void(i64, i8, i8, i16)* @func
+; CHECK32-LABEL: {{^}}.set @alias at 20, @func at 20
+; CHECK64-LABEL: {{^}}.set alias, func
Index: llvm/lib/IR/Mangler.cpp
===================================================================
--- llvm/lib/IR/Mangler.cpp
+++ llvm/lib/IR/Mangler.cpp
@@ -144,7 +144,7 @@
 
   // Mangle functions with Microsoft calling conventions specially.  Only do
   // this mangling for x86_64 vectorcall and 32-bit x86.
-  const Function *MSFunc = dyn_cast<Function>(GV);
+  const Function *MSFunc = dyn_cast_or_null<Function>(GV->getAliaseeObject());
 
   // Don't add byte count suffixes when '\01' or '?' are in the first
   // character.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D120382.410789.patch
Type: text/x-patch
Size: 1000 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220223/c4b8411d/attachment.bin>


More information about the llvm-commits mailing list