llvm-6502/test/CodeGen/X86/sibcall-5.ll
Rafael Espindola 9155b17815 Hide the stub created for MO_ExternalSymbol too.
given

declare void @llvm.memset.p0i8.i32(i8* nocapture, i8, i32, i32, i1)
declare void @foo()
define void @bar() {
  call void @foo()
  call void @llvm.memset.p0i8.i32(i8* null, i8 0, i32 188, i32 1, i1 false)
  ret void
}

We used to produce

L_foo$stub:
        .indirect_symbol        _foo
        .ascii  "\364\364\364\364\364"

_memset$stub:
        .indirect_symbol        _memset
        .ascii  "\364\364\364\364\364"

We not produce a private stub for memset too.

Stubs are not needed with recent linkers, but we still produce them for darwin8.

Thanks to David Fang for confirming that gcc used to do this too.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@196468 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-05 05:19:12 +00:00

66 lines
2.0 KiB
LLVM

; RUN: llc < %s -mtriple=i386-apple-darwin8 -mattr=+sse2 | FileCheck %s --check-prefix=X32
; RUN: llc < %s -mtriple=x86_64-apple-darwin -mattr=+sse2 | FileCheck %s --check-prefix=X64
; RUN: llc < %s -mtriple=x86_64-apple-darwin -mattr=-sse3 | FileCheck %s --check-prefix=X64_BAD
; Sibcall optimization of expanded libcalls.
; rdar://8707777
define double @foo(double %a) nounwind readonly ssp {
entry:
; X32-LABEL: foo:
; X32: jmp L_sin$stub
; X64-LABEL: foo:
; X64: jmp _sin
%0 = tail call double @sin(double %a) nounwind readonly
ret double %0
}
define float @bar(float %a) nounwind readonly ssp {
; X32-LABEL: bar:
; X32: jmp L_sinf$stub
; X64-LABEL: bar:
; X64: jmp _sinf
entry:
%0 = tail call float @sinf(float %a) nounwind readonly
ret float %0
}
; X32-LABEL: L_sin$stub:
; X32-NEXT: .indirect_symbol _sin
; X32-LABEL: L_sinf$stub:
; X32-NEXT: .indirect_symbol _sinf
declare float @sinf(float) nounwind readonly
declare double @sin(double) nounwind readonly
; rdar://10930395
%0 = type opaque
@"\01L_OBJC_SELECTOR_REFERENCES_2" = external hidden global i8*, section "__DATA, __objc_selrefs, literal_pointers, no_dead_strip"
define hidden { double, double } @foo2(%0* %self, i8* nocapture %_cmd) uwtable optsize ssp {
; X64_BAD: foo
; X64_BAD: call
; X64_BAD: call
; X64_BAD: call
%1 = load i8** @"\01L_OBJC_SELECTOR_REFERENCES_2", align 8, !invariant.load !0
%2 = bitcast %0* %self to i8*
%3 = tail call { double, double } bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to { double, double } (i8*, i8*)*)(i8* %2, i8* %1) optsize
%4 = extractvalue { double, double } %3, 0
%5 = extractvalue { double, double } %3, 1
%6 = tail call double @floor(double %4) optsize
%7 = tail call double @floor(double %5) optsize
%insert.i.i = insertvalue { double, double } undef, double %6, 0
%insert5.i.i = insertvalue { double, double } %insert.i.i, double %7, 1
ret { double, double } %insert5.i.i
}
declare i8* @objc_msgSend(i8*, i8*, ...)
declare double @floor(double) optsize
!0 = metadata !{}