summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolai Hähnle <nicolai.haehnle@amd.com>2016-08-09 12:26:37 +0200
committerNicolai Hähnle <nicolai.haehnle@amd.com>2016-08-10 21:25:13 +0200
commit16b3bf36d21be3a8a8c9f1ef85272006d7f39bb5 (patch)
tree24355cc3e942db5d5e11f59e7f51715f48a11ee4
parentd845fb950e65366a83775b392053d83aa01d7d1d (diff)
gallium/radeon: use lp_build_alloca_undefarrays
Avoid building all those store 0 / store undef instrucction pairs that end up getting removed anyway.
-rw-r--r--src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c17
1 files changed, 4 insertions, 13 deletions
diff --git a/src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c b/src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c
index 88c7b3c1d1..8076443f08 100644
--- a/src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c
+++ b/src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c
@@ -502,15 +502,6 @@ static LLVMValueRef fetch_system_value(struct lp_build_tgsi_context *bld_base,
return bitcast(bld_base, type, cval);
}
-static LLVMValueRef si_build_alloca_undef(struct gallivm_state *gallivm,
- LLVMTypeRef type,
- const char *name)
-{
- LLVMValueRef ptr = lp_build_alloca(gallivm, type, name);
- LLVMBuildStore(gallivm->builder, LLVMGetUndef(type), ptr);
- return ptr;
-}
-
static void emit_declaration(struct lp_build_tgsi_context *bld_base,
const struct tgsi_full_declaration *decl)
{
@@ -524,7 +515,7 @@ static void emit_declaration(struct lp_build_tgsi_context *bld_base,
for (idx = decl->Range.First; idx <= decl->Range.Last; idx++) {
unsigned chan;
for (chan = 0; chan < TGSI_NUM_CHANNELS; chan++) {
- ctx->soa.addr[idx][chan] = si_build_alloca_undef(
+ ctx->soa.addr[idx][chan] = lp_build_alloca_undef(
&ctx->gallivm,
ctx->soa.bld_base.uint_bld.elem_type, "");
}
@@ -588,7 +579,7 @@ static void emit_declaration(struct lp_build_tgsi_context *bld_base,
first + i / 4, "xyzw"[i % 4]);
#endif
ctx->temps[first * TGSI_NUM_CHANNELS + i] =
- si_build_alloca_undef(bld_base->base.gallivm,
+ lp_build_alloca_undef(bld_base->base.gallivm,
bld_base->base.vec_type,
name);
}
@@ -606,7 +597,7 @@ static void emit_declaration(struct lp_build_tgsi_context *bld_base,
* a shader ever reads from a channel that
* it never writes to.
*/
- ctx->undef_alloca = si_build_alloca_undef(
+ ctx->undef_alloca = lp_build_alloca_undef(
bld_base->base.gallivm,
bld_base->base.vec_type, "undef");
}
@@ -655,7 +646,7 @@ static void emit_declaration(struct lp_build_tgsi_context *bld_base,
unsigned chan;
assert(idx < RADEON_LLVM_MAX_OUTPUTS);
for (chan = 0; chan < TGSI_NUM_CHANNELS; chan++) {
- ctx->soa.outputs[idx][chan] = si_build_alloca_undef(
+ ctx->soa.outputs[idx][chan] = lp_build_alloca_undef(
&ctx->gallivm,
ctx->soa.bld_base.base.elem_type, "");
}