[llvm] r368823 - [AsmPrinter] Delete redundant .type foo, @function when emitting an ifunc
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 14 03:30:27 PDT 2019
Author: maskray
Date: Wed Aug 14 03:30:27 2019
New Revision: 368823
URL: http://llvm.org/viewvc/llvm-project?rev=368823&view=rev
Log:
[AsmPrinter] Delete redundant .type foo, @function when emitting an ifunc
In MCAsmStreamer:
.type foo, at function # <--- this is redundant
.type foo, at gnu_indirect_function
In MCELFStreamer, the latter STT_GNU_IFUNC overrides STT_FUNC.
Modified:
llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
llvm/trunk/test/CodeGen/X86/ifunc-asm.ll
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=368823&r1=368822&r2=368823&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Wed Aug 14 03:30:27 2019
@@ -1313,11 +1313,10 @@ void AsmPrinter::emitGlobalIndirectSymbo
// Set the symbol type to function if the alias has a function type.
// This affects codegen when the aliasee is not a function.
- if (IsFunction) {
- OutStreamer->EmitSymbolAttribute(Name, MCSA_ELF_TypeFunction);
- if (isa<GlobalIFunc>(GIS))
- OutStreamer->EmitSymbolAttribute(Name, MCSA_ELF_TypeIndFunction);
- }
+ if (IsFunction)
+ OutStreamer->EmitSymbolAttribute(Name, isa<GlobalIFunc>(GIS)
+ ? MCSA_ELF_TypeIndFunction
+ : MCSA_ELF_TypeFunction);
EmitVisibility(Name, GIS.getVisibility());
Modified: llvm/trunk/test/CodeGen/X86/ifunc-asm.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/ifunc-asm.ll?rev=368823&r1=368822&r2=368823&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/ifunc-asm.ll (original)
+++ llvm/trunk/test/CodeGen/X86/ifunc-asm.ll Wed Aug 14 03:30:27 2019
@@ -10,6 +10,5 @@ entry:
; CHECK-NEXT: foo_ifunc:
@foo = ifunc i32 (i32), i64 ()* @foo_ifunc
-; CHECK: .type foo, at function
-; CHECK-NEXT: .type foo, at gnu_indirect_function
+; CHECK: .type foo, at gnu_indirect_function
; CHECK-NEXT: .set foo, foo_ifunc
More information about the llvm-commits
mailing list