Index: llvm/lib/CodeGen/CalcSpillWeights.cpp =================================================================== --- llvm/lib/CodeGen/CalcSpillWeights.cpp +++ llvm/lib/CodeGen/CalcSpillWeights.cpp @@ -15,6 +15,7 @@ #include "llvm/CodeGen/MachineLoopInfo.h" #include "llvm/CodeGen/MachineOperand.h" #include "llvm/CodeGen/MachineRegisterInfo.h" +#include "llvm/CodeGen/StackMaps.h" #include "llvm/CodeGen/TargetInstrInfo.h" #include "llvm/CodeGen/TargetRegisterInfo.h" #include "llvm/CodeGen/TargetSubtargetInfo.h" @@ -125,6 +126,48 @@ return true; } +/// Return true if all uses of Reg can be folded into stack references +/// at zero cost. Note that we could improve this by distinguishing +/// between all reads foldable and all writes foldable. +static bool isFoldableStackUse(MachineInstr &MI, unsigned Reg) { + // TODO: merge into TTI foldPatchpoint. + unsigned StartIdx = 0; + unsigned NumDefs = 0; + switch (MI.getOpcode()) { + default: + // For other foldable instructions, we could include them here, but would + // need some cost function as the folded form isn't truely "free". + return false; + case TargetOpcode::STACKMAP: + // StackMapLiveValues are foldable + StartIdx = StackMapOpers(&MI).getVarIdx(); + break; + case TargetOpcode::PATCHPOINT: + // For PatchPoint, the call args are not foldable (even if reported in the + // stackmap e.g. via anyregcc). + StartIdx = PatchPointOpers(&MI).getVarIdx(); + break; + case TargetOpcode::STATEPOINT: + // For statepoints, fold deopt and gc arguments, but not call arguments. + StartIdx = StatepointOpers(&MI).getVarIdx(); + NumDefs = MI.getNumDefs(); + break; + } + + for (unsigned i = 0, e = MI.getNumOperands(); i < e; ++i) { + MachineOperand &MO = MI.getOperand(i); + if (!MO.isReg()) + continue; + if (MO.getReg() != Reg) + continue; + if (i >= NumDefs && i < StartIdx) + // None stackmap use and thus not foldable + return false; + } + return true; +} + + void VirtRegAuxInfo::calculateSpillWeightAndHint(LiveInterval &LI) { float Weight = weightCalcHelper(LI); // Check if unspillable. @@ -243,6 +286,11 @@ std::tie(Reads, Writes) = MI->readsWritesVirtualRegister(LI.reg()); Weight = LiveIntervals::getSpillWeight(Writes, Reads, &MBFI, *MI); + // If all the uses could be folded at no cost, we don't care whether + // the live interval is on stack or in register for this instruction. + if (isFoldableStackUse(*MI, LI.reg())) + Weight = 0.0f; + // Give extra weight to what looks like a loop induction variable update. if (Writes && IsExiting && LIS.isLiveOutOfMBB(LI, MBB)) Weight *= 3; Index: llvm/test/CodeGen/X86/statepoint-allocas.ll =================================================================== --- llvm/test/CodeGen/X86/statepoint-allocas.ll +++ llvm/test/CodeGen/X86/statepoint-allocas.ll @@ -17,7 +17,7 @@ ; CHECK-NEXT: pushq %rax ; CHECK-NEXT: .cfi_def_cfa_offset 16 ; CHECK-NEXT: movq %rdi, (%rsp) -; CHECK-NEXT: callq return_i1 +; CHECK-NEXT: callq return_i1@PLT ; CHECK-NEXT: .Ltmp0: ; CHECK-NEXT: movq (%rsp), %rax ; CHECK-NEXT: popq %rcx @@ -38,7 +38,7 @@ ; CHECK-NEXT: pushq %rax ; CHECK-NEXT: .cfi_def_cfa_offset 16 ; CHECK-NEXT: movq %rdi, (%rsp) -; CHECK-NEXT: callq return_i1 +; CHECK-NEXT: callq return_i1@PLT ; CHECK-NEXT: .Ltmp1: ; CHECK-NEXT: xorl %eax, %eax ; CHECK-NEXT: popq %rcx Index: llvm/test/CodeGen/X86/statepoint-call-lowering.ll =================================================================== --- llvm/test/CodeGen/X86/statepoint-call-lowering.ll +++ llvm/test/CodeGen/X86/statepoint-call-lowering.ll @@ -20,7 +20,7 @@ ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: pushq %rax ; CHECK-NEXT: .cfi_def_cfa_offset 16 -; CHECK-NEXT: callq return_i1 +; CHECK-NEXT: callq return_i1@PLT ; CHECK-NEXT: .Ltmp0: ; CHECK-NEXT: popq %rcx ; CHECK-NEXT: .cfi_def_cfa_offset 8 @@ -38,7 +38,7 @@ ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: pushq %rax ; CHECK-NEXT: .cfi_def_cfa_offset 16 -; CHECK-NEXT: callq return_i32 +; CHECK-NEXT: callq return_i32@PLT ; CHECK-NEXT: .Ltmp1: ; CHECK-NEXT: popq %rcx ; CHECK-NEXT: .cfi_def_cfa_offset 8 @@ -54,7 +54,7 @@ ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: pushq %rax ; CHECK-NEXT: .cfi_def_cfa_offset 16 -; CHECK-NEXT: callq return_i32ptr +; CHECK-NEXT: callq return_i32ptr@PLT ; CHECK-NEXT: .Ltmp2: ; CHECK-NEXT: popq %rcx ; CHECK-NEXT: .cfi_def_cfa_offset 8 @@ -70,7 +70,7 @@ ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: pushq %rax ; CHECK-NEXT: .cfi_def_cfa_offset 16 -; CHECK-NEXT: callq return_float +; CHECK-NEXT: callq return_float@PLT ; CHECK-NEXT: .Ltmp3: ; CHECK-NEXT: popq %rax ; CHECK-NEXT: .cfi_def_cfa_offset 8 @@ -86,7 +86,7 @@ ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: pushq %rax ; CHECK-NEXT: .cfi_def_cfa_offset 16 -; CHECK-NEXT: callq return_struct +; CHECK-NEXT: callq return_struct@PLT ; CHECK-NEXT: .Ltmp4: ; CHECK-NEXT: popq %rcx ; CHECK-NEXT: .cfi_def_cfa_offset 8 @@ -103,7 +103,7 @@ ; CHECK-NEXT: pushq %rax ; CHECK-NEXT: .cfi_def_cfa_offset 16 ; CHECK-NEXT: movq %rdi, (%rsp) -; CHECK-NEXT: callq return_i1 +; CHECK-NEXT: callq return_i1@PLT ; CHECK-NEXT: .Ltmp5: ; CHECK-NEXT: popq %rcx ; CHECK-NEXT: .cfi_def_cfa_offset 8 @@ -123,7 +123,7 @@ ; CHECK-NEXT: .cfi_def_cfa_offset 16 ; CHECK-NEXT: movl $42, %edi ; CHECK-NEXT: movl $43, %esi -; CHECK-NEXT: callq varargf +; CHECK-NEXT: callq varargf@PLT ; CHECK-NEXT: .Ltmp6: ; CHECK-NEXT: popq %rax ; CHECK-NEXT: .cfi_def_cfa_offset 8 @@ -168,14 +168,14 @@ ; CHECK-NEXT: .cfi_offset %rbp, -16 ; CHECK-NEXT: movl %esi, %ebp ; CHECK-NEXT: movq %rdi, (%rsp) -; CHECK-NEXT: callq return_i1 +; CHECK-NEXT: callq return_i1@PLT ; CHECK-NEXT: .Ltmp8: ; CHECK-NEXT: testb $1, %bpl ; CHECK-NEXT: je .LBB8_2 ; CHECK-NEXT: # %bb.1: # %left ; CHECK-NEXT: movl %eax, %ebx ; CHECK-NEXT: movq (%rsp), %rdi -; CHECK-NEXT: callq consume +; CHECK-NEXT: callq consume@PLT ; CHECK-NEXT: movl %ebx, %eax ; CHECK-NEXT: jmp .LBB8_3 ; CHECK-NEXT: .LBB8_2: # %right @@ -225,7 +225,7 @@ ; CHECK-NEXT: .cfi_adjust_cfa_offset 8 ; CHECK-NEXT: pushq %rcx ; CHECK-NEXT: .cfi_adjust_cfa_offset 8 -; CHECK-NEXT: callq consume_attributes +; CHECK-NEXT: callq consume_attributes@PLT ; CHECK-NEXT: .Ltmp9: ; CHECK-NEXT: addq $32, %rsp ; CHECK-NEXT: .cfi_adjust_cfa_offset -32 Index: llvm/test/CodeGen/X86/statepoint-duplicates-export.ll =================================================================== --- llvm/test/CodeGen/X86/statepoint-duplicates-export.ll +++ llvm/test/CodeGen/X86/statepoint-duplicates-export.ll @@ -16,9 +16,9 @@ ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: pushq %rax ; CHECK-NEXT: .cfi_def_cfa_offset 16 -; CHECK-NEXT: callq func +; CHECK-NEXT: callq func@PLT ; CHECK-NEXT: .Ltmp0: -; CHECK-NEXT: callq func +; CHECK-NEXT: callq func@PLT ; CHECK-NEXT: .Ltmp1: ; CHECK-NEXT: movb $1, %al ; CHECK-NEXT: popq %rcx @@ -47,9 +47,9 @@ ; CHECK-NEXT: pushq %rax ; CHECK-NEXT: .cfi_def_cfa_offset 16 ; CHECK-NEXT: movq %rdi, (%rsp) -; CHECK-NEXT: callq func +; CHECK-NEXT: callq func@PLT ; CHECK-NEXT: .Ltmp2: -; CHECK-NEXT: callq func +; CHECK-NEXT: callq func@PLT ; CHECK-NEXT: .Ltmp3: ; CHECK-NEXT: cmpq $0, (%rsp) ; CHECK-NEXT: sete %al Index: llvm/test/CodeGen/X86/statepoint-gc-live.ll =================================================================== --- llvm/test/CodeGen/X86/statepoint-gc-live.ll +++ llvm/test/CodeGen/X86/statepoint-gc-live.ll @@ -11,7 +11,7 @@ ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: pushq %rax ; CHECK-NEXT: .cfi_def_cfa_offset 16 -; CHECK-NEXT: callq foo +; CHECK-NEXT: callq foo@PLT ; CHECK-NEXT: .Ltmp0: ; CHECK-NEXT: popq %rax ; CHECK-NEXT: .cfi_def_cfa_offset 8 @@ -26,7 +26,7 @@ ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: pushq %rax ; CHECK-NEXT: .cfi_def_cfa_offset 16 -; CHECK-NEXT: callq foo +; CHECK-NEXT: callq foo@PLT ; CHECK-NEXT: .Ltmp1: ; CHECK-NEXT: popq %rax ; CHECK-NEXT: .cfi_def_cfa_offset 8 @@ -42,7 +42,7 @@ ; CHECK-NEXT: pushq %rax ; CHECK-NEXT: .cfi_def_cfa_offset 16 ; CHECK-NEXT: movq %rdi, (%rsp) -; CHECK-NEXT: callq foo +; CHECK-NEXT: callq foo@PLT ; CHECK-NEXT: .Ltmp2: ; CHECK-NEXT: movq (%rsp), %rax ; CHECK-NEXT: popq %rcx @@ -62,7 +62,7 @@ ; CHECK-NEXT: movq %rdi, {{[0-9]+}}(%rsp) ; CHECK-NEXT: addq $8, %rdi ; CHECK-NEXT: movq %rdi, {{[0-9]+}}(%rsp) -; CHECK-NEXT: callq foo +; CHECK-NEXT: callq foo@PLT ; CHECK-NEXT: .Ltmp3: ; CHECK-NEXT: movq {{[0-9]+}}(%rsp), %rax ; CHECK-NEXT: addq $24, %rsp Index: llvm/test/CodeGen/X86/statepoint-invoke.ll =================================================================== --- llvm/test/CodeGen/X86/statepoint-invoke.ll +++ llvm/test/CodeGen/X86/statepoint-invoke.ll @@ -9,28 +9,6 @@ declare i32 @"personality_function"() define i64 addrspace(1)* @test_basic(i64 addrspace(1)* %obj, -; CHECK-LABEL: test_basic: -; CHECK: # %bb.0: # %entry -; CHECK-NEXT: subq $24, %rsp -; CHECK-NEXT: .cfi_def_cfa_offset 32 -; CHECK-NEXT: movq %rdi, {{[0-9]+}}(%rsp) -; CHECK-NEXT: movq %rsi, {{[0-9]+}}(%rsp) -; CHECK-NEXT: .Ltmp0: -; CHECK-NEXT: callq some_call -; CHECK-NEXT: .Ltmp3: -; CHECK-NEXT: .Ltmp1: -; CHECK-NEXT: # %bb.1: # %invoke_safepoint_normal_dest -; CHECK-NEXT: movq {{[0-9]+}}(%rsp), %rax -; CHECK-NEXT: addq $24, %rsp -; CHECK-NEXT: .cfi_def_cfa_offset 8 -; CHECK-NEXT: retq -; CHECK-NEXT: .LBB0_2: # %exceptional_return -; CHECK-NEXT: .cfi_def_cfa_offset 32 -; CHECK-NEXT: .Ltmp2: -; CHECK-NEXT: movq {{[0-9]+}}(%rsp), %rax -; CHECK-NEXT: addq $24, %rsp -; CHECK-NEXT: .cfi_def_cfa_offset 8 -; CHECK-NEXT: retq i64 addrspace(1)* %obj1) gc "statepoint-example" personality i32 ()* @"personality_function" { entry: @@ -59,26 +37,6 @@ ; CHECK: .p2align 4 define i64 addrspace(1)* @test_result(i64 addrspace(1)* %obj, -; CHECK-LABEL: test_result: -; CHECK: # %bb.0: # %entry -; CHECK-NEXT: pushq %rax -; CHECK-NEXT: .cfi_def_cfa_offset 16 -; CHECK-NEXT: movq %rdi, (%rsp) -; CHECK-NEXT: .Ltmp4: -; CHECK-NEXT: callq some_other_call -; CHECK-NEXT: .Ltmp7: -; CHECK-NEXT: .Ltmp5: -; CHECK-NEXT: # %bb.1: # %normal_return -; CHECK-NEXT: popq %rcx -; CHECK-NEXT: .cfi_def_cfa_offset 8 -; CHECK-NEXT: retq -; CHECK-NEXT: .LBB1_2: # %exceptional_return -; CHECK-NEXT: .cfi_def_cfa_offset 16 -; CHECK-NEXT: .Ltmp6: -; CHECK-NEXT: movq (%rsp), %rax -; CHECK-NEXT: popq %rcx -; CHECK-NEXT: .cfi_def_cfa_offset 8 -; CHECK-NEXT: retq i64 addrspace(1)* %obj1) gc "statepoint-example" personality i32 ()* @personality_function { entry: @@ -102,57 +60,6 @@ ; CHECK: .p2align 4 define i64 addrspace(1)* @test_same_val(i1 %cond, i64 addrspace(1)* %val1, i64 addrspace(1)* %val2, i64 addrspace(1)* %val3) -; CHECK-LABEL: test_same_val: -; CHECK: # %bb.0: # %entry -; CHECK-NEXT: pushq %rbx -; CHECK-NEXT: .cfi_def_cfa_offset 16 -; CHECK-NEXT: subq $16, %rsp -; CHECK-NEXT: .cfi_def_cfa_offset 32 -; CHECK-NEXT: .cfi_offset %rbx, -16 -; CHECK-NEXT: movl %edi, %ebx -; CHECK-NEXT: testb $1, %bl -; CHECK-NEXT: je .LBB2_3 -; CHECK-NEXT: # %bb.1: # %left -; CHECK-NEXT: movq %rsi, (%rsp) -; CHECK-NEXT: movq %rdx, {{[0-9]+}}(%rsp) -; CHECK-NEXT: .Ltmp11: -; CHECK-NEXT: movq %rsi, %rdi -; CHECK-NEXT: callq some_call -; CHECK-NEXT: .Ltmp14: -; CHECK-NEXT: .Ltmp12: -; CHECK-NEXT: # %bb.2: # %left.relocs -; CHECK-NEXT: movq (%rsp), %rax -; CHECK-NEXT: movq {{[0-9]+}}(%rsp), %rcx -; CHECK-NEXT: jmp .LBB2_5 -; CHECK-NEXT: .LBB2_3: # %right -; CHECK-NEXT: movq %rdx, (%rsp) -; CHECK-NEXT: movq %rcx, {{[0-9]+}}(%rsp) -; CHECK-NEXT: .Ltmp8: -; CHECK-NEXT: movq %rsi, %rdi -; CHECK-NEXT: callq some_call -; CHECK-NEXT: .Ltmp15: -; CHECK-NEXT: .Ltmp9: -; CHECK-NEXT: # %bb.4: # %right.relocs -; CHECK-NEXT: movq (%rsp), %rcx -; CHECK-NEXT: movq {{[0-9]+}}(%rsp), %rax -; CHECK-NEXT: .LBB2_5: # %normal_return -; CHECK-NEXT: testb $1, %bl -; CHECK-NEXT: cmoveq %rcx, %rax -; CHECK-NEXT: .LBB2_6: # %normal_return -; CHECK-NEXT: addq $16, %rsp -; CHECK-NEXT: .cfi_def_cfa_offset 16 -; CHECK-NEXT: popq %rbx -; CHECK-NEXT: .cfi_def_cfa_offset 8 -; CHECK-NEXT: retq -; CHECK-NEXT: .LBB2_9: # %exceptional_return.right -; CHECK-NEXT: .cfi_def_cfa_offset 32 -; CHECK-NEXT: .Ltmp10: -; CHECK-NEXT: movq (%rsp), %rax -; CHECK-NEXT: jmp .LBB2_6 -; CHECK-NEXT: .LBB2_7: # %exceptional_return.left -; CHECK-NEXT: .Ltmp13: -; CHECK-NEXT: movq (%rsp), %rax -; CHECK-NEXT: jmp .LBB2_6 gc "statepoint-example" personality i32 ()* @"personality_function" { entry: br i1 %cond, label %left, label %right @@ -195,23 +102,6 @@ } define i64 addrspace(1)* @test_null_undef(i64 addrspace(1)* %val1) -; CHECK-LABEL: test_null_undef: -; CHECK: # %bb.0: # %entry -; CHECK-NEXT: pushq %rax -; CHECK-NEXT: .cfi_def_cfa_offset 16 -; CHECK-NEXT: .Ltmp16: -; CHECK-NEXT: callq some_call -; CHECK-NEXT: .Ltmp19: -; CHECK-NEXT: .Ltmp17: -; CHECK-NEXT: .LBB3_1: # %normal_return -; CHECK-NEXT: xorl %eax, %eax -; CHECK-NEXT: popq %rcx -; CHECK-NEXT: .cfi_def_cfa_offset 8 -; CHECK-NEXT: retq -; CHECK-NEXT: .LBB3_2: # %exceptional_return -; CHECK-NEXT: .cfi_def_cfa_offset 16 -; CHECK-NEXT: .Ltmp18: -; CHECK-NEXT: jmp .LBB3_1 gc "statepoint-example" personality i32 ()* @"personality_function" { entry: %sp1 = invoke token (i64, i32, void (i64 addrspace(1)*)*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidp1i64f(i64 0, i32 0, void (i64 addrspace(1)*)* @some_call, i32 1, i32 0, i64 addrspace(1)* %val1, i32 0, i32 0) ["gc-live"(i64 addrspace(1)* null, i64 addrspace(1)* undef)] @@ -231,26 +121,6 @@ } define i64 addrspace(1)* @test_alloca_and_const(i64 addrspace(1)* %val1) -; CHECK-LABEL: test_alloca_and_const: -; CHECK: # %bb.0: # %entry -; CHECK-NEXT: pushq %rax -; CHECK-NEXT: .cfi_def_cfa_offset 16 -; CHECK-NEXT: .Ltmp20: -; CHECK-NEXT: callq some_call -; CHECK-NEXT: .Ltmp23: -; CHECK-NEXT: .Ltmp21: -; CHECK-NEXT: # %bb.1: # %normal_return -; CHECK-NEXT: leaq {{[0-9]+}}(%rsp), %rax -; CHECK-NEXT: popq %rcx -; CHECK-NEXT: .cfi_def_cfa_offset 8 -; CHECK-NEXT: retq -; CHECK-NEXT: .LBB4_2: # %exceptional_return -; CHECK-NEXT: .cfi_def_cfa_offset 16 -; CHECK-NEXT: .Ltmp22: -; CHECK-NEXT: movl $15, %eax -; CHECK-NEXT: popq %rcx -; CHECK-NEXT: .cfi_def_cfa_offset 8 -; CHECK-NEXT: retq gc "statepoint-example" personality i32 ()* @"personality_function" { entry: %a = alloca i32 Index: llvm/test/CodeGen/X86/statepoint-live-in-remat.ll =================================================================== --- llvm/test/CodeGen/X86/statepoint-live-in-remat.ll +++ llvm/test/CodeGen/X86/statepoint-live-in-remat.ll @@ -77,9 +77,6 @@ ; CHECK-NEXT: movl {{[0-9]+}}(%rsp), %edx ; CHECK-NEXT: movl {{[0-9]+}}(%rsp), %ecx ; CHECK-NEXT: movl {{[0-9]+}}(%rsp), %eax - -; Re-materialization happened. - ; CHECK-NEXT: movabsq $_bar, %r13 ; CHECK-NEXT: callq *%r13 ## 96-byte Folded Reload ; CHECK-NEXT: Ltmp0: @@ -92,6 +89,9 @@ ; CHECK-NEXT: popq %rbp ; CHECK-NEXT: retq +; Re-materialization happened. + + ; This is a call to hoist the loading of the target of the call for statepoint. call void @bar() br label %entry Index: llvm/test/CodeGen/X86/statepoint-live-in.ll =================================================================== --- llvm/test/CodeGen/X86/statepoint-live-in.ll +++ llvm/test/CodeGen/X86/statepoint-live-in.ll @@ -372,12 +372,12 @@ ; CHECK-NEXT: .cfi_offset %r14, -32 ; CHECK-NEXT: .cfi_offset %r15, -24 ; CHECK-NEXT: .cfi_offset %rbp, -16 -; CHECK-NEXT: movl %r9d, %r15d -; CHECK-NEXT: movl %r8d, %r14d -; CHECK-NEXT: movl %ecx, %r12d -; CHECK-NEXT: movl %edx, %r13d -; CHECK-NEXT: movl %esi, %ebx -; CHECK-NEXT: movl %edi, %ebp +; CHECK-NEXT: movl %r9d, %r14d +; CHECK-NEXT: movl %r8d, %r12d +; CHECK-NEXT: movl %ecx, %r13d +; CHECK-NEXT: movl %edx, %ebx +; CHECK-NEXT: movl %esi, %ebp +; CHECK-NEXT: movl %edi, %r15d ; CHECK-NEXT: callq _bar ; CHECK-NEXT: Ltmp11: ; CHECK-NEXT: callq _bar Index: llvm/test/CodeGen/X86/statepoint-no-realign-stack.ll =================================================================== --- llvm/test/CodeGen/X86/statepoint-no-realign-stack.ll +++ llvm/test/CodeGen/X86/statepoint-no-realign-stack.ll @@ -24,7 +24,7 @@ ; CHECK-NEXT: vmovaps (%rdi), %ymm0 ; CHECK-NEXT: vmovaps %ymm0, (%rsp) ; CHECK-NEXT: vzeroupper -; CHECK-NEXT: callq foo +; CHECK-NEXT: callq foo@PLT ; CHECK-NEXT: .Ltmp0: ; CHECK-NEXT: movq %rbp, %rsp ; CHECK-NEXT: popq %rbp @@ -43,7 +43,7 @@ ; CHECK-NEXT: vmovaps (%rdi), %ymm0 ; CHECK-NEXT: vmovups %ymm0, (%rsp) ; CHECK-NEXT: vzeroupper -; CHECK-NEXT: callq foo +; CHECK-NEXT: callq foo@PLT ; CHECK-NEXT: .Ltmp1: ; CHECK-NEXT: addq $40, %rsp ; CHECK-NEXT: .cfi_def_cfa_offset 8 @@ -68,7 +68,7 @@ ; CHECK-NEXT: subq $64, %rsp ; CHECK-NEXT: vmovaps %ymm0, (%rsp) ; CHECK-NEXT: vzeroupper -; CHECK-NEXT: callq do_safepoint +; CHECK-NEXT: callq do_safepoint@PLT ; CHECK-NEXT: .Ltmp2: ; CHECK-NEXT: vmovaps (%rsp), %ymm0 ; CHECK-NEXT: movq %rbp, %rsp @@ -88,7 +88,7 @@ ; CHECK-NEXT: .cfi_def_cfa_offset 48 ; CHECK-NEXT: vmovups %ymm0, (%rsp) ; CHECK-NEXT: vzeroupper -; CHECK-NEXT: callq do_safepoint +; CHECK-NEXT: callq do_safepoint@PLT ; CHECK-NEXT: .Ltmp3: ; CHECK-NEXT: vmovups (%rsp), %ymm0 ; CHECK-NEXT: addq $40, %rsp Index: llvm/test/CodeGen/X86/statepoint-regs.ll =================================================================== --- llvm/test/CodeGen/X86/statepoint-regs.ll +++ llvm/test/CodeGen/X86/statepoint-regs.ll @@ -409,12 +409,12 @@ ; CHECK-NEXT: .cfi_offset %r14, -32 ; CHECK-NEXT: .cfi_offset %r15, -24 ; CHECK-NEXT: .cfi_offset %rbp, -16 -; CHECK-NEXT: movl %r9d, %r15d -; CHECK-NEXT: movl %r8d, %r14d -; CHECK-NEXT: movl %ecx, %r12d -; CHECK-NEXT: movl %edx, %r13d -; CHECK-NEXT: movl %esi, %ebx -; CHECK-NEXT: movl %edi, %ebp +; CHECK-NEXT: movl %r9d, %r14d +; CHECK-NEXT: movl %r8d, %r12d +; CHECK-NEXT: movl %ecx, %r13d +; CHECK-NEXT: movl %edx, %ebx +; CHECK-NEXT: movl %esi, %ebp +; CHECK-NEXT: movl %edi, %r15d ; CHECK-NEXT: callq _bar ; CHECK-NEXT: Ltmp12: ; CHECK-NEXT: callq _bar Index: llvm/test/CodeGen/X86/statepoint-uniqueing.ll =================================================================== --- llvm/test/CodeGen/X86/statepoint-uniqueing.ll +++ llvm/test/CodeGen/X86/statepoint-uniqueing.ll @@ -17,12 +17,12 @@ ; CHECK-NEXT: pushq %rax ; CHECK-NEXT: .cfi_def_cfa_offset 16 ; CHECK-NEXT: movq %rdi, (%rsp) -; CHECK-NEXT: callq f +; CHECK-NEXT: callq f@PLT ; CHECK-NEXT: .Ltmp0: ; CHECK-NEXT: movq (%rsp), %rdi ; CHECK-NEXT: movq %rdi, %rsi ; CHECK-NEXT: xorl %eax, %eax -; CHECK-NEXT: callq use +; CHECK-NEXT: callq use@PLT ; CHECK-NEXT: popq %rax ; CHECK-NEXT: .cfi_def_cfa_offset 8 ; CHECK-NEXT: retq @@ -41,12 +41,12 @@ ; CHECK-NEXT: pushq %rax ; CHECK-NEXT: .cfi_def_cfa_offset 16 ; CHECK-NEXT: movq %rdi, (%rsp) -; CHECK-NEXT: callq f +; CHECK-NEXT: callq f@PLT ; CHECK-NEXT: .Ltmp1: ; CHECK-NEXT: movq (%rsp), %rdi ; CHECK-NEXT: movq %rdi, %rsi ; CHECK-NEXT: xorl %eax, %eax -; CHECK-NEXT: callq use +; CHECK-NEXT: callq use@PLT ; CHECK-NEXT: popq %rax ; CHECK-NEXT: .cfi_def_cfa_offset 8 ; CHECK-NEXT: retq @@ -67,7 +67,7 @@ ; CHECK-NEXT: pushq %rax ; CHECK-NEXT: .cfi_def_cfa_offset 16 ; CHECK-NEXT: movq %rdi, (%rsp) -; CHECK-NEXT: callq f +; CHECK-NEXT: callq f@PLT ; CHECK-NEXT: .Ltmp2: ; CHECK-NEXT: popq %rax ; CHECK-NEXT: .cfi_def_cfa_offset 8 @@ -83,7 +83,7 @@ ; CHECK: # %bb.0: ; CHECK-NEXT: pushq %rax ; CHECK-NEXT: .cfi_def_cfa_offset 16 -; CHECK-NEXT: callq f +; CHECK-NEXT: callq f@PLT ; CHECK-NEXT: .Ltmp3: ; CHECK-NEXT: popq %rax ; CHECK-NEXT: .cfi_def_cfa_offset 8 Index: llvm/test/CodeGen/X86/statepoint-vector.ll =================================================================== --- llvm/test/CodeGen/X86/statepoint-vector.ll +++ llvm/test/CodeGen/X86/statepoint-vector.ll @@ -11,7 +11,7 @@ ; CHECK-NEXT: subq $24, %rsp ; CHECK-NEXT: .cfi_def_cfa_offset 32 ; CHECK-NEXT: movaps %xmm0, (%rsp) -; CHECK-NEXT: callq do_safepoint +; CHECK-NEXT: callq do_safepoint@PLT ; CHECK-NEXT: .Ltmp0: ; CHECK-NEXT: movaps (%rsp), %xmm0 ; CHECK-NEXT: addq $24, %rsp @@ -32,11 +32,11 @@ ; CHECK-NEXT: movq %rdi, %xmm1 ; CHECK-NEXT: pshufd {{.*#+}} xmm1 = xmm1[0,1,0,1] ; CHECK-NEXT: paddq %xmm0, %xmm1 -; CHECK-NEXT: movdqa %xmm0, {{[0-9]*}}(%rsp) -; CHECK-NEXT: movdqa %xmm1, {{[0-9]*}}(%rsp) -; CHECK-NEXT: callq do_safepoint +; CHECK-NEXT: movdqa %xmm0, (%rsp) +; CHECK-NEXT: movdqa %xmm1, {{[0-9]+}}(%rsp) +; CHECK-NEXT: callq do_safepoint@PLT ; CHECK-NEXT: .Ltmp1: -; CHECK-NEXT: movaps {{[0-9]*}}(%rsp), %xmm0 +; CHECK-NEXT: movaps {{[0-9]+}}(%rsp), %xmm0 ; CHECK-NEXT: addq $40, %rsp ; CHECK-NEXT: .cfi_def_cfa_offset 8 ; CHECK-NEXT: retq @@ -63,7 +63,7 @@ ; CHECK-NEXT: movaps (%rsi), %xmm0 ; CHECK-NEXT: movaps %xmm0, (%rsp) ; CHECK-NEXT: movaps %xmm0, {{[0-9]+}}(%rsp) -; CHECK-NEXT: callq do_safepoint +; CHECK-NEXT: callq do_safepoint@PLT ; CHECK-NEXT: .Ltmp2: ; CHECK-NEXT: movaps (%rsp), %xmm0 ; CHECK-NEXT: addq $40, %rsp @@ -100,7 +100,7 @@ ; CHECK-NEXT: .cfi_def_cfa_offset 32 ; CHECK-NEXT: xorps %xmm0, %xmm0 ; CHECK-NEXT: movaps %xmm0, (%rsp) -; CHECK-NEXT: callq do_safepoint +; CHECK-NEXT: callq do_safepoint@PLT ; CHECK-NEXT: .Ltmp3: ; CHECK-NEXT: movaps (%rsp), %xmm0 ; CHECK-NEXT: addq $24, %rsp @@ -115,7 +115,7 @@ ; Check that we can lower a constant typed as i128 correctly. We don't have ; a representation of larger than 64 bit constant in the StackMap format. At ; the moment, this simply means spilling them, but there's a potential -; optimization for values representable as sext(Con64). +; optimization for values representable as sext(Con64). define void @test5() gc "statepoint-example" { ; CHECK-LABEL: test5: ; CHECK: # %bb.0: # %entry @@ -125,7 +125,7 @@ ; CHECK-NEXT: movups %xmm0, {{[0-9]+}}(%rsp) ; CHECK-NEXT: movq $-1, {{[0-9]+}}(%rsp) ; CHECK-NEXT: movq $-1, {{[0-9]+}}(%rsp) -; CHECK-NEXT: callq do_safepoint +; CHECK-NEXT: callq do_safepoint@PLT ; CHECK-NEXT: .Ltmp4: ; CHECK-NEXT: addq $40, %rsp ; CHECK-NEXT: .cfi_def_cfa_offset 8 Index: llvm/test/CodeGen/X86/statepoint-vreg.ll =================================================================== --- llvm/test/CodeGen/X86/statepoint-vreg.ll +++ llvm/test/CodeGen/X86/statepoint-vreg.ll @@ -19,26 +19,26 @@ define i1 @test_relocate(i32 addrspace(1)* %a) gc "statepoint-example" { ; CHECK-LABEL: test_relocate: ; CHECK: # %bb.0: # %entry -; CHECK-NEXT: pushq %rbp +; CHECK-NEXT: pushq %r14 ; CHECK-NEXT: .cfi_def_cfa_offset 16 ; CHECK-NEXT: pushq %rbx ; CHECK-NEXT: .cfi_def_cfa_offset 24 ; CHECK-NEXT: pushq %rax ; CHECK-NEXT: .cfi_def_cfa_offset 32 ; CHECK-NEXT: .cfi_offset %rbx, -24 -; CHECK-NEXT: .cfi_offset %rbp, -16 -; CHECK-NEXT: movq %rdi, %rbx -; CHECK-NEXT: callq return_i1 +; CHECK-NEXT: .cfi_offset %r14, -16 +; CHECK-NEXT: movq %rdi, %r14 +; CHECK-NEXT: callq return_i1@PLT ; CHECK-NEXT: .Ltmp0: -; CHECK-NEXT: movl %eax, %ebp -; CHECK-NEXT: movq %rbx, %rdi -; CHECK-NEXT: callq consume -; CHECK-NEXT: movl %ebp, %eax +; CHECK-NEXT: movl %eax, %ebx +; CHECK-NEXT: movq %r14, %rdi +; CHECK-NEXT: callq consume@PLT +; CHECK-NEXT: movl %ebx, %eax ; CHECK-NEXT: addq $8, %rsp ; CHECK-NEXT: .cfi_def_cfa_offset 24 ; CHECK-NEXT: popq %rbx ; CHECK-NEXT: .cfi_def_cfa_offset 16 -; CHECK-NEXT: popq %rbp +; CHECK-NEXT: popq %r14 ; CHECK-NEXT: .cfi_def_cfa_offset 8 ; CHECK-NEXT: retq entry: @@ -65,14 +65,14 @@ ; CHECK-NEXT: movq %rdx, %r14 ; CHECK-NEXT: movq %rsi, %r15 ; CHECK-NEXT: movq %rdi, %rbx -; CHECK-NEXT: callq func +; CHECK-NEXT: callq func@PLT ; CHECK-NEXT: .Ltmp1: ; CHECK-NEXT: movq %rbx, %rdi ; CHECK-NEXT: xorl %esi, %esi ; CHECK-NEXT: movq %r15, %rdx ; CHECK-NEXT: xorl %ecx, %ecx ; CHECK-NEXT: movq %r14, %r8 -; CHECK-NEXT: callq consume5 +; CHECK-NEXT: callq consume5@PLT ; CHECK-NEXT: popq %rbx ; CHECK-NEXT: .cfi_def_cfa_offset 24 ; CHECK-NEXT: popq %r14 @@ -99,17 +99,17 @@ ; CHECK-NEXT: .cfi_def_cfa_offset 16 ; CHECK-NEXT: pushq %rbx ; CHECK-NEXT: .cfi_def_cfa_offset 24 -; CHECK-NEXT: pushq %rax +; CHECK-NEXT: pushq %rax ; CHECK-NEXT: .cfi_def_cfa_offset 32 ; CHECK-NEXT: .cfi_offset %rbx, -24 ; CHECK-NEXT: .cfi_offset %r14, -16 ; CHECK-NEXT: movq %rdi, %rbx -; CHECK-NEXT: movq %rdi, {{[0-9]*}}(%rsp) -; CHECK-NEXT: callq return_i1 +; CHECK-NEXT: movq %rdi, (%rsp) +; CHECK-NEXT: callq return_i1@PLT ; CHECK-NEXT: .Ltmp2: -; CHECK-NEXT: movq {{[0-9]*}}(%rsp), %r14 +; CHECK-NEXT: movq (%rsp), %r14 ; CHECK-NEXT: movq %rbx, %rdi -; CHECK-NEXT: callq consume +; CHECK-NEXT: callq consume@PLT ; CHECK-NEXT: movq %r14, %rax ; CHECK-NEXT: addq $8, %rsp ; CHECK-NEXT: .cfi_def_cfa_offset 24 @@ -132,25 +132,25 @@ define void @test_base_derived(i32 addrspace(1)* %base, i32 addrspace(1)* %derived) gc "statepoint-example" { ; CHECK-LABEL: test_base_derived: ; CHECK: # %bb.0: -; CHECK-NEXT: pushq %r14 +; CHECK-NEXT: pushq %r14 ; CHECK-NEXT: .cfi_def_cfa_offset 16 -; CHECK-NEXT: pushq %rbx +; CHECK-NEXT: pushq %rbx ; CHECK-NEXT: .cfi_def_cfa_offset 24 -; CHECK-NEXT: pushq %rax +; CHECK-NEXT: pushq %rax ; CHECK-NEXT: .cfi_def_cfa_offset 32 ; CHECK-NEXT: .cfi_offset %rbx, -24 ; CHECK-NEXT: .cfi_offset %r14, -16 -; CHECK-NEXT: movq %rsi, %rbx -; CHECK-NEXT: movq %rdi, %r14 -; CHECK-NEXT: callq func +; CHECK-NEXT: movq %rsi, %rbx +; CHECK-NEXT: movq %rdi, %r14 +; CHECK-NEXT: callq func@PLT ; CHECK-NEXT: .Ltmp3: ; CHECK-NEXT: movq %rbx, %rdi -; CHECK-NEXT: callq consume -; CHECK-NEXT: addq $8, %rsp +; CHECK-NEXT: callq consume@PLT +; CHECK-NEXT: addq $8, %rsp ; CHECK-NEXT: .cfi_def_cfa_offset 24 -; CHECK-NEXT: popq %rbx +; CHECK-NEXT: popq %rbx ; CHECK-NEXT: .cfi_def_cfa_offset 16 -; CHECK-NEXT: popq %r14 +; CHECK-NEXT: popq %r14 ; CHECK-NEXT: .cfi_def_cfa_offset 8 ; CHECK-NEXT: retq %safepoint_token = tail call token (i64, i32, void ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 0, i32 0, void ()* @func, i32 0, i32 0, i32 0, i32 0) ["gc-live" (i32 addrspace(1)* %base, i32 addrspace(1)* %derived)] @@ -170,10 +170,10 @@ ; CHECK-NEXT: .cfi_offset %rbx, -16 ; CHECK-NEXT: movq %rsi, %rbx ; CHECK-NEXT: movq %rdi, {{[0-9]+}}(%rsp) -; CHECK-NEXT: callq func +; CHECK-NEXT: callq func@PLT ; CHECK-NEXT: .Ltmp4: ; CHECK-NEXT: movq %rbx, %rdi -; CHECK-NEXT: callq consume +; CHECK-NEXT: callq consume@PLT ; CHECK-NEXT: addq $16, %rsp ; CHECK-NEXT: .cfi_def_cfa_offset 16 ; CHECK-NEXT: popq %rbx @@ -193,11 +193,11 @@ ; CHECK-NEXT: .cfi_def_cfa_offset 16 ; CHECK-NEXT: .cfi_offset %rbx, -16 ; CHECK-NEXT: movq %rdi, %rbx -; CHECK-NEXT: callq func +; CHECK-NEXT: callq func@PLT ; CHECK-NEXT: .Ltmp5: ; CHECK-NEXT: movq %rbx, %rdi ; CHECK-NEXT: movq %rbx, %rsi -; CHECK-NEXT: callq consume2 +; CHECK-NEXT: callq consume2@PLT ; CHECK-NEXT: popq %rbx ; CHECK-NEXT: .cfi_def_cfa_offset 8 ; CHECK-NEXT: retq @@ -216,11 +216,11 @@ ; CHECK-NEXT: .cfi_def_cfa_offset 16 ; CHECK-NEXT: .cfi_offset %rbx, -16 ; CHECK-NEXT: movq %rdi, %rbx -; CHECK-NEXT: callq func +; CHECK-NEXT: callq func@PLT ; CHECK-NEXT: .Ltmp6: ; CHECK-NEXT: movq %rbx, %rdi ; CHECK-NEXT: movq %rbx, %rsi -; CHECK-NEXT: callq use1 +; CHECK-NEXT: callq use1@PLT ; CHECK-NEXT: popq %rbx ; CHECK-NEXT: .cfi_def_cfa_offset 8 ; CHECK-NEXT: retq @@ -248,16 +248,16 @@ ; CHECK-NEXT: .cfi_offset %r14, -24 ; CHECK-NEXT: .cfi_offset %rbp, -16 ; CHECK-NEXT: movl %esi, %ebp -; CHECK-NEXT: movq %rdi, %rbx -; CHECK-NEXT: callq return_i1 +; CHECK-NEXT: movq %rdi, %r14 +; CHECK-NEXT: callq return_i1@PLT ; CHECK-NEXT: .Ltmp7: ; CHECK-NEXT: testb $1, %bpl ; CHECK-NEXT: je .LBB7_2 ; CHECK-NEXT: # %bb.1: # %left -; CHECK-NEXT: movl %eax, %r14d -; CHECK-NEXT: movq %rbx, %rdi -; CHECK-NEXT: callq consume -; CHECK-NEXT: movl %r14d, %eax +; CHECK-NEXT: movl %eax, %ebx +; CHECK-NEXT: movq %r14, %rdi +; CHECK-NEXT: callq consume@PLT +; CHECK-NEXT: movl %ebx, %eax ; CHECK-NEXT: jmp .LBB7_3 ; CHECK-NEXT: .LBB7_2: # %right ; CHECK-NEXT: movb $1, %al @@ -289,9 +289,9 @@ ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: pushq %rax ; CHECK-NEXT: .cfi_def_cfa_offset 16 -; CHECK-NEXT: callq func +; CHECK-NEXT: callq func@PLT ; CHECK-NEXT: .Ltmp8: -; CHECK-NEXT: callq func +; CHECK-NEXT: callq func@PLT ; CHECK-NEXT: .Ltmp9: ; CHECK-NEXT: movb $1, %al ; CHECK-NEXT: popq %rcx @@ -318,7 +318,7 @@ ; CHECK-NEXT: subq $24, %rsp ; CHECK-NEXT: .cfi_def_cfa_offset 32 ; CHECK-NEXT: movaps %xmm0, (%rsp) -; CHECK-NEXT: callq func +; CHECK-NEXT: callq func@PLT ; CHECK-NEXT: .Ltmp10: ; CHECK-NEXT: movaps (%rsp), %xmm0 ; CHECK-NEXT: addq $24, %rsp @@ -354,14 +354,14 @@ ; CHECK-NEXT: movq %rdx, %r12 ; CHECK-NEXT: movq %rsi, %rbx ; CHECK-NEXT: movq %rdi, (%rsp) -; CHECK-NEXT: callq func +; CHECK-NEXT: callq func@PLT ; CHECK-NEXT: .Ltmp11: ; CHECK-NEXT: movq (%rsp), %rdi ; CHECK-NEXT: movq %rbx, %rsi ; CHECK-NEXT: movq %r12, %rdx ; CHECK-NEXT: movq %r15, %rcx ; CHECK-NEXT: movq %r14, %r8 -; CHECK-NEXT: callq consume5 +; CHECK-NEXT: callq consume5@PLT ; CHECK-NEXT: addq $8, %rsp ; CHECK-NEXT: .cfi_def_cfa_offset 40 ; CHECK-NEXT: popq %rbx @@ -392,10 +392,10 @@ ; CHECK-NEXT: .cfi_def_cfa_offset 16 ; CHECK-NEXT: .cfi_offset %rbx, -16 ; CHECK-NEXT: movq %rdi, %rbx -; CHECK-NEXT: callq func +; CHECK-NEXT: callq func@PLT ; CHECK-NEXT: .Ltmp12: ; CHECK-NEXT: movq %rbx, %rdi -; CHECK-NEXT: callq consume +; CHECK-NEXT: callq consume@PLT ; CHECK-NEXT: popq %rbx ; CHECK-NEXT: .cfi_def_cfa_offset 8 ; CHECK-NEXT: retq @@ -422,7 +422,7 @@ ; CHECK-NEXT: movq %rsi, %rbx ; CHECK-NEXT: movl %edi, %ebp ; CHECK-NEXT: movss %xmm0, {{[-0-9]+}}(%r{{[sb]}}p) # 4-byte Spill -; CHECK-NEXT: callq consume3 +; CHECK-NEXT: callq consume3@PLT ; CHECK-NEXT: .Ltmp13: ; CHECK-NEXT: xorps %xmm0, %xmm0 ; CHECK-NEXT: cvtsi2sd %ebp, %xmm0