| commit 4f7ee55971e7f7a27af69c501e4b395c4079decb |
| Author: Denis Antrushin <dantrushin@gmail.com> |
| Date: Fri Oct 23 21:55:06 2020 +0700 |
| |
| Revert "[Statepoints] Allow deopt GC pointer on VReg if gc-live bundle is empty." |
| |
| Downstream testing revealed some problems with this patch. |
| Reverting while investigating. |
| This reverts commit 2b96dcebfae65485859d956954f10f409abaae79. |
| |
| diff --git a/llvm/lib/CodeGen/SelectionDAG/StatepointLowering.cpp b/llvm/lib/CodeGen/SelectionDAG/StatepointLowering.cpp |
| index 13881bb6eaa..2d2eb252e4e 100644 |
| --- a/llvm/lib/CodeGen/SelectionDAG/StatepointLowering.cpp |
| +++ b/llvm/lib/CodeGen/SelectionDAG/StatepointLowering.cpp |
| @@ -555,10 +555,6 @@ lowerStatepointMetaArgs(SmallVectorImpl<SDValue> &Ops, |
| |
| unsigned CurNumVRegs = 0; |
| |
| - auto canPassGCPtrOnVReg = [&](SDValue SDV) { |
| - return !(willLowerDirectly(SDV) || SDV.getValueType().isVector()); |
| - }; |
| - |
| auto processGCPtr = [&](const Value *V) { |
| SDValue PtrSD = Builder.getValue(V); |
| if (!LoweredGCPtrs.insert(PtrSD)) |
| @@ -568,9 +564,7 @@ lowerStatepointMetaArgs(SmallVectorImpl<SDValue> &Ops, |
| assert(!LowerAsVReg.count(PtrSD) && "must not have been seen"); |
| if (LowerAsVReg.size() == MaxVRegPtrs) |
| return; |
| - assert(V->getType()->isVectorTy() == PtrSD.getValueType().isVector() && |
| - "IR and SD types disagree"); |
| - if (!canPassGCPtrOnVReg(PtrSD)) { |
| + if (willLowerDirectly(PtrSD) || V->getType()->isVectorTy()) { |
| LLVM_DEBUG(dbgs() << "direct/spill "; PtrSD.dump(&Builder.DAG)); |
| return; |
| } |
| @@ -597,12 +591,8 @@ lowerStatepointMetaArgs(SmallVectorImpl<SDValue> &Ops, |
| }; |
| |
| auto requireSpillSlot = [&](const Value *V) { |
| - if (isGCValue(V)) { |
| - SDValue SDV = Builder.getValue(V); |
| - if (!LoweredGCPtrs.empty()) |
| - return !LowerAsVReg.count(SDV); |
| - return !MaxVRegPtrs || !canPassGCPtrOnVReg(SDV); |
| - } |
| + if (isGCValue(V)) |
| + return !LowerAsVReg.count(Builder.getValue(V)); |
| return !(LiveInDeopt || UseRegistersForDeoptValues); |
| }; |
| |
| diff --git a/llvm/test/CodeGen/X86/statepoint-vreg-details.ll b/llvm/test/CodeGen/X86/statepoint-vreg-details.ll |
| index 51ada08b7fc..814ba3d03fe 100644 |
| --- a/llvm/test/CodeGen/X86/statepoint-vreg-details.ll |
| +++ b/llvm/test/CodeGen/X86/statepoint-vreg-details.ll |
| @@ -326,14 +326,16 @@ define void @test_duplicate_ir_values() gc "statepoint-example" personality i32* |
| ;CHECK-VREG: %0:gr64 = STATEPOINT 1, 16, 5, %8, $edi, $rsi, $edx, $ecx, $r8d, 2, 0, 2, 0, 2, 0, 2, 1, killed %1(tied-def 0), 2, 0, 2, 1, 0, 0, csr_64, implicit-def $rsp, implicit-def $ssp, implicit-def $eax |
| ;CHECK-VREG: JMP_1 %bb.1 |
| ;CHECK-VREG: bb.1.normal_continue: |
| +;CHECK-VREG: MOV64mr %stack.0, 1, $noreg, 0, $noreg, %0 :: (store 8 into %stack.0) |
| ;CHECK-VREG: %13:gr32 = MOV32ri 10 |
| ;CHECK-VREG: $edi = COPY %13 |
| -;CHECK-VREG: STATEPOINT 2882400000, 0, 1, @__llvm_deoptimize, $edi, 2, 0, 2, 2, 2, 2, %0, %0, 2, 0, 2, 0, 2, 0, csr_64, implicit-def $rsp, implicit-def $ssp |
| +;CHECK-VREG: STATEPOINT 2882400000, 0, 1, @__llvm_deoptimize, $edi, 2, 0, 2, 2, 2, 2, 1, 8, %stack.0, 0, 1, 8, %stack.0, 0, 2, 0, 2, 0, 2, 0, csr_64, implicit-def $rsp, implicit-def $ssp :: (volatile load store 8 on %stack.0) |
| ;CHECK-VREG: bb.2.exceptional_return (landing-pad): |
| ;CHECK-VREG: EH_LABEL <mcsymbol > |
| +;CHECK-VREG: MOV64mr %stack.0, 1, $noreg, 0, $noreg, %0 :: (store 8 into %stack.0) |
| ;CHECK-VREG: %12:gr32 = MOV32ri -271 |
| ;CHECK-VREG: $edi = COPY %12 |
| -;CHECK-VREG: STATEPOINT 2882400000, 0, 1, @__llvm_deoptimize, $edi, 2, 0, 2, 0, 2, 1, %0, 2, 0, 2, 0, 2, 0, csr_64, implicit-def $rsp, implicit-def $ssp |
| +;CHECK-VREG: STATEPOINT 2882400000, 0, 1, @__llvm_deoptimize, $edi, 2, 0, 2, 0, 2, 1, 1, 8, %stack.0, 0, 2, 0, 2, 0, 2, 0, csr_64, implicit-def $rsp, implicit-def $ssp :: (volatile load store 8 on %stack.0) |
| |
| entry: |
| %local.0 = load i8 addrspace(1)*, i8 addrspace(1)* addrspace(1)* undef, align 8 |