[llvm] a6f38b4 - [Statepoint] Remove redundant clear of call target on register

Serguei Katkov via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 12 20:03:18 PST 2020


Author: Serguei Katkov
Date: 2020-02-13T10:25:50+07:00
New Revision: a6f38b46972e4e6978c3a768001903d3f3334cb7

URL: https://github.com/llvm/llvm-project/commit/a6f38b46972e4e6978c3a768001903d3f3334cb7
DIFF: https://github.com/llvm/llvm-project/commit/a6f38b46972e4e6978c3a768001903d3f3334cb7.diff

LOG: [Statepoint] Remove redundant clear of call target on register

Patchable statepoint is lowered into sequence of nops, so zeroed call target
should not be on register. It is better to use getTargetConstant instead
of getConstant to select zero constant for call target.

Reviewers: reames
Reviewed By: reames
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D74465

Added: 
    

Modified: 
    llvm/lib/CodeGen/SelectionDAG/StatepointLowering.cpp
    llvm/test/CodeGen/X86/statepoint-call-lowering.ll

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/SelectionDAG/StatepointLowering.cpp b/llvm/lib/CodeGen/SelectionDAG/StatepointLowering.cpp
index c628f379e415..881288a84658 100644
--- a/llvm/lib/CodeGen/SelectionDAG/StatepointLowering.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/StatepointLowering.cpp
@@ -859,7 +859,8 @@ SelectionDAGBuilder::LowerStatepoint(ImmutableStatepoint ISP,
     const auto &DL = DAG.getDataLayout();
 
     unsigned AS = ISP.getCalledValue()->getType()->getPointerAddressSpace();
-    ActualCallee = DAG.getConstant(0, getCurSDLoc(), TLI.getPointerTy(DL, AS));
+    ActualCallee =
+        DAG.getTargetConstant(0, getCurSDLoc(), TLI.getPointerTy(DL, AS));
   } else {
     ActualCallee = getValue(ISP.getCalledValue());
   }

diff  --git a/llvm/test/CodeGen/X86/statepoint-call-lowering.ll b/llvm/test/CodeGen/X86/statepoint-call-lowering.ll
index bc312b71f6b4..2d299f417f08 100644
--- a/llvm/test/CodeGen/X86/statepoint-call-lowering.ll
+++ b/llvm/test/CodeGen/X86/statepoint-call-lowering.ll
@@ -141,7 +141,6 @@ define i1 @test_i1_return_patchable() gc "statepoint-example" {
 ; CHECK:       # %bb.0: # %entry
 ; CHECK-NEXT:    pushq %rax
 ; CHECK-NEXT:    .cfi_def_cfa_offset 16
-; CHECK-NEXT:    xorl %eax, %eax
 ; CHECK-NEXT:    nopl (%rax)
 ; CHECK-NEXT:  .Ltmp7:
 ; CHECK-NEXT:    popq %rcx


        


More information about the llvm-commits mailing list