[llvm] 157efd8 - [Statepoint Lowering] Add an option to allow use gc values in regs for landing pad

Serguei Katkov via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 12 20:48:44 PST 2021


Author: Serguei Katkov
Date: 2021-01-13T11:39:34+07:00
New Revision: 157efd84abf812c1689ba6a9ecb4da2b87dde756

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

LOG: [Statepoint Lowering] Add an option to allow use gc values in regs for landing pad

Default value is not changed, so it is NFC actually.

The option allows to use gc values on registers in landing pads.

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

Added: 
    

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 5638feaf1540..0172646c22ec 100644
--- a/llvm/lib/CodeGen/SelectionDAG/StatepointLowering.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/StatepointLowering.cpp
@@ -64,6 +64,10 @@ cl::opt<bool> UseRegistersForDeoptValues(
     "use-registers-for-deopt-values", cl::Hidden, cl::init(false),
     cl::desc("Allow using registers for non pointer deopt args"));
 
+cl::opt<bool> UseRegistersForGCPointersInLandingPad(
+    "use-registers-for-gc-values-in-landing-pad", cl::Hidden, cl::init(false),
+    cl::desc("Allow using registers for gc pointer in landing pad"));
+
 cl::opt<unsigned> MaxRegistersForGCPointers(
     "max-registers-for-gc-values", cl::Hidden, cl::init(0),
     cl::desc("Max number of VRegs allowed to pass GC pointer meta args in"));
@@ -549,14 +553,15 @@ lowerStatepointMetaArgs(SmallVectorImpl<SDValue> &Ops,
   // Pointers used on exceptional path of invoke statepoint.
   // We cannot assing them to VRegs.
   SmallSet<SDValue, 8> LPadPointers;
-  if (auto *StInvoke = dyn_cast_or_null<InvokeInst>(SI.StatepointInstr)) {
-    LandingPadInst *LPI = StInvoke->getLandingPadInst();
-    for (auto *Relocate : SI.GCRelocates)
-      if (Relocate->getOperand(0) == LPI) {
-        LPadPointers.insert(Builder.getValue(Relocate->getBasePtr()));
-        LPadPointers.insert(Builder.getValue(Relocate->getDerivedPtr()));
-      }
-  }
+  if (!UseRegistersForGCPointersInLandingPad)
+    if (auto *StInvoke = dyn_cast_or_null<InvokeInst>(SI.StatepointInstr)) {
+      LandingPadInst *LPI = StInvoke->getLandingPadInst();
+      for (auto *Relocate : SI.GCRelocates)
+        if (Relocate->getOperand(0) == LPI) {
+          LPadPointers.insert(Builder.getValue(Relocate->getBasePtr()));
+          LPadPointers.insert(Builder.getValue(Relocate->getDerivedPtr()));
+        }
+    }
 
   LLVM_DEBUG(dbgs() << "Deciding how to lower GC Pointers:\n");
 


        


More information about the llvm-commits mailing list