[llvm] r256580 - [PlaceSafepoints] Assert that the gc.safepoint_poll function is present in the module.

Manuel Jacob via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 29 13:57:56 PST 2015


Author: mjacob
Date: Tue Dec 29 15:57:55 2015
New Revision: 256580

URL: http://llvm.org/viewvc/llvm-project?rev=256580&view=rev
Log:
[PlaceSafepoints] Assert that the gc.safepoint_poll function is present in the module.

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.

Modified:
    llvm/trunk/lib/Transforms/Scalar/PlaceSafepoints.cpp

Modified: llvm/trunk/lib/Transforms/Scalar/PlaceSafepoints.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/PlaceSafepoints.cpp?rev=256580&r1=256579&r2=256580&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/PlaceSafepoints.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/PlaceSafepoints.cpp Tue Dec 29 15:57:55 2015
@@ -762,6 +762,7 @@ InsertSafepointPoll(Instruction *InsertB
   // 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");




More information about the llvm-commits mailing list