[llvm] r263516 - [StatepointLowering] Move an assertion; NFCI

Sanjoy Das via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 14 18:16:32 PDT 2016


Author: sanjoy
Date: Mon Mar 14 20:16:31 2016
New Revision: 263516

URL: http://llvm.org/viewvc/llvm-project?rev=263516&view=rev
Log:
[StatepointLowering] Move an assertion; NFCI

Instead of running an explicit loop over `gc.relocate` calls hanging off
of a `gc.statepoint`, assert the validity of the type of the value being
relocated in `visitRelocate`.

Modified:
    llvm/trunk/lib/CodeGen/SelectionDAG/StatepointLowering.cpp

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/StatepointLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/StatepointLowering.cpp?rev=263516&r1=263515&r2=263516&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/StatepointLowering.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/StatepointLowering.cpp Mon Mar 14 20:16:31 2016
@@ -534,12 +534,6 @@ static void lowerStatepointMetaArgs(Smal
              "non gc managed derived pointer found in statepoint");
     }
   }
-  for (const GCRelocateInst *GCR : Relocations) {
-    auto Opt = S.isGCManagedPointer(GCR->getType()->getScalarType());
-    if (Opt.hasValue()) {
-      assert(Opt.getValue() && "non gc managed pointer relocated");
-    }
-  }
 #endif
 
   // Before we actually start lowering (and allocating spill slots for values),
@@ -872,6 +866,10 @@ void SelectionDAGBuilder::visitGCRelocat
   // different basic blocks.
   if (Relocate.getStatepoint()->getParent() == Relocate.getParent())
     StatepointLowering.relocCallVisited(Relocate);
+
+  auto *Ty = Relocate.getType()->getScalarType();
+  if (auto IsManaged = GFI->getStrategy().isGCManagedPointer(Ty))
+    assert(*IsManaged && "Non gc managed pointer relocated!");
 #endif
 
   const Value *DerivedPtr = Relocate.getDerivedPtr();




More information about the llvm-commits mailing list