Skip to content

Commit bd1d70b

Browse files
author
Serguei Katkov
committed
[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
1 parent fef2dab commit bd1d70b

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

llvm/lib/CodeGen/SelectionDAG/StatepointLowering.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -482,8 +482,14 @@ lowerStatepointMetaArgs(SmallVectorImpl<SDValue> &Ops,
482482
const bool LiveInDeopt =
483483
SI.StatepointFlags & (uint64_t)StatepointFlags::DeoptLiveIn;
484484

485-
auto isGCValue =[&](const Value *V) {
486-
return is_contained(SI.Ptrs, V) || is_contained(SI.Bases, V);
485+
auto isGCValue = [&](const Value *V) {
486+
auto *Ty = V->getType();
487+
if (!Ty->isPtrOrPtrVectorTy())
488+
return false;
489+
if (auto *GFI = Builder.GFI)
490+
if (auto IsManaged = GFI->getStrategy().isGCManagedPointer(Ty))
491+
return *IsManaged;
492+
return true; // conservative
487493
};
488494

489495
// Before we actually start lowering (and allocating spill slots for values),

0 commit comments

Comments
 (0)