Index: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h =================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h @@ -777,6 +777,11 @@ bool VarArgDisallowed, bool ForceVoidReturnTy); + /// Returns the type of FrameIndex and TargetFrameIndex nodes. + MVT getFrameIndexTy() { + return DAG.getTargetLoweringInfo().getFrameIndexTy(DAG.getDataLayout()); + } + private: // Terminator instructions. void visitRet(const ReturnInst &I); Index: llvm/trunk/lib/CodeGen/SelectionDAG/StatepointLowering.cpp =================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/StatepointLowering.cpp +++ llvm/trunk/lib/CodeGen/SelectionDAG/StatepointLowering.cpp @@ -242,7 +242,8 @@ // Cache this slot so we find it when going through the normal // assignment loop. - SDValue Loc = Builder.DAG.getTargetFrameIndex(*Index, Incoming.getValueType()); + SDValue Loc = + Builder.DAG.getTargetFrameIndex(*Index, Builder.getFrameIndexTy()); Builder.StatepointLowering.setLocation(Incoming, Loc); } @@ -343,7 +344,7 @@ Builder); int Index = cast(Loc)->getIndex(); // We use TargetFrameIndex so that isel will not select it into LEA - Loc = Builder.DAG.getTargetFrameIndex(Index, Incoming.getValueType()); + Loc = Builder.DAG.getTargetFrameIndex(Index, Builder.getFrameIndexTy()); // TODO: We can create TokenFactor node instead of // chaining stores one after another, this may allow @@ -391,8 +392,10 @@ // This handles allocas as arguments to the statepoint (this is only // really meaningful for a deopt value. For GC, we'd be trying to // relocate the address of the alloca itself?) + assert(Incoming.getValueType() == Builder.getFrameIndexTy() && + "Incoming value is a frame index!"); Ops.push_back(Builder.DAG.getTargetFrameIndex(FI->getIndex(), - Incoming.getValueType())); + Builder.getFrameIndexTy())); } else if (LiveInOnly) { // If this value is live in (not live-on-return, or live-through), we can // treat it the same way patchpoint treats it's "live in" values. We'll @@ -527,8 +530,10 @@ SDValue Incoming = Builder.getValue(V); if (FrameIndexSDNode *FI = dyn_cast(Incoming)) { // This handles allocas as arguments to the statepoint + assert(Incoming.getValueType() == Builder.getFrameIndexTy() && + "Incoming value is a frame index!"); Ops.push_back(Builder.DAG.getTargetFrameIndex(FI->getIndex(), - Incoming.getValueType())); + Builder.getFrameIndexTy())); } } @@ -949,8 +954,8 @@ return; } - SDValue SpillSlot = DAG.getTargetFrameIndex(*DerivedPtrLocation, - SD.getValueType()); + SDValue SpillSlot = + DAG.getTargetFrameIndex(*DerivedPtrLocation, getFrameIndexTy()); // Be conservative: flush all pending loads // TODO: Probably we can be less restrictive on this, @@ -958,7 +963,9 @@ SDValue Chain = getRoot(); SDValue SpillLoad = - DAG.getLoad(SpillSlot.getValueType(), getCurSDLoc(), Chain, SpillSlot, + DAG.getLoad(DAG.getTargetLoweringInfo().getValueType(DAG.getDataLayout(), + Relocate.getType()), + getCurSDLoc(), Chain, SpillSlot, MachinePointerInfo::getFixedStack(DAG.getMachineFunction(), *DerivedPtrLocation)); Index: llvm/trunk/test/CodeGen/X86/deopt-bundles.ll =================================================================== --- llvm/trunk/test/CodeGen/X86/deopt-bundles.ll +++ llvm/trunk/test/CodeGen/X86/deopt-bundles.ll @@ -50,7 +50,6 @@ ; STACKMAPS-NEXT: Stack Maps: Loc 3: Constant 55 [encoding: .byte 4, .byte 8, .short 0, .int 55] ; STACKMAPS-NEXT: Stack Maps: has 0 live-out registers - declare i32 @callee_0() declare i32 @callee_1(i32) declare i32 @callee_vararg(...) @@ -159,3 +158,42 @@ } declare void @g_0(i64* %vl) + +define void @vector_deopt_bundle(<32 x i64 addrspace(1)*> %val) { +; CHECK-LABEL: _vector_deopt_bundle: +; CHECK: movaps 16(%rbp), %xmm8 +; CHECK-NEXT: movaps 32(%rbp), %xmm9 +; CHECK-NEXT: movaps 48(%rbp), %xmm10 +; CHECK-NEXT: movaps 64(%rbp), %xmm11 +; CHECK-NEXT: movaps 80(%rbp), %xmm12 +; CHECK-NEXT: movaps 96(%rbp), %xmm13 +; CHECK-NEXT: movaps 112(%rbp), %xmm14 +; CHECK-NEXT: movaps 128(%rbp), %xmm15 +; CHECK-NEXT: movaps %xmm15, 240(%rsp) +; CHECK-NEXT: movaps %xmm14, 224(%rsp) +; CHECK-NEXT: movaps %xmm13, 208(%rsp) +; CHECK-NEXT: movaps %xmm12, 192(%rsp) +; CHECK-NEXT: movaps %xmm11, 176(%rsp) +; CHECK-NEXT: movaps %xmm10, 160(%rsp) +; CHECK-NEXT: movaps %xmm9, 144(%rsp) +; CHECK-NEXT: movaps %xmm8, 128(%rsp) +; CHECK-NEXT: movaps %xmm7, 112(%rsp) +; CHECK-NEXT: movaps %xmm6, 96(%rsp) +; CHECK-NEXT: movaps %xmm5, 80(%rsp) +; CHECK-NEXT: movaps %xmm4, 64(%rsp) +; CHECK-NEXT: movaps %xmm3, 48(%rsp) +; CHECK-NEXT: movaps %xmm2, 32(%rsp) +; CHECK-NEXT: movaps %xmm1, 16(%rsp) +; CHECK-NEXT: movaps %xmm0, (%rsp) + call void @unknown() [ "deopt"(<32 x i64 addrspace(1)*> %val) ] + ret void +; STACKMAPS: Stack Maps: callsite 2882400015 +; STACKMAPS-NEXT: Stack Maps: has 4 locations +; STACKMAPS-NEXT: Stack Maps: Loc 0: Constant 0 [encoding: .byte 4, .byte 8, .short 0, .int 0] +; STACKMAPS-NEXT: Stack Maps: Loc 1: Constant 0 [encoding: .byte 4, .byte 8, .short 0, .int 0] +; STACKMAPS-NEXT: Stack Maps: Loc 2: Constant 1 [encoding: .byte 4, .byte 8, .short 0, .int 1] +; STACKMAPS-NEXT: Stack Maps: Loc 3: Indirect 7+0 [encoding: .byte 3, .byte 256, .short 7, .int 0] +; STACKMAPS-NEXT: Stack Maps: has 0 live-out registers +} + +declare void @unknown()