gallivm: skip operations if we have a cached object.
authorDave Airlie <airlied@redhat.com>
Fri, 15 May 2020 00:11:56 +0000 (10:11 +1000)
committerDave Airlie <airlied@redhat.com>
Wed, 10 Jun 2020 20:05:40 +0000 (06:05 +1000)
If the object is loaded from the cache, a bunch of gallivm/llvm
interactions can be skipped.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5049>

src/gallium/auxiliary/gallivm/lp_bld_init.c

index 06214014290430207c47b8d3101dee36a71f1a8a..43d020832875ff89202f48df098a9a3e74eb232a 100644 (file)
@@ -573,6 +573,10 @@ gallivm_compile_module(struct gallivm_state *gallivm)
       gallivm->builder = NULL;
    }
 
+   if (gallivm->cache && gallivm->cache->data_size) {
+      goto skip_cached;
+   }
+
    /* Dump bitcode to a file */
    if (gallivm_debug & GALLIVM_DEBUG_DUMP_BC) {
       char filename[256];
@@ -640,6 +644,7 @@ gallivm_compile_module(struct gallivm_state *gallivm)
     * implicitly created by the EngineBuilder in
     * lp_build_create_jit_compiler_for_module()
     */
+ skip_cached:
    LLVMSetDataLayout(gallivm->module, "");
    assert(!gallivm->engine);
    if (!init_gallivm_engine(gallivm)) {