diff --git a/src/gallium/auxiliary/draw/draw_llvm.c b/src/gallium/auxiliary/draw/draw_llvm.c index 1ecff33882f..50c157bc3cc 100644 --- a/src/gallium/auxiliary/draw/draw_llvm.c +++ b/src/gallium/auxiliary/draw/draw_llvm.c @@ -3629,12 +3629,10 @@ draw_tcs_llvm_create_variant(struct draw_llvm *llvm, draw_tcs_llvm_dump_variant_key(&variant->key); } - lp_build_coro_declare_malloc_hooks(variant->gallivm); draw_tcs_llvm_generate(llvm, variant); gallivm_compile_module(variant->gallivm); - lp_build_coro_add_malloc_hooks(variant->gallivm); variant->jit_func = (draw_tcs_jit_func) gallivm_jit_function(variant->gallivm, variant->function); diff --git a/src/gallium/auxiliary/gallivm/lp_bld_init.c b/src/gallium/auxiliary/gallivm/lp_bld_init.c index cc410cc1928..584ea738668 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_init.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_init.c @@ -37,6 +37,7 @@ #include "lp_bld_debug.h" #include "lp_bld_misc.h" #include "lp_bld_init.h" +#include "lp_bld_coro.h" #include "lp_bld_printf.h" #include @@ -409,6 +410,7 @@ init_gallivm_state(struct gallivm_state *gallivm, const char *name, if (!create_pass_manager(gallivm)) goto fail; + lp_build_coro_declare_malloc_hooks(gallivm); return TRUE; fail: @@ -667,6 +669,8 @@ gallivm_compile_module(struct gallivm_state *gallivm) lp_init_clock_hook(gallivm); LLVMAddGlobalMapping(gallivm->engine, gallivm->get_time_hook, os_time_get_nano); + lp_build_coro_add_malloc_hooks(gallivm); + if (gallivm_debug & GALLIVM_DEBUG_ASM) { LLVMValueRef llvm_func = LLVMGetFirstFunction(gallivm->module); diff --git a/src/gallium/drivers/llvmpipe/lp_state_cs.c b/src/gallium/drivers/llvmpipe/lp_state_cs.c index 8554a7f45f6..1ba5b44ae8b 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_cs.c +++ b/src/gallium/drivers/llvmpipe/lp_state_cs.c @@ -148,8 +148,6 @@ generate_compute(struct llvmpipe_context *lp, } } - lp_build_coro_declare_malloc_hooks(gallivm); - if (variant->gallivm->cache->data_size) return; @@ -830,7 +828,6 @@ generate_variant(struct llvmpipe_context *lp, gallivm_compile_module(variant->gallivm); - lp_build_coro_add_malloc_hooks(variant->gallivm); variant->nr_instrs += lp_build_count_ir_module(variant->gallivm->module); variant->jit_function = (lp_jit_cs_func)