Mesa (master): ac: simplify LLVM alloca helpers

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sun Oct 7 01:50:33 UTC 2018


Module: Mesa
Branch: master
Commit: 82f5f89bf66d6fd968611be2de45e63bd165b50c
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=82f5f89bf66d6fd968611be2de45e63bd165b50c

Author: Marek Olšák <marek.olsak at amd.com>
Date:   Fri Sep 21 03:27:06 2018 -0400

ac: simplify LLVM alloca helpers

---

 src/amd/common/ac_llvm_build.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/src/amd/common/ac_llvm_build.c b/src/amd/common/ac_llvm_build.c
index 93bd35239b..81158940b8 100644
--- a/src/amd/common/ac_llvm_build.c
+++ b/src/amd/common/ac_llvm_build.c
@@ -2747,7 +2747,7 @@ void ac_build_uif(struct ac_llvm_context *ctx, LLVMValueRef value,
 	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)
 {
 	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);
-	LLVMBuildStore(builder, LLVMConstNull(type), res);
-
 	LLVMDisposeBuilder(first_builder);
-
 	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)
 {
-	LLVMValueRef ptr = ac_build_alloca(ac, type, name);
-	LLVMBuildStore(ac->builder, LLVMGetUndef(type), ptr);
+	LLVMValueRef ptr = ac_build_alloca_undef(ac, type, name);
+	LLVMBuildStore(ac->builder, LLVMConstNull(type), ptr);
 	return ptr;
 }
 




More information about the mesa-commit mailing list