[llvm] a58c8a7 - Remove the additional constant which requires an extra register for statepoint lowering.

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 6 13:04:07 PDT 2020


The change itself looks fine, but was this reviewed?  I don't see a 
review link in the commit message.

Philip

On 4/5/20 8:49 AM, Matt Arsenault via llvm-commits wrote:
> Author: Zuojian Lin
> Date: 2020-04-05T11:22:09-04:00
> New Revision: a58c8a78660896bfe7d5e0ca18b9ab7458dea92b
>
> URL: https://github.com/llvm/llvm-project/commit/a58c8a78660896bfe7d5e0ca18b9ab7458dea92b
> DIFF: https://github.com/llvm/llvm-project/commit/a58c8a78660896bfe7d5e0ca18b9ab7458dea92b.diff
>
> LOG: Remove the additional constant which requires an extra register for statepoint lowering.
>
> The newly-created constant zero will need an extra register to hold it
> in the current statepoint lowering implementation. Remove it if there
> exists one.
>
> Added:
>      llvm/test/CodeGen/X86/statepoint-no-extra-const.ll
>
> Modified:
>      llvm/lib/CodeGen/SelectionDAG/StatepointLowering.cpp
>
> Removed:
>      
>
>
> ################################################################################
> diff  --git a/llvm/lib/CodeGen/SelectionDAG/StatepointLowering.cpp b/llvm/lib/CodeGen/SelectionDAG/StatepointLowering.cpp
> index f292d510f65d..8cb609090b16 100644
> --- a/llvm/lib/CodeGen/SelectionDAG/StatepointLowering.cpp
> +++ b/llvm/lib/CodeGen/SelectionDAG/StatepointLowering.cpp
> @@ -804,22 +804,17 @@ SelectionDAGBuilder::LowerStatepoint(ImmutableStatepoint ISP,
>   #endif
>   
>     SDValue ActualCallee;
> +  SDValue Callee = getValue(ISP.getCalledValue());
>   
>     if (ISP.getNumPatchBytes() > 0) {
>       // If we've been asked to emit a nop sequence instead of a call instruction
>       // for this statepoint then don't lower the call target, but use a constant
> -    // `null` instead.  Not lowering the call target lets statepoint clients get
> -    // away without providing a physical address for the symbolic call target at
> -    // link time.
> -
> -    const auto &TLI = DAG.getTargetLoweringInfo();
> -    const auto &DL = DAG.getDataLayout();
> -
> -    unsigned AS = ISP.getCalledValue()->getType()->getPointerAddressSpace();
> -    ActualCallee =
> -        DAG.getTargetConstant(0, getCurSDLoc(), TLI.getPointerTy(DL, AS));
> +    // `undef` instead.  Not lowering the call target lets statepoint clients
> +    // get away without providing a physical address for the symbolic call
> +    // target at link time.
> +    ActualCallee = DAG.getUNDEF(Callee.getValueType());
>     } else {
> -    ActualCallee = getValue(ISP.getCalledValue());
> +    ActualCallee = Callee;
>     }
>   
>     StatepointLoweringInfo SI(DAG);
>
> diff  --git a/llvm/test/CodeGen/X86/statepoint-no-extra-const.ll b/llvm/test/CodeGen/X86/statepoint-no-extra-const.ll
> new file mode 100644
> index 000000000000..a4291020196b
> --- /dev/null
> +++ b/llvm/test/CodeGen/X86/statepoint-no-extra-const.ll
> @@ -0,0 +1,23 @@
> +; RUN: llc < %s -mtriple=x86_64-unknown | FileCheck %s
> +
> +define i8 addrspace(1)* @no_extra_const(i8 addrspace(1)* %obj) gc "statepoint-example" {
> +; CHECK-LABEL:   no_extra_const:
> +; CHECK:	       .cfi_startproc
> +; CHECK-NEXT:    # %bb.0:                                # %entry
> +; CHECK-NEXT:    pushq	%rax
> +; CHECK-NEXT:    .cfi_def_cfa_offset 16
> +; CHECK-NEXT:    movq	%rdi, (%rsp)
> +; CHECK-NEXT:    nopl	8(%rax)
> +; CHECK-NEXT:    .Ltmp0:
> +; CHECK-NEXT:    movq	(%rsp), %rax
> +; CHECK-NEXT:    popq	%rcx
> +; CHECK-NEXT:    .cfi_def_cfa_offset 8
> +; CHECK-NEXT:    retq
> +entry:
> +  %safepoint_token = call token (i64, i32, void ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 0, i32 4, void ()* null, i32 0, i32 0, i32 0, i32 0, i8 addrspace(1)* %obj)
> +  %obj.relocated = call coldcc i8 addrspace(1)* @llvm.experimental.gc.relocate.p1i8(token %safepoint_token, i32 7, i32 7) ; (%obj, %obj)
> +  ret i8 addrspace(1)* %obj.relocated
> +}
> +
> +declare token @llvm.experimental.gc.statepoint.p0f_isVoidf(i64, i32, void ()*, i32, i32, ...)
> +declare i8 addrspace(1)* @llvm.experimental.gc.relocate.p1i8(token, i32, i32)
>
>
>          
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits


More information about the llvm-commits mailing list