From cf4ac69928eb17685958e6b3b01b97544560d90e Mon Sep 17 00:00:00 2001 From: Tom Stellard Date: Wed, 29 Aug 2012 09:58:28 -0400 Subject: [PATCH] radeon/llvm: Declare the interpolation intrinsics as ReadOnly This signals to the Dead Code Elimination pass that it is safe to remove these instructions when they are dead. --- src/gallium/drivers/radeon/SIInstrInfo.td | 1 + src/gallium/drivers/radeon/SIIntrinsics.td | 2 +- src/gallium/drivers/radeonsi/radeonsi_shader.c | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/gallium/drivers/radeon/SIInstrInfo.td b/src/gallium/drivers/radeon/SIInstrInfo.td index 81df55d135e..55882808659 100644 --- a/src/gallium/drivers/radeon/SIInstrInfo.td +++ b/src/gallium/drivers/radeon/SIInstrInfo.td @@ -364,6 +364,7 @@ class VINTRP op, dag outs, dag ins, string asm, list pattern> : let EncodingType = 11; // SIInstrEncodingType::VINTRP let Uses = [M0]; + let neverHasSideEffects = 1; } class VOP1 op, dag outs, dag ins, string asm, list pattern> : diff --git a/src/gallium/drivers/radeon/SIIntrinsics.td b/src/gallium/drivers/radeon/SIIntrinsics.td index b9544f10687..401325bf5b1 100644 --- a/src/gallium/drivers/radeon/SIIntrinsics.td +++ b/src/gallium/drivers/radeon/SIIntrinsics.td @@ -26,7 +26,7 @@ let TargetPrefix = "SI", isTarget = 1 in { /* Interpolation Intrinsics */ def int_SI_set_M0 : Intrinsic <[llvm_i32_ty], [llvm_i32_ty]>; - class Interp : Intrinsic <[llvm_float_ty], [llvm_i32_ty, llvm_i32_ty, llvm_i32_ty], []>; + class Interp : Intrinsic <[llvm_float_ty], [llvm_i32_ty, llvm_i32_ty, llvm_i32_ty], [IntrReadMem]>; def int_SI_fs_interp_linear_center : Interp; def int_SI_fs_interp_linear_centroid : Interp; diff --git a/src/gallium/drivers/radeonsi/radeonsi_shader.c b/src/gallium/drivers/radeonsi/radeonsi_shader.c index 98866c4ee1f..d07b050799d 100644 --- a/src/gallium/drivers/radeonsi/radeonsi_shader.c +++ b/src/gallium/drivers/radeonsi/radeonsi_shader.c @@ -329,8 +329,8 @@ static void declare_input_fs( args[1] = attr_number; args[2] = params; si_shader_ctx->radeon_bld.inputs[soa_index] = - lp_build_intrinsic(gallivm->builder, intr_name, - input_type, args, 3); + build_intrinsic(base->gallivm->builder, intr_name, + input_type, args, 3, LLVMReadOnlyAttribute); } } -- 2.30.2