driver: compile runtime package with nil check removed

Panics in the runtime are uncatchable throws, which will crash
the program anyway. We don't have to worry about if it panics at
the exact memory state as the program order.

With the previous CL, the effect of this CL is allowing the
backend to reorder instructions across a potentially faulting
instruction. The faulting instruction is not removed. So if there
is actually a bug in the runtime causing nil check to fail, it
still crash the program.

Change-Id: Ic87b0fb351be234b3b6727ecb97093257c07a7cf
Reviewed-on: https://go-review.googlesource.com/c/gollvm/+/182579
Reviewed-by: Than McIntosh <thanm@google.com>
diff --git a/driver/CompileGo.cpp b/driver/CompileGo.cpp
index dc23698..d6c3b8f 100644
--- a/driver/CompileGo.cpp
+++ b/driver/CompileGo.cpp
@@ -685,7 +685,9 @@
       driver_.reconcileOptionPair(gollvm::options::OPT_fgo_debug_optimization,
                                   gollvm::options::OPT_fno_go_debug_optimization,
                                   false);
-  args.nil_check_size_threshold = -1;
+  args.nil_check_size_threshold =
+      (args.compiling_runtime && args.pkgpath && strcmp(args.pkgpath, "runtime") == 0 ?
+       4096 : -1);
   args.linemap = linemap_.get();
   args.backend = bridge_.get();
   go_create_gogo (&args);