[Mesa-dev] [PATCH v2 20/20] ac: rework ac_llvm_extract_elem()
Timothy Arceri
tarceri at itsqueeze.com
Wed Dec 13 07:53:12 UTC 2017
Simplifies the logic a little and asserts index is 0.
Suggested-by: Nicolai Hähnle <nhaehnle at gmail.com>
---
src/amd/common/ac_llvm_build.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/amd/common/ac_llvm_build.c b/src/amd/common/ac_llvm_build.c
index faa08b6301c..a31f225e177 100644
--- a/src/amd/common/ac_llvm_build.c
+++ b/src/amd/common/ac_llvm_build.c
@@ -106,24 +106,24 @@ ac_get_llvm_num_components(LLVMValueRef value)
? LLVMGetVectorSize(type)
: 1;
return num_components;
}
LLVMValueRef
ac_llvm_extract_elem(struct ac_llvm_context *ac,
LLVMValueRef value,
int index)
{
- int count = ac_get_llvm_num_components(value);
-
- if (count == 1)
+ if (LLVMGetTypeKind(LLVMTypeOf(value)) != LLVMVectorTypeKind) {
+ assert(index == 0);
return value;
+ }
return LLVMBuildExtractElement(ac->builder, value,
LLVMConstInt(ac->i32, index, false), "");
}
unsigned
ac_get_type_size(LLVMTypeRef type)
{
LLVMTypeKind kind = LLVMGetTypeKind(type);
--
2.14.3
More information about the mesa-dev
mailing list