ac: make use of ac_get_llvm_num_components() helper
authorTimothy Arceri <tarceri@itsqueeze.com>
Fri, 23 Feb 2018 05:42:04 +0000 (16:42 +1100)
committerTimothy Arceri <tarceri@itsqueeze.com>
Mon, 26 Feb 2018 00:43:47 +0000 (11:43 +1100)
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
src/amd/common/ac_nir_to_llvm.c

index cccc687157c8af19c9c21aa54845adc2f850786b..2c5a6e6cf6d8c81aa48450351c81961bbbdb0386 100644 (file)
@@ -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)