diff --git a/llvm/lib/IR/Mangler.cpp b/llvm/lib/IR/Mangler.cpp --- a/llvm/lib/IR/Mangler.cpp +++ b/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(GV); + const Function *MSFunc = dyn_cast_or_null(GV->getAliaseeObject()); // Don't add byte count suffixes when '\01' or '?' are in the first // character. diff --git a/llvm/test/CodeGen/X86/fastcall-correct-mangling.ll b/llvm/test/CodeGen/X86/fastcall-correct-mangling.ll --- a/llvm/test/CodeGen/X86/fastcall-correct-mangling.ll +++ b/llvm/test/CodeGen/X86/fastcall-correct-mangling.ll @@ -31,3 +31,7 @@ ; CHECK64-LABEL: {{^}}.LdontCrash: ret void } + +@alias = alias void(i64, i8, i8, i16), void(i64, i8, i8, i16)* @func +; CHECK32-LABEL: {{^}}.set @alias@20, @func@20 +; CHECK64-LABEL: {{^}}.set alias, func