Index: lib/Target/ARM/ARMISelLowering.cpp =================================================================== --- lib/Target/ARM/ARMISelLowering.cpp +++ lib/Target/ARM/ARMISelLowering.cpp @@ -1645,8 +1645,9 @@ bool isLocalARMFunc = false; ARMFunctionInfo *AFI = MF.getInfo(); - if (EnableARMLongCalls) { - assert (getTargetMachine().getRelocationModel() == Reloc::Static + if (EnableARMLongCalls || Subtarget->isTargetWindows()) { + assert ((getTargetMachine().getRelocationModel() == Reloc::Static || + Subtarget->isTargetWindows()) && "long-calls with non-static relocation model!"); // Handle a global address or an external symbol. If it's not one of // those, the target's already in a register, so we don't need to do Index: test/CodeGen/ARM/Windows/calls.ll =================================================================== --- /dev/null +++ test/CodeGen/ARM/Windows/calls.ll @@ -0,0 +1,36 @@ +; RUN: llc -mtriple=thumbv7-windows -mcpu=cortex-a9 -o - %s | FileCheck %s + +declare void @external() + +define void @internal() nounwind { +entry: + ret void +} + +define void @call_external() nounwind { +entry: + tail call void @external() + ret void +} + +define void @call_internal() nounwind { +entry: + tail call void @internal() + ret void +} + +; CHECK: call_external: +; CHECK: ldr r0, .L[[CPI:[^ ]*]] +; CHECK: bx r0 +; CHECK: .align 2 +; CHECK: .L[[CPI]] +; CHECK: .long external + +; CHECK: call_internal +; CHECK: ldr r0, .L[[CPI:[^ ]*]] +; FIXME: relax this to a bl function +; CHECK: bx r0 +; CHECK: .align 2 +; CHECK: .L[[CPI]] +; CHECK: .long internal +