[PlaceSafepoints] Assert that the gc.safepoint_poll function is present in the module.
authorManuel Jacob <me@manueljacob.de>
Tue, 29 Dec 2015 21:57:55 +0000 (21:57 +0000)
committerManuel Jacob <me@manueljacob.de>
Tue, 29 Dec 2015 21:57:55 +0000 (21:57 +0000)
If running the PlaceSafepoints pass on a module which doesn't have the
gc.safepoint_poll function without disabling entry and backedge safepoints,
previously the pass crashed with an obscure error because of a null pointer.
Now it fails the assert instead.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@256580 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/PlaceSafepoints.cpp

index 7fe286f70c46fb64539c5cdcfdff1437945d75f7..28c610c2486a59fc516ac3877a9ecdf618482bbe 100644 (file)
@@ -762,6 +762,7 @@ InsertSafepointPoll(Instruction *InsertBefore,
   // path call - where we need to insert a safepoint (parsepoint).
 
   auto *F = M->getFunction(GCSafepointPollName);
+  assert(F && "gc.safepoint_poll function is missing");
   assert(F->getType()->getElementType() ==
          FunctionType::get(Type::getVoidTy(M->getContext()), false) &&
          "gc.safepoint_poll declared with wrong type");