aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/radeon/radeon_llvm_util.c
diff options
context:
space:
mode:
authorTom Stellard <[email protected]>2013-05-02 18:25:53 -0400
committerTom Stellard <[email protected]>2013-05-06 09:06:00 -0700
commit7cc98ea88f5ec24369ba8123007637e47f093726 (patch)
tree40610aae12e79e1b069dc57d7a36f05a803bd842 /src/gallium/drivers/radeon/radeon_llvm_util.c
parentbd850cb4f2c77e2eb6716c865c40b9976633fc23 (diff)
radeon/llvm: Don't use the global context when parsing LLVM IR
This leads to crashes when multiple threads try to compile compute shaders in the same time. Fixes a crash in bfgminer when using more than one thread.
Diffstat (limited to 'src/gallium/drivers/radeon/radeon_llvm_util.c')
-rw-r--r--src/gallium/drivers/radeon/radeon_llvm_util.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/gallium/drivers/radeon/radeon_llvm_util.c b/src/gallium/drivers/radeon/radeon_llvm_util.c
index 2582d9cf118..e3b0d638b71 100644
--- a/src/gallium/drivers/radeon/radeon_llvm_util.c
+++ b/src/gallium/drivers/radeon/radeon_llvm_util.c
@@ -34,11 +34,12 @@ LLVMModuleRef radeon_llvm_parse_bitcode(const unsigned char * bitcode,
unsigned bitcode_len)
{
LLVMMemoryBufferRef buf;
- LLVMModuleRef module = LLVMModuleCreateWithName("radeon");
+ LLVMContextRef ctx = LLVMContextCreate();
+ LLVMModuleRef module;
buf = LLVMCreateMemoryBufferWithMemoryRangeCopy((const char*)bitcode,
bitcode_len, "radeon");
- LLVMParseBitcode(buf, &module, NULL);
+ LLVMParseBitcodeInContext(ctx, buf, &module, NULL);
return module;
}