From 3ae39f8ad150f689b359b172ef4bdc41f47e9981 Mon Sep 17 00:00:00 2001 From: Eli Friedman Date: Thu, 11 Aug 2011 01:48:05 +0000 Subject: Fix X86TargetLowering::LowerExternalSymbol so that it actually works in non-trivial cases. This hasn't been an issue before because the function isn't normally called (but apparently is used to generate a tail-call to sin() on ELF x86-32 with PIC and SSE2). Fixes PR9693. llvm-svn: 137292 --- llvm/test/CodeGen/X86/tail-call-got.ll | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 llvm/test/CodeGen/X86/tail-call-got.ll (limited to 'llvm/test/CodeGen/X86') diff --git a/llvm/test/CodeGen/X86/tail-call-got.ll b/llvm/test/CodeGen/X86/tail-call-got.ll new file mode 100644 index 00000000000..8910ee272db --- /dev/null +++ b/llvm/test/CodeGen/X86/tail-call-got.ll @@ -0,0 +1,24 @@ +; RUN: llc < %s -relocation-model=pic | FileCheck %s + +target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32-n8:16:32" +target triple = "i386-unknown-freebsd9.0" + +define double @test1(double %x) nounwind readnone { +; CHECK: test1: +; CHECK: movl foo@GOT +; CHECK-NEXT: jmpl + %1 = tail call double @foo(double %x) nounwind readnone + ret double %1 +} + +declare double @foo(double) readnone + +define double @test2(double %x) nounwind readnone { +; CHECK: test2: +; CHECK: movl sin@GOT +; CHECK-NEXT: jmpl + %1 = tail call double @sin(double %x) nounwind readnone + ret double %1 +} + +declare double @sin(double) readnone -- cgit v1.2.3