Whenever llvm removes an intrinsic (we're using), we're hitting segfaults
due to llvm doing calls to address 0 in the jitted code instead.
However, Jose figured out we can actually detect this with
LLVMGetIntrinsicID(), so use this to abort, so we don't have to wonder
what got broken. (Of course, someone still needs to fix the code to
no longer use this intrinsic.)
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
function = lp_declare_intrinsic(module, name, ret_type, arg_types, num_args);
+ /*
+ * If llvm removes an intrinsic we use, we'll hit this abort (rather
+ * than a call to address zero in the jited code).
+ */
+ if (LLVMGetIntrinsicID(function) == 0) {
+ _debug_printf("llvm (version 0x%x) found no intrinsic for %s, going to crash...\n",
+ HAVE_LLVM, name);
+ abort();
+ }
+
if (!set_callsite_attrs)
lp_add_func_attributes(function, attr_mask);