[llvm] bd1d70b - [DAG] Change isGCValue detection for statepoint lowering

Serguei Katkov via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 2 22:36:34 PDT 2020


Author: Serguei Katkov
Date: 2020-04-03T12:36:13+07:00
New Revision: bd1d70bf0e17f6d961ae0ca1cafcb12a061836c1

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

LOG: [DAG] Change isGCValue detection for statepoint lowering

isGCValue should detect whether the deopt value is a GC pointer.
Currently it checks by finding the value in SI.Bases and SI.Ptrs.
However these data structures contain only those values which
have corresponding gc.relocate call. So we can miss GC value if it
does not have gc.relocate call (dead after the call).

Check GC strategy whether pointer is GC one or consider any pointer
to be GC one conservatively.

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

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 8904ab345da7..f292d510f65d 100644
--- a/llvm/lib/CodeGen/SelectionDAG/StatepointLowering.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/StatepointLowering.cpp
@@ -482,8 +482,14 @@ lowerStatepointMetaArgs(SmallVectorImpl<SDValue> &Ops,
   const bool LiveInDeopt =
     SI.StatepointFlags & (uint64_t)StatepointFlags::DeoptLiveIn;
 
-  auto isGCValue =[&](const Value *V) {
-    return is_contained(SI.Ptrs, V) || is_contained(SI.Bases, V);
+  auto isGCValue = [&](const Value *V) {
+    auto *Ty = V->getType();
+    if (!Ty->isPtrOrPtrVectorTy())
+      return false;
+    if (auto *GFI = Builder.GFI)
+      if (auto IsManaged = GFI->getStrategy().isGCManagedPointer(Ty))
+        return *IsManaged;
+    return true; // conservative
   };
 
   // Before we actually start lowering (and allocating spill slots for values),


        


More information about the llvm-commits mailing list