radeonsi: avoid a crash in gallivm_dispose_target_library_info
authorMarek Olšák <marek.olsak@amd.com>
Mon, 9 Apr 2018 23:55:10 +0000 (19:55 -0400)
committerMarek Olšák <marek.olsak@amd.com>
Fri, 27 Apr 2018 21:56:04 +0000 (17:56 -0400)
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Tested-by: Benedikt Schemmer <ben at besd.de>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
src/gallium/drivers/radeonsi/si_pipe.c

index aa92f889e6e9f913a7b4c6200c7a039a719c0719..c7f1e27f6bab4bb646b4646e4854b289ca4db545 100644 (file)
@@ -164,8 +164,11 @@ static void si_destroy_compiler(struct si_compiler *compiler)
                LLVMDisposeMessage((char*)compiler->data_layout);
        if (compiler->passmgr)
                LLVMDisposePassManager(compiler->passmgr);
+#if HAVE_LLVM < 0x0500 || HAVE_LLVM >= 0x0700
+       /* This crashes on LLVM 5.0 and 6.0 and Ubuntu 18.04, so leak it there. */
        if (compiler->target_library_info)
                gallivm_dispose_target_library_info(compiler->target_library_info);
+#endif
        if (compiler->tm)
                LLVMDisposeTargetMachine(compiler->tm);
 }