mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-23 19:50:11 +01:00
ac: simplify LLVM alloca helpers
This commit is contained in:
parent
a668c8d6ba
commit
82f5f89bf6
1 changed files with 4 additions and 7 deletions
|
|
@ -2747,7 +2747,7 @@ void ac_build_uif(struct ac_llvm_context *ctx, LLVMValueRef value,
|
||||||
if_cond_emit(ctx, cond, label_id);
|
if_cond_emit(ctx, cond, label_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
LLVMValueRef ac_build_alloca(struct ac_llvm_context *ac, LLVMTypeRef type,
|
LLVMValueRef ac_build_alloca_undef(struct ac_llvm_context *ac, LLVMTypeRef type,
|
||||||
const char *name)
|
const char *name)
|
||||||
{
|
{
|
||||||
LLVMBuilderRef builder = ac->builder;
|
LLVMBuilderRef builder = ac->builder;
|
||||||
|
|
@ -2765,18 +2765,15 @@ LLVMValueRef ac_build_alloca(struct ac_llvm_context *ac, LLVMTypeRef type,
|
||||||
}
|
}
|
||||||
|
|
||||||
res = LLVMBuildAlloca(first_builder, type, name);
|
res = LLVMBuildAlloca(first_builder, type, name);
|
||||||
LLVMBuildStore(builder, LLVMConstNull(type), res);
|
|
||||||
|
|
||||||
LLVMDisposeBuilder(first_builder);
|
LLVMDisposeBuilder(first_builder);
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
LLVMValueRef ac_build_alloca_undef(struct ac_llvm_context *ac,
|
LLVMValueRef ac_build_alloca(struct ac_llvm_context *ac,
|
||||||
LLVMTypeRef type, const char *name)
|
LLVMTypeRef type, const char *name)
|
||||||
{
|
{
|
||||||
LLVMValueRef ptr = ac_build_alloca(ac, type, name);
|
LLVMValueRef ptr = ac_build_alloca_undef(ac, type, name);
|
||||||
LLVMBuildStore(ac->builder, LLVMGetUndef(type), ptr);
|
LLVMBuildStore(ac->builder, LLVMConstNull(type), ptr);
|
||||||
return ptr;
|
return ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue