[llvm] [PlaceSafepoints] Report usage error instead of asserting on invalid gc.safepoint_poll (PR #205520)
Arda Serdar Pektezol via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 24 03:12:49 PDT 2026
================
@@ -629,11 +629,14 @@ InsertSafepointPoll(BasicBlock::iterator 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->getFunctionType() ==
- FunctionType::get(Type::getVoidTy(M->getContext()), false) &&
- "gc.safepoint_poll declared with wrong type");
- assert(!F->empty() && "gc.safepoint_poll must be a non-empty function");
+ if (!F) {
+ reportFatalUsageError("gc.safepoint_poll function is missing");
----------------
pektezol wrote:
I think other asserts besides this should stay. On non-assert opt, we crash due to nullderef on `F`. Can you add test cases for the other cases (`F->getFunctionType()`... and `F->empty()`) and see if it crashes on non-assert build with the asserts or not?
https://github.com/llvm/llvm-project/pull/205520
More information about the llvm-commits
mailing list