radeon/llvm: Declare the interpolation intrinsics as ReadOnly
authorTom Stellard <thomas.stellard@amd.com>
Wed, 29 Aug 2012 13:58:28 +0000 (09:58 -0400)
committerTom Stellard <thomas.stellard@amd.com>
Wed, 29 Aug 2012 19:52:10 +0000 (15:52 -0400)
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
src/gallium/drivers/radeon/SIIntrinsics.td
src/gallium/drivers/radeonsi/radeonsi_shader.c

index 81df55d135efba65f1ee7f94cb660f09fa24649e..5588280865998bf54890575a32fd04a06b6eeeb8 100644 (file)
@@ -364,6 +364,7 @@ class VINTRP <bits <2> op, dag outs, dag ins, string asm, list<dag> pattern> :
   let EncodingType = 11; // SIInstrEncodingType::VINTRP
 
   let Uses = [M0];
+  let neverHasSideEffects = 1;
 }
 
 class VOP1 <bits<8> op, dag outs, dag ins, string asm, list<dag> pattern> :
index b9544f10687946b1fe21024fcffaa0c5d0e35680..401325bf5b11b532700817266281bef985aca30a 100644 (file)
@@ -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;
index 98866c4ee1f9faa3be6de27cd85ead55cf507c5f..d07b050799d17e44e37079a1c55b516889f2630d 100644 (file)
@@ -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);
        }
 }