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

Serguei Katkov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 12 00:25:22 PST 2020


skatkov created this revision.
skatkov added a reviewer: reames.
Herald added a subscriber: hiraditya.
Herald added a project: LLVM.

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.


https://reviews.llvm.org/D74465

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


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
@@ -141,7 +141,6 @@
 ; 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
Index: llvm/lib/CodeGen/SelectionDAG/StatepointLowering.cpp
===================================================================
--- llvm/lib/CodeGen/SelectionDAG/StatepointLowering.cpp
+++ llvm/lib/CodeGen/SelectionDAG/StatepointLowering.cpp
@@ -859,7 +859,8 @@
     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());
   }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D74465.244077.patch
Type: text/x-patch
Size: 1104 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200212/f3fc4030/attachment.bin>


More information about the llvm-commits mailing list