mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-28 16:10:23 +01:00
gallivm: Fix segfaul when inserting allocas in an empty function.
This commit is contained in:
parent
2c2debaea7
commit
36e28d42b3
1 changed files with 10 additions and 3 deletions
|
|
@ -821,8 +821,11 @@ lp_build_alloca(LLVMBuilderRef builder,
|
|||
LLVMBuilderRef first_builder = LLVMCreateBuilder();
|
||||
LLVMValueRef res;
|
||||
|
||||
LLVMPositionBuilderAtEnd(first_builder, first_block);
|
||||
LLVMPositionBuilderBefore(first_builder, first_instr);
|
||||
if (first_instr) {
|
||||
LLVMPositionBuilderBefore(first_builder, first_instr);
|
||||
} else {
|
||||
LLVMPositionBuilderAtEnd(first_builder, first_block);
|
||||
}
|
||||
|
||||
res = LLVMBuildAlloca(first_builder, type, name);
|
||||
|
||||
|
|
@ -859,7 +862,11 @@ lp_build_array_alloca(LLVMBuilderRef builder,
|
|||
LLVMBuilderRef first_builder = LLVMCreateBuilder();
|
||||
LLVMValueRef res;
|
||||
|
||||
LLVMPositionBuilderBefore(first_builder, first_instr);
|
||||
if (first_instr) {
|
||||
LLVMPositionBuilderBefore(first_builder, first_instr);
|
||||
} else {
|
||||
LLVMPositionBuilderAtEnd(first_builder, first_block);
|
||||
}
|
||||
|
||||
res = LLVMBuildArrayAlloca(first_builder, type, count, name);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue