ac/llvm: Make sure to always emit integer comparison for nir_op_ieq.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9201>
This commit is contained in:
Timur Kristóf 2021-02-19 17:30:32 +01:00 committed by Marge Bot
parent 252b5d5ecd
commit 00c014aab2
1 changed files with 2 additions and 11 deletions

View File

@ -139,17 +139,8 @@ static LLVMValueRef get_alu_src(struct ac_nir_context *ctx, nir_alu_src src,
static LLVMValueRef emit_int_cmp(struct ac_llvm_context *ctx, LLVMIntPredicate pred,
LLVMValueRef src0, LLVMValueRef src1)
{
LLVMTypeRef src0_type = LLVMTypeOf(src0);
LLVMTypeRef src1_type = LLVMTypeOf(src1);
if (LLVMGetTypeKind(src0_type) == LLVMPointerTypeKind &&
LLVMGetTypeKind(src1_type) != LLVMPointerTypeKind) {
src1 = LLVMBuildIntToPtr(ctx->builder, src1, src0_type, "");
} else if (LLVMGetTypeKind(src1_type) == LLVMPointerTypeKind &&
LLVMGetTypeKind(src0_type) != LLVMPointerTypeKind) {
src0 = LLVMBuildIntToPtr(ctx->builder, src0, src1_type, "");
}
src0 = ac_to_integer(ctx, src0);
src1 = ac_to_integer(ctx, src1);
return LLVMBuildICmp(ctx->builder, pred, src0, src1, "");
}