Mesa (master): ac: make use of ac_get_llvm_num_components() helper

Timothy Arceri tarceri at kemper.freedesktop.org
Mon Feb 26 00:44:55 UTC 2018


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

Author: Timothy Arceri <tarceri at itsqueeze.com>
Date:   Fri Feb 23 16:42:04 2018 +1100

ac: make use of ac_get_llvm_num_components() helper

Reviewed-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>

---

 src/amd/common/ac_nir_to_llvm.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c
index cccc687157..2c5a6e6cf6 100644
--- a/src/amd/common/ac_nir_to_llvm.c
+++ b/src/amd/common/ac_nir_to_llvm.c
@@ -1207,11 +1207,7 @@ static LLVMValueRef get_alu_src(struct ac_nir_context *ctx,
 	bool need_swizzle = false;
 
 	assert(value);
-	LLVMTypeRef type = LLVMTypeOf(value);
-	unsigned src_components = LLVMGetTypeKind(type) == LLVMVectorTypeKind
-	                              ? LLVMGetVectorSize(type)
-	                              : 1;
-
+	unsigned src_components = ac_get_llvm_num_components(value);
 	for (unsigned i = 0; i < num_components; ++i) {
 		assert(src.swizzle[i] < src_components);
 		if (src.swizzle[i] != i)




More information about the mesa-commit mailing list