[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.

llvm-svn: 256580
This commit is contained in:
Manuel Jacob 2015-12-29 21:57:55 +00:00
parent 7a7abc9a3b
commit e3773d632e
1 changed files with 1 additions and 0 deletions

View 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");