[Mesa-dev] [PATCH] ac/nir_to_llvm: make sure to we are comparing ints in a couple of places
Timothy Arceri
tarceri at itsqueeze.com
Mon Mar 18 09:30:53 UTC 2019
Fixes llvm validation error in a Deus Ex shader on radeonsi.
Both operands to ICmp instruction are not of the same type!
---
src/amd/common/ac_nir_to_llvm.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c
index 0ca3f83a248..1dfb865a41b 100644
--- a/src/amd/common/ac_nir_to_llvm.c
+++ b/src/amd/common/ac_nir_to_llvm.c
@@ -195,7 +195,10 @@ static LLVMValueRef emit_int_cmp(struct ac_llvm_context *ctx,
LLVMIntPredicate pred, LLVMValueRef src0,
LLVMValueRef src1)
{
- LLVMValueRef result = LLVMBuildICmp(ctx->builder, pred, src0, src1, "");
+ LLVMValueRef result;
+ src0 = ac_to_integer(ctx, src0);
+ src1 = ac_to_integer(ctx, src1);
+ result = LLVMBuildICmp(ctx->builder, pred, src0, src1, "");
return LLVMBuildSelect(ctx->builder, result,
LLVMConstInt(ctx->i32, 0xFFFFFFFF, false),
ctx->i32_0, "");
@@ -281,6 +284,8 @@ static LLVMValueRef emit_minmax_int(struct ac_llvm_context *ctx,
LLVMIntPredicate pred,
LLVMValueRef src0, LLVMValueRef src1)
{
+ src0 = ac_to_integer(ctx, src0);
+ src1 = ac_to_integer(ctx, src1);
return LLVMBuildSelect(ctx->builder,
LLVMBuildICmp(ctx->builder, pred, src0, src1, ""),
src0,
--
2.20.1
More information about the mesa-dev
mailing list