53 lines · plain
1; RUN: llc -mcpu=generic -mtriple=i386-apple-darwin -tailcallopt -enable-misched=false < %s | FileCheck %s2; Check that lowered arguments do not overwrite the return address before it is moved.3; Bug 62254;5; If a call is a fastcc tail call and tail call optimization is enabled, the6; caller frame is replaced by the callee frame. This can require that arguments are7; placed on the former return address stack slot. Special care needs to be taken8; taken that the return address is moved / or stored in a register before9; lowering of arguments potentially overwrites the value.10;11; Move return address (76(%esp)) to a temporary register (%ebp)12; CHECK: movl 76(%esp), [[REGISTER:%[a-z]+]]13; Overwrite return addresss14; CHECK: movl [[EBX:%[a-z]+]], 76(%esp)15; Move return address from temporary register (%ebp) to new stack location (60(%esp))16; CHECK: movl [[REGISTER]], 60(%esp)17 18%tupl = type [9 x i32]19 20declare fastcc void @l297(i32 %r10, i32 %r9, i32 %r8, i32 %r7, i32 %r6, i32 %r5, i32 %r3, i32 %r2) nounwind21declare fastcc void @l298(i32 %r10, i32 %r9, i32 %r4) nounwind22 23define fastcc void @l186(ptr %r1) nounwind {24entry:25 %r2 = load i32, ptr %r126 %ptr3 = getelementptr %tupl, ptr %r1, i32 0, i32 127 %r3 = load i32, ptr %ptr328 %ptr5 = getelementptr %tupl, ptr %r1, i32 0, i32 229 %r4 = load i32, ptr %ptr530 %ptr7 = getelementptr %tupl, ptr %r1, i32 0, i32 331 %r5 = load i32, ptr %ptr732 %ptr9 = getelementptr %tupl, ptr %r1, i32 0, i32 433 %r6 = load i32, ptr %ptr934 %ptr11 = getelementptr %tupl, ptr %r1, i32 0, i32 535 %r7 = load i32, ptr %ptr1136 %ptr13 = getelementptr %tupl, ptr %r1, i32 0, i32 637 %r8 = load i32, ptr %ptr1338 %ptr15 = getelementptr %tupl, ptr %r1, i32 0, i32 739 %r9 = load i32, ptr %ptr1540 %ptr17 = getelementptr %tupl, ptr %r1, i32 0, i32 841 %r10 = load i32, ptr %ptr1742 %cond = icmp eq i32 %r10, 343 br i1 %cond, label %true, label %false44 45true:46 tail call fastcc void @l297(i32 %r10, i32 %r9, i32 %r8, i32 %r7, i32 %r6, i32 %r5, i32 %r3, i32 %r2) nounwind47 ret void48 49false:50 tail call fastcc void @l298(i32 %r10, i32 %r9, i32 %r4) nounwind51 ret void52}53