test/tint/builtins/gen: Use returned value

It appears that FXC and DXC do some validation post dead-code-elimination.
These tests have been updated so that the return value is assigned to a storage buffer, ensuring that all validation is performed.

Many DXC tests are affected by https://github.com/microsoft/DirectXShaderCompiler/issues/5082, which have been SKIP'ed.

Fixed: tint:1859
Change-Id: I0001a9a9821846cd0855c3d8ce2bec79ab8e64ef
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/122662
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: James Price <jrprice@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
diff --git a/test/tint/builtins/gen/var/textureSampleCompare/1912e5.wgsl b/test/tint/builtins/gen/var/textureSampleCompare/1912e5.wgsl
index cbc3437..8a0bfc2 100644
--- a/test/tint/builtins/gen/var/textureSampleCompare/1912e5.wgsl
+++ b/test/tint/builtins/gen/var/textureSampleCompare/1912e5.wgsl
@@ -29,7 +29,9 @@
   var arg_3 = 1u;
   var arg_4 = 1.f;
   var res: f32 = textureSampleCompare(arg_0, arg_1, arg_2, arg_3, arg_4);
+  prevent_dce = res;
 }
+@group(2) @binding(0) var<storage, read_write> prevent_dce : f32;
 
 @fragment
 fn fragment_main() {
diff --git a/test/tint/builtins/gen/var/textureSampleCompare/1912e5.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureSampleCompare/1912e5.wgsl.expected.dxc.hlsl
index 5b8163f..094347a 100644
--- a/test/tint/builtins/gen/var/textureSampleCompare/1912e5.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/var/textureSampleCompare/1912e5.wgsl.expected.dxc.hlsl
@@ -1,11 +1,13 @@
 TextureCubeArray arg_0 : register(t0, space1);
 SamplerComparisonState arg_1 : register(s1, space1);
+RWByteAddressBuffer prevent_dce : register(u0, space2);
 
 void textureSampleCompare_1912e5() {
   float3 arg_2 = (1.0f).xxx;
   uint arg_3 = 1u;
   float arg_4 = 1.0f;
   float res = arg_0.SampleCmp(arg_1, float4(arg_2, float(arg_3)), arg_4);
+  prevent_dce.Store(0u, asuint(res));
 }
 
 void fragment_main() {
diff --git a/test/tint/builtins/gen/var/textureSampleCompare/1912e5.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureSampleCompare/1912e5.wgsl.expected.fxc.hlsl
index 5b8163f..094347a 100644
--- a/test/tint/builtins/gen/var/textureSampleCompare/1912e5.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/var/textureSampleCompare/1912e5.wgsl.expected.fxc.hlsl
@@ -1,11 +1,13 @@
 TextureCubeArray arg_0 : register(t0, space1);
 SamplerComparisonState arg_1 : register(s1, space1);
+RWByteAddressBuffer prevent_dce : register(u0, space2);
 
 void textureSampleCompare_1912e5() {
   float3 arg_2 = (1.0f).xxx;
   uint arg_3 = 1u;
   float arg_4 = 1.0f;
   float res = arg_0.SampleCmp(arg_1, float4(arg_2, float(arg_3)), arg_4);
+  prevent_dce.Store(0u, asuint(res));
 }
 
 void fragment_main() {
diff --git a/test/tint/builtins/gen/var/textureSampleCompare/1912e5.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleCompare/1912e5.wgsl.expected.msl
index b92236a..0378540 100644
--- a/test/tint/builtins/gen/var/textureSampleCompare/1912e5.wgsl.expected.msl
+++ b/test/tint/builtins/gen/var/textureSampleCompare/1912e5.wgsl.expected.msl
@@ -1,15 +1,16 @@
 #include <metal_stdlib>
 
 using namespace metal;
-void textureSampleCompare_1912e5(depthcube_array<float, access::sample> tint_symbol, sampler tint_symbol_1) {
+void textureSampleCompare_1912e5(depthcube_array<float, access::sample> tint_symbol, sampler tint_symbol_1, device float* const tint_symbol_2) {
   float3 arg_2 = float3(1.0f);
   uint arg_3 = 1u;
   float arg_4 = 1.0f;
   float res = tint_symbol.sample_compare(tint_symbol_1, arg_2, arg_3, arg_4);
+  *(tint_symbol_2) = res;
 }
 
-fragment void fragment_main(depthcube_array<float, access::sample> tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) {
-  textureSampleCompare_1912e5(tint_symbol_2, tint_symbol_3);
+fragment void fragment_main(depthcube_array<float, access::sample> tint_symbol_3 [[texture(0)]], sampler tint_symbol_4 [[sampler(0)]], device float* tint_symbol_5 [[buffer(0)]]) {
+  textureSampleCompare_1912e5(tint_symbol_3, tint_symbol_4, tint_symbol_5);
   return;
 }
 
diff --git a/test/tint/builtins/gen/var/textureSampleCompare/1912e5.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleCompare/1912e5.wgsl.expected.spvasm
index 4b70484..68148a6 100644
--- a/test/tint/builtins/gen/var/textureSampleCompare/1912e5.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/var/textureSampleCompare/1912e5.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 44
+; Bound: 51
 ; Schema: 0
                OpCapability Shader
                OpCapability SampledCubeArray
@@ -10,6 +10,9 @@
                OpExecutionMode %fragment_main OriginUpperLeft
                OpName %arg_0 "arg_0"
                OpName %arg_1 "arg_1"
+               OpName %prevent_dce_block "prevent_dce_block"
+               OpMemberName %prevent_dce_block 0 "inner"
+               OpName %prevent_dce "prevent_dce"
                OpName %textureSampleCompare_1912e5 "textureSampleCompare_1912e5"
                OpName %arg_2 "arg_2"
                OpName %arg_3 "arg_3"
@@ -20,6 +23,10 @@
                OpDecorate %arg_0 Binding 0
                OpDecorate %arg_1 DescriptorSet 1
                OpDecorate %arg_1 Binding 1
+               OpDecorate %prevent_dce_block Block
+               OpMemberDecorate %prevent_dce_block 0 Offset 0
+               OpDecorate %prevent_dce DescriptorSet 2
+               OpDecorate %prevent_dce Binding 0
       %float = OpTypeFloat 32
           %3 = OpTypeImage %float Cube 0 1 0 1 Unknown
 %_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
@@ -27,47 +34,55 @@
           %7 = OpTypeSampler
 %_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7
       %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant
+%prevent_dce_block = OpTypeStruct %float
+%_ptr_StorageBuffer_prevent_dce_block = OpTypePointer StorageBuffer %prevent_dce_block
+%prevent_dce = OpVariable %_ptr_StorageBuffer_prevent_dce_block StorageBuffer
        %void = OpTypeVoid
-          %8 = OpTypeFunction %void
+         %11 = OpTypeFunction %void
     %v3float = OpTypeVector %float 3
     %float_1 = OpConstant %float 1
-         %14 = OpConstantComposite %v3float %float_1 %float_1 %float_1
+         %17 = OpConstantComposite %v3float %float_1 %float_1 %float_1
 %_ptr_Function_v3float = OpTypePointer Function %v3float
-         %17 = OpConstantNull %v3float
+         %20 = OpConstantNull %v3float
        %uint = OpTypeInt 32 0
      %uint_1 = OpConstant %uint 1
 %_ptr_Function_uint = OpTypePointer Function %uint
-         %22 = OpConstantNull %uint
+         %25 = OpConstantNull %uint
 %_ptr_Function_float = OpTypePointer Function %float
-         %25 = OpConstantNull %float
-         %29 = OpTypeSampledImage %3
+         %28 = OpConstantNull %float
+         %32 = OpTypeSampledImage %3
     %v4float = OpTypeVector %float 4
-%textureSampleCompare_1912e5 = OpFunction %void None %8
-         %11 = OpLabel
-      %arg_2 = OpVariable %_ptr_Function_v3float Function %17
-      %arg_3 = OpVariable %_ptr_Function_uint Function %22
-      %arg_4 = OpVariable %_ptr_Function_float Function %25
-        %res = OpVariable %_ptr_Function_float Function %25
-               OpStore %arg_2 %14
+     %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float
+%textureSampleCompare_1912e5 = OpFunction %void None %11
+         %14 = OpLabel
+      %arg_2 = OpVariable %_ptr_Function_v3float Function %20
+      %arg_3 = OpVariable %_ptr_Function_uint Function %25
+      %arg_4 = OpVariable %_ptr_Function_float Function %28
+        %res = OpVariable %_ptr_Function_float Function %28
+               OpStore %arg_2 %17
                OpStore %arg_3 %uint_1
                OpStore %arg_4 %float_1
-         %27 = OpLoad %7 %arg_1
-         %28 = OpLoad %3 %arg_0
-         %30 = OpSampledImage %29 %28 %27
-         %32 = OpLoad %v3float %arg_2
-         %33 = OpCompositeExtract %float %32 0
-         %34 = OpCompositeExtract %float %32 1
-         %35 = OpCompositeExtract %float %32 2
-         %37 = OpLoad %uint %arg_3
-         %36 = OpConvertUToF %float %37
-         %38 = OpCompositeConstruct %v4float %33 %34 %35 %36
-         %39 = OpLoad %float %arg_4
-         %26 = OpImageSampleDrefImplicitLod %float %30 %38 %39
-               OpStore %res %26
+         %30 = OpLoad %7 %arg_1
+         %31 = OpLoad %3 %arg_0
+         %33 = OpSampledImage %32 %31 %30
+         %35 = OpLoad %v3float %arg_2
+         %36 = OpCompositeExtract %float %35 0
+         %37 = OpCompositeExtract %float %35 1
+         %38 = OpCompositeExtract %float %35 2
+         %40 = OpLoad %uint %arg_3
+         %39 = OpConvertUToF %float %40
+         %41 = OpCompositeConstruct %v4float %36 %37 %38 %39
+         %42 = OpLoad %float %arg_4
+         %29 = OpImageSampleDrefImplicitLod %float %33 %41 %42
+               OpStore %res %29
+         %46 = OpAccessChain %_ptr_StorageBuffer_float %prevent_dce %uint_0
+         %47 = OpLoad %float %res
+               OpStore %46 %47
                OpReturn
                OpFunctionEnd
-%fragment_main = OpFunction %void None %8
-         %42 = OpLabel
-         %43 = OpFunctionCall %void %textureSampleCompare_1912e5
+%fragment_main = OpFunction %void None %11
+         %49 = OpLabel
+         %50 = OpFunctionCall %void %textureSampleCompare_1912e5
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureSampleCompare/1912e5.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleCompare/1912e5.wgsl.expected.wgsl
index 6668830..185f767 100644
--- a/test/tint/builtins/gen/var/textureSampleCompare/1912e5.wgsl.expected.wgsl
+++ b/test/tint/builtins/gen/var/textureSampleCompare/1912e5.wgsl.expected.wgsl
@@ -7,8 +7,11 @@
   var arg_3 = 1u;
   var arg_4 = 1.0f;
   var res : f32 = textureSampleCompare(arg_0, arg_1, arg_2, arg_3, arg_4);
+  prevent_dce = res;
 }
 
+@group(2) @binding(0) var<storage, read_write> prevent_dce : f32;
+
 @fragment
 fn fragment_main() {
   textureSampleCompare_1912e5();
diff --git a/test/tint/builtins/gen/var/textureSampleCompare/3a5923.wgsl b/test/tint/builtins/gen/var/textureSampleCompare/3a5923.wgsl
index fe0c27f..782879d 100644
--- a/test/tint/builtins/gen/var/textureSampleCompare/3a5923.wgsl
+++ b/test/tint/builtins/gen/var/textureSampleCompare/3a5923.wgsl
@@ -28,7 +28,9 @@
   var arg_2 = vec2<f32>(1.f);
   var arg_3 = 1.f;
   var res: f32 = textureSampleCompare(arg_0, arg_1, arg_2, arg_3);
+  prevent_dce = res;
 }
+@group(2) @binding(0) var<storage, read_write> prevent_dce : f32;
 
 @fragment
 fn fragment_main() {
diff --git a/test/tint/builtins/gen/var/textureSampleCompare/3a5923.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureSampleCompare/3a5923.wgsl.expected.dxc.hlsl
index 57c2cf9..c530777 100644
--- a/test/tint/builtins/gen/var/textureSampleCompare/3a5923.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/var/textureSampleCompare/3a5923.wgsl.expected.dxc.hlsl
@@ -1,10 +1,12 @@
 Texture2D arg_0 : register(t0, space1);
 SamplerComparisonState arg_1 : register(s1, space1);
+RWByteAddressBuffer prevent_dce : register(u0, space2);
 
 void textureSampleCompare_3a5923() {
   float2 arg_2 = (1.0f).xx;
   float arg_3 = 1.0f;
   float res = arg_0.SampleCmp(arg_1, arg_2, arg_3);
+  prevent_dce.Store(0u, asuint(res));
 }
 
 void fragment_main() {
diff --git a/test/tint/builtins/gen/var/textureSampleCompare/3a5923.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureSampleCompare/3a5923.wgsl.expected.fxc.hlsl
index 57c2cf9..c530777 100644
--- a/test/tint/builtins/gen/var/textureSampleCompare/3a5923.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/var/textureSampleCompare/3a5923.wgsl.expected.fxc.hlsl
@@ -1,10 +1,12 @@
 Texture2D arg_0 : register(t0, space1);
 SamplerComparisonState arg_1 : register(s1, space1);
+RWByteAddressBuffer prevent_dce : register(u0, space2);
 
 void textureSampleCompare_3a5923() {
   float2 arg_2 = (1.0f).xx;
   float arg_3 = 1.0f;
   float res = arg_0.SampleCmp(arg_1, arg_2, arg_3);
+  prevent_dce.Store(0u, asuint(res));
 }
 
 void fragment_main() {
diff --git a/test/tint/builtins/gen/var/textureSampleCompare/3a5923.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleCompare/3a5923.wgsl.expected.glsl
index 0bb26bb..2a0e458 100644
--- a/test/tint/builtins/gen/var/textureSampleCompare/3a5923.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/textureSampleCompare/3a5923.wgsl.expected.glsl
@@ -3,10 +3,15 @@
 
 uniform highp sampler2DShadow arg_0_arg_1;
 
+layout(binding = 0, std430) buffer prevent_dce_block_ssbo {
+  float inner;
+} prevent_dce;
+
 void textureSampleCompare_3a5923() {
   vec2 arg_2 = vec2(1.0f);
   float arg_3 = 1.0f;
   float res = texture(arg_0_arg_1, vec3(arg_2, arg_3));
+  prevent_dce.inner = res;
 }
 
 void fragment_main() {
diff --git a/test/tint/builtins/gen/var/textureSampleCompare/3a5923.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleCompare/3a5923.wgsl.expected.msl
index 6ca4c0d..6b55d59 100644
--- a/test/tint/builtins/gen/var/textureSampleCompare/3a5923.wgsl.expected.msl
+++ b/test/tint/builtins/gen/var/textureSampleCompare/3a5923.wgsl.expected.msl
@@ -1,14 +1,15 @@
 #include <metal_stdlib>
 
 using namespace metal;
-void textureSampleCompare_3a5923(depth2d<float, access::sample> tint_symbol, sampler tint_symbol_1) {
+void textureSampleCompare_3a5923(depth2d<float, access::sample> tint_symbol, sampler tint_symbol_1, device float* const tint_symbol_2) {
   float2 arg_2 = float2(1.0f);
   float arg_3 = 1.0f;
   float res = tint_symbol.sample_compare(tint_symbol_1, arg_2, arg_3);
+  *(tint_symbol_2) = res;
 }
 
-fragment void fragment_main(depth2d<float, access::sample> tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) {
-  textureSampleCompare_3a5923(tint_symbol_2, tint_symbol_3);
+fragment void fragment_main(depth2d<float, access::sample> tint_symbol_3 [[texture(0)]], sampler tint_symbol_4 [[sampler(0)]], device float* tint_symbol_5 [[buffer(0)]]) {
+  textureSampleCompare_3a5923(tint_symbol_3, tint_symbol_4, tint_symbol_5);
   return;
 }
 
diff --git a/test/tint/builtins/gen/var/textureSampleCompare/3a5923.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleCompare/3a5923.wgsl.expected.spvasm
index f9f7536..d0f26b2 100644
--- a/test/tint/builtins/gen/var/textureSampleCompare/3a5923.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/var/textureSampleCompare/3a5923.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 32
+; Bound: 40
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -9,6 +9,9 @@
                OpExecutionMode %fragment_main OriginUpperLeft
                OpName %arg_0 "arg_0"
                OpName %arg_1 "arg_1"
+               OpName %prevent_dce_block "prevent_dce_block"
+               OpMemberName %prevent_dce_block 0 "inner"
+               OpName %prevent_dce "prevent_dce"
                OpName %textureSampleCompare_3a5923 "textureSampleCompare_3a5923"
                OpName %arg_2 "arg_2"
                OpName %arg_3 "arg_3"
@@ -18,6 +21,10 @@
                OpDecorate %arg_0 Binding 0
                OpDecorate %arg_1 DescriptorSet 1
                OpDecorate %arg_1 Binding 1
+               OpDecorate %prevent_dce_block Block
+               OpMemberDecorate %prevent_dce_block 0 Offset 0
+               OpDecorate %prevent_dce DescriptorSet 2
+               OpDecorate %prevent_dce Binding 0
       %float = OpTypeFloat 32
           %3 = OpTypeImage %float 2D 0 0 0 1 Unknown
 %_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
@@ -25,34 +32,43 @@
           %7 = OpTypeSampler
 %_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7
       %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant
+%prevent_dce_block = OpTypeStruct %float
+%_ptr_StorageBuffer_prevent_dce_block = OpTypePointer StorageBuffer %prevent_dce_block
+%prevent_dce = OpVariable %_ptr_StorageBuffer_prevent_dce_block StorageBuffer
        %void = OpTypeVoid
-          %8 = OpTypeFunction %void
+         %11 = OpTypeFunction %void
     %v2float = OpTypeVector %float 2
     %float_1 = OpConstant %float 1
-         %14 = OpConstantComposite %v2float %float_1 %float_1
+         %17 = OpConstantComposite %v2float %float_1 %float_1
 %_ptr_Function_v2float = OpTypePointer Function %v2float
-         %17 = OpConstantNull %v2float
+         %20 = OpConstantNull %v2float
 %_ptr_Function_float = OpTypePointer Function %float
-         %20 = OpConstantNull %float
-         %24 = OpTypeSampledImage %3
-%textureSampleCompare_3a5923 = OpFunction %void None %8
-         %11 = OpLabel
-      %arg_2 = OpVariable %_ptr_Function_v2float Function %17
-      %arg_3 = OpVariable %_ptr_Function_float Function %20
-        %res = OpVariable %_ptr_Function_float Function %20
-               OpStore %arg_2 %14
+         %23 = OpConstantNull %float
+         %27 = OpTypeSampledImage %3
+       %uint = OpTypeInt 32 0
+     %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float
+%textureSampleCompare_3a5923 = OpFunction %void None %11
+         %14 = OpLabel
+      %arg_2 = OpVariable %_ptr_Function_v2float Function %20
+      %arg_3 = OpVariable %_ptr_Function_float Function %23
+        %res = OpVariable %_ptr_Function_float Function %23
+               OpStore %arg_2 %17
                OpStore %arg_3 %float_1
-         %22 = OpLoad %7 %arg_1
-         %23 = OpLoad %3 %arg_0
-         %25 = OpSampledImage %24 %23 %22
-         %26 = OpLoad %v2float %arg_2
-         %27 = OpLoad %float %arg_3
-         %21 = OpImageSampleDrefImplicitLod %float %25 %26 %27
-               OpStore %res %21
+         %25 = OpLoad %7 %arg_1
+         %26 = OpLoad %3 %arg_0
+         %28 = OpSampledImage %27 %26 %25
+         %29 = OpLoad %v2float %arg_2
+         %30 = OpLoad %float %arg_3
+         %24 = OpImageSampleDrefImplicitLod %float %28 %29 %30
+               OpStore %res %24
+         %35 = OpAccessChain %_ptr_StorageBuffer_float %prevent_dce %uint_0
+         %36 = OpLoad %float %res
+               OpStore %35 %36
                OpReturn
                OpFunctionEnd
-%fragment_main = OpFunction %void None %8
-         %30 = OpLabel
-         %31 = OpFunctionCall %void %textureSampleCompare_3a5923
+%fragment_main = OpFunction %void None %11
+         %38 = OpLabel
+         %39 = OpFunctionCall %void %textureSampleCompare_3a5923
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureSampleCompare/3a5923.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleCompare/3a5923.wgsl.expected.wgsl
index bd314d6..1d0c19f 100644
--- a/test/tint/builtins/gen/var/textureSampleCompare/3a5923.wgsl.expected.wgsl
+++ b/test/tint/builtins/gen/var/textureSampleCompare/3a5923.wgsl.expected.wgsl
@@ -6,8 +6,11 @@
   var arg_2 = vec2<f32>(1.0f);
   var arg_3 = 1.0f;
   var res : f32 = textureSampleCompare(arg_0, arg_1, arg_2, arg_3);
+  prevent_dce = res;
 }
 
+@group(2) @binding(0) var<storage, read_write> prevent_dce : f32;
+
 @fragment
 fn fragment_main() {
   textureSampleCompare_3a5923();
diff --git a/test/tint/builtins/gen/var/textureSampleCompare/63fb83.wgsl b/test/tint/builtins/gen/var/textureSampleCompare/63fb83.wgsl
index e9ae16b..6eeba1d 100644
--- a/test/tint/builtins/gen/var/textureSampleCompare/63fb83.wgsl
+++ b/test/tint/builtins/gen/var/textureSampleCompare/63fb83.wgsl
@@ -28,7 +28,9 @@
   var arg_2 = vec3<f32>(1.f);
   var arg_3 = 1.f;
   var res: f32 = textureSampleCompare(arg_0, arg_1, arg_2, arg_3);
+  prevent_dce = res;
 }
+@group(2) @binding(0) var<storage, read_write> prevent_dce : f32;
 
 @fragment
 fn fragment_main() {
diff --git a/test/tint/builtins/gen/var/textureSampleCompare/63fb83.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureSampleCompare/63fb83.wgsl.expected.dxc.hlsl
index 7d3ca77..e9624e4 100644
--- a/test/tint/builtins/gen/var/textureSampleCompare/63fb83.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/var/textureSampleCompare/63fb83.wgsl.expected.dxc.hlsl
@@ -1,10 +1,12 @@
 TextureCube arg_0 : register(t0, space1);
 SamplerComparisonState arg_1 : register(s1, space1);
+RWByteAddressBuffer prevent_dce : register(u0, space2);
 
 void textureSampleCompare_63fb83() {
   float3 arg_2 = (1.0f).xxx;
   float arg_3 = 1.0f;
   float res = arg_0.SampleCmp(arg_1, arg_2, arg_3);
+  prevent_dce.Store(0u, asuint(res));
 }
 
 void fragment_main() {
diff --git a/test/tint/builtins/gen/var/textureSampleCompare/63fb83.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureSampleCompare/63fb83.wgsl.expected.fxc.hlsl
index 7d3ca77..e9624e4 100644
--- a/test/tint/builtins/gen/var/textureSampleCompare/63fb83.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/var/textureSampleCompare/63fb83.wgsl.expected.fxc.hlsl
@@ -1,10 +1,12 @@
 TextureCube arg_0 : register(t0, space1);
 SamplerComparisonState arg_1 : register(s1, space1);
+RWByteAddressBuffer prevent_dce : register(u0, space2);
 
 void textureSampleCompare_63fb83() {
   float3 arg_2 = (1.0f).xxx;
   float arg_3 = 1.0f;
   float res = arg_0.SampleCmp(arg_1, arg_2, arg_3);
+  prevent_dce.Store(0u, asuint(res));
 }
 
 void fragment_main() {
diff --git a/test/tint/builtins/gen/var/textureSampleCompare/63fb83.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleCompare/63fb83.wgsl.expected.glsl
index 9a48a46..9828944 100644
--- a/test/tint/builtins/gen/var/textureSampleCompare/63fb83.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/textureSampleCompare/63fb83.wgsl.expected.glsl
@@ -3,10 +3,15 @@
 
 uniform highp samplerCubeShadow arg_0_arg_1;
 
+layout(binding = 0, std430) buffer prevent_dce_block_ssbo {
+  float inner;
+} prevent_dce;
+
 void textureSampleCompare_63fb83() {
   vec3 arg_2 = vec3(1.0f);
   float arg_3 = 1.0f;
   float res = texture(arg_0_arg_1, vec4(arg_2, arg_3));
+  prevent_dce.inner = res;
 }
 
 void fragment_main() {
diff --git a/test/tint/builtins/gen/var/textureSampleCompare/63fb83.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleCompare/63fb83.wgsl.expected.msl
index d9fecce..c395414 100644
--- a/test/tint/builtins/gen/var/textureSampleCompare/63fb83.wgsl.expected.msl
+++ b/test/tint/builtins/gen/var/textureSampleCompare/63fb83.wgsl.expected.msl
@@ -1,14 +1,15 @@
 #include <metal_stdlib>
 
 using namespace metal;
-void textureSampleCompare_63fb83(depthcube<float, access::sample> tint_symbol, sampler tint_symbol_1) {
+void textureSampleCompare_63fb83(depthcube<float, access::sample> tint_symbol, sampler tint_symbol_1, device float* const tint_symbol_2) {
   float3 arg_2 = float3(1.0f);
   float arg_3 = 1.0f;
   float res = tint_symbol.sample_compare(tint_symbol_1, arg_2, arg_3);
+  *(tint_symbol_2) = res;
 }
 
-fragment void fragment_main(depthcube<float, access::sample> tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) {
-  textureSampleCompare_63fb83(tint_symbol_2, tint_symbol_3);
+fragment void fragment_main(depthcube<float, access::sample> tint_symbol_3 [[texture(0)]], sampler tint_symbol_4 [[sampler(0)]], device float* tint_symbol_5 [[buffer(0)]]) {
+  textureSampleCompare_63fb83(tint_symbol_3, tint_symbol_4, tint_symbol_5);
   return;
 }
 
diff --git a/test/tint/builtins/gen/var/textureSampleCompare/63fb83.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleCompare/63fb83.wgsl.expected.spvasm
index eab7849..18ab702 100644
--- a/test/tint/builtins/gen/var/textureSampleCompare/63fb83.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/var/textureSampleCompare/63fb83.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 32
+; Bound: 40
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -9,6 +9,9 @@
                OpExecutionMode %fragment_main OriginUpperLeft
                OpName %arg_0 "arg_0"
                OpName %arg_1 "arg_1"
+               OpName %prevent_dce_block "prevent_dce_block"
+               OpMemberName %prevent_dce_block 0 "inner"
+               OpName %prevent_dce "prevent_dce"
                OpName %textureSampleCompare_63fb83 "textureSampleCompare_63fb83"
                OpName %arg_2 "arg_2"
                OpName %arg_3 "arg_3"
@@ -18,6 +21,10 @@
                OpDecorate %arg_0 Binding 0
                OpDecorate %arg_1 DescriptorSet 1
                OpDecorate %arg_1 Binding 1
+               OpDecorate %prevent_dce_block Block
+               OpMemberDecorate %prevent_dce_block 0 Offset 0
+               OpDecorate %prevent_dce DescriptorSet 2
+               OpDecorate %prevent_dce Binding 0
       %float = OpTypeFloat 32
           %3 = OpTypeImage %float Cube 0 0 0 1 Unknown
 %_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
@@ -25,34 +32,43 @@
           %7 = OpTypeSampler
 %_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7
       %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant
+%prevent_dce_block = OpTypeStruct %float
+%_ptr_StorageBuffer_prevent_dce_block = OpTypePointer StorageBuffer %prevent_dce_block
+%prevent_dce = OpVariable %_ptr_StorageBuffer_prevent_dce_block StorageBuffer
        %void = OpTypeVoid
-          %8 = OpTypeFunction %void
+         %11 = OpTypeFunction %void
     %v3float = OpTypeVector %float 3
     %float_1 = OpConstant %float 1
-         %14 = OpConstantComposite %v3float %float_1 %float_1 %float_1
+         %17 = OpConstantComposite %v3float %float_1 %float_1 %float_1
 %_ptr_Function_v3float = OpTypePointer Function %v3float
-         %17 = OpConstantNull %v3float
+         %20 = OpConstantNull %v3float
 %_ptr_Function_float = OpTypePointer Function %float
-         %20 = OpConstantNull %float
-         %24 = OpTypeSampledImage %3
-%textureSampleCompare_63fb83 = OpFunction %void None %8
-         %11 = OpLabel
-      %arg_2 = OpVariable %_ptr_Function_v3float Function %17
-      %arg_3 = OpVariable %_ptr_Function_float Function %20
-        %res = OpVariable %_ptr_Function_float Function %20
-               OpStore %arg_2 %14
+         %23 = OpConstantNull %float
+         %27 = OpTypeSampledImage %3
+       %uint = OpTypeInt 32 0
+     %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float
+%textureSampleCompare_63fb83 = OpFunction %void None %11
+         %14 = OpLabel
+      %arg_2 = OpVariable %_ptr_Function_v3float Function %20
+      %arg_3 = OpVariable %_ptr_Function_float Function %23
+        %res = OpVariable %_ptr_Function_float Function %23
+               OpStore %arg_2 %17
                OpStore %arg_3 %float_1
-         %22 = OpLoad %7 %arg_1
-         %23 = OpLoad %3 %arg_0
-         %25 = OpSampledImage %24 %23 %22
-         %26 = OpLoad %v3float %arg_2
-         %27 = OpLoad %float %arg_3
-         %21 = OpImageSampleDrefImplicitLod %float %25 %26 %27
-               OpStore %res %21
+         %25 = OpLoad %7 %arg_1
+         %26 = OpLoad %3 %arg_0
+         %28 = OpSampledImage %27 %26 %25
+         %29 = OpLoad %v3float %arg_2
+         %30 = OpLoad %float %arg_3
+         %24 = OpImageSampleDrefImplicitLod %float %28 %29 %30
+               OpStore %res %24
+         %35 = OpAccessChain %_ptr_StorageBuffer_float %prevent_dce %uint_0
+         %36 = OpLoad %float %res
+               OpStore %35 %36
                OpReturn
                OpFunctionEnd
-%fragment_main = OpFunction %void None %8
-         %30 = OpLabel
-         %31 = OpFunctionCall %void %textureSampleCompare_63fb83
+%fragment_main = OpFunction %void None %11
+         %38 = OpLabel
+         %39 = OpFunctionCall %void %textureSampleCompare_63fb83
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureSampleCompare/63fb83.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleCompare/63fb83.wgsl.expected.wgsl
index 5a5a765..3635801 100644
--- a/test/tint/builtins/gen/var/textureSampleCompare/63fb83.wgsl.expected.wgsl
+++ b/test/tint/builtins/gen/var/textureSampleCompare/63fb83.wgsl.expected.wgsl
@@ -6,8 +6,11 @@
   var arg_2 = vec3<f32>(1.0f);
   var arg_3 = 1.0f;
   var res : f32 = textureSampleCompare(arg_0, arg_1, arg_2, arg_3);
+  prevent_dce = res;
 }
 
+@group(2) @binding(0) var<storage, read_write> prevent_dce : f32;
+
 @fragment
 fn fragment_main() {
   textureSampleCompare_63fb83();
diff --git a/test/tint/builtins/gen/var/textureSampleCompare/7b5025.wgsl b/test/tint/builtins/gen/var/textureSampleCompare/7b5025.wgsl
index 04a3439..0ca7207 100644
--- a/test/tint/builtins/gen/var/textureSampleCompare/7b5025.wgsl
+++ b/test/tint/builtins/gen/var/textureSampleCompare/7b5025.wgsl
@@ -30,7 +30,9 @@
   var arg_4 = 1.f;
   const arg_5 = vec2<i32>(1i);
   var res: f32 = textureSampleCompare(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5);
+  prevent_dce = res;
 }
+@group(2) @binding(0) var<storage, read_write> prevent_dce : f32;
 
 @fragment
 fn fragment_main() {
diff --git a/test/tint/builtins/gen/var/textureSampleCompare/7b5025.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureSampleCompare/7b5025.wgsl.expected.dxc.hlsl
index b198097..1b8a31f 100644
--- a/test/tint/builtins/gen/var/textureSampleCompare/7b5025.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/var/textureSampleCompare/7b5025.wgsl.expected.dxc.hlsl
@@ -1,14 +1,31 @@
+SKIP: FAILED
+
 Texture2DArray arg_0 : register(t0, space1);
 SamplerComparisonState arg_1 : register(s1, space1);
+RWByteAddressBuffer prevent_dce : register(u0, space2);
 
 void textureSampleCompare_7b5025() {
   float2 arg_2 = (1.0f).xx;
   uint arg_3 = 1u;
   float arg_4 = 1.0f;
   float res = arg_0.SampleCmp(arg_1, float3(arg_2, float(arg_3)), arg_4, (1).xx);
+  prevent_dce.Store(0u, asuint(res));
 }
 
 void fragment_main() {
   textureSampleCompare_7b5025();
   return;
 }
+DXC validation failure:
+warning: DXIL.dll not found.  Resulting DXIL will not be signed for use in release environments.
+
+error: validation errors
+error: Module bitcode is invalid.
+error: Call parameter type does not match function signature!
+i64 1
+ i32  %4 = call %dx.types.ResRet.f32 @dx.op.sampleCmp.f32(i32 64, %dx.types.Handle %2, %dx.types.Handle %3, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float undef, i64 1, i64 1, i32 undef, float 1.000000e+00, float undef)
+
+Validation failed.
+
+
+
diff --git a/test/tint/builtins/gen/var/textureSampleCompare/7b5025.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureSampleCompare/7b5025.wgsl.expected.fxc.hlsl
index b198097..c5bd37e 100644
--- a/test/tint/builtins/gen/var/textureSampleCompare/7b5025.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/var/textureSampleCompare/7b5025.wgsl.expected.fxc.hlsl
@@ -1,11 +1,13 @@
 Texture2DArray arg_0 : register(t0, space1);
 SamplerComparisonState arg_1 : register(s1, space1);
+RWByteAddressBuffer prevent_dce : register(u0, space2);
 
 void textureSampleCompare_7b5025() {
   float2 arg_2 = (1.0f).xx;
   uint arg_3 = 1u;
   float arg_4 = 1.0f;
   float res = arg_0.SampleCmp(arg_1, float3(arg_2, float(arg_3)), arg_4, (1).xx);
+  prevent_dce.Store(0u, asuint(res));
 }
 
 void fragment_main() {
diff --git a/test/tint/builtins/gen/var/textureSampleCompare/7b5025.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleCompare/7b5025.wgsl.expected.msl
index 4fc5720..2afcb45 100644
--- a/test/tint/builtins/gen/var/textureSampleCompare/7b5025.wgsl.expected.msl
+++ b/test/tint/builtins/gen/var/textureSampleCompare/7b5025.wgsl.expected.msl
@@ -1,15 +1,16 @@
 #include <metal_stdlib>
 
 using namespace metal;
-void textureSampleCompare_7b5025(depth2d_array<float, access::sample> tint_symbol, sampler tint_symbol_1) {
+void textureSampleCompare_7b5025(depth2d_array<float, access::sample> tint_symbol, sampler tint_symbol_1, device float* const tint_symbol_2) {
   float2 arg_2 = float2(1.0f);
   uint arg_3 = 1u;
   float arg_4 = 1.0f;
   float res = tint_symbol.sample_compare(tint_symbol_1, arg_2, arg_3, arg_4, int2(1));
+  *(tint_symbol_2) = res;
 }
 
-fragment void fragment_main(depth2d_array<float, access::sample> tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) {
-  textureSampleCompare_7b5025(tint_symbol_2, tint_symbol_3);
+fragment void fragment_main(depth2d_array<float, access::sample> tint_symbol_3 [[texture(0)]], sampler tint_symbol_4 [[sampler(0)]], device float* tint_symbol_5 [[buffer(0)]]) {
+  textureSampleCompare_7b5025(tint_symbol_3, tint_symbol_4, tint_symbol_5);
   return;
 }
 
diff --git a/test/tint/builtins/gen/var/textureSampleCompare/7b5025.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleCompare/7b5025.wgsl.expected.spvasm
index d6a699b..b99e2c8 100644
--- a/test/tint/builtins/gen/var/textureSampleCompare/7b5025.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/var/textureSampleCompare/7b5025.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 47
+; Bound: 54
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -9,6 +9,9 @@
                OpExecutionMode %fragment_main OriginUpperLeft
                OpName %arg_0 "arg_0"
                OpName %arg_1 "arg_1"
+               OpName %prevent_dce_block "prevent_dce_block"
+               OpMemberName %prevent_dce_block 0 "inner"
+               OpName %prevent_dce "prevent_dce"
                OpName %textureSampleCompare_7b5025 "textureSampleCompare_7b5025"
                OpName %arg_2 "arg_2"
                OpName %arg_3 "arg_3"
@@ -19,6 +22,10 @@
                OpDecorate %arg_0 Binding 0
                OpDecorate %arg_1 DescriptorSet 1
                OpDecorate %arg_1 Binding 1
+               OpDecorate %prevent_dce_block Block
+               OpMemberDecorate %prevent_dce_block 0 Offset 0
+               OpDecorate %prevent_dce DescriptorSet 2
+               OpDecorate %prevent_dce Binding 0
       %float = OpTypeFloat 32
           %3 = OpTypeImage %float 2D 0 1 0 1 Unknown
 %_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
@@ -26,50 +33,58 @@
           %7 = OpTypeSampler
 %_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7
       %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant
+%prevent_dce_block = OpTypeStruct %float
+%_ptr_StorageBuffer_prevent_dce_block = OpTypePointer StorageBuffer %prevent_dce_block
+%prevent_dce = OpVariable %_ptr_StorageBuffer_prevent_dce_block StorageBuffer
        %void = OpTypeVoid
-          %8 = OpTypeFunction %void
+         %11 = OpTypeFunction %void
     %v2float = OpTypeVector %float 2
     %float_1 = OpConstant %float 1
-         %14 = OpConstantComposite %v2float %float_1 %float_1
+         %17 = OpConstantComposite %v2float %float_1 %float_1
 %_ptr_Function_v2float = OpTypePointer Function %v2float
-         %17 = OpConstantNull %v2float
+         %20 = OpConstantNull %v2float
        %uint = OpTypeInt 32 0
      %uint_1 = OpConstant %uint 1
 %_ptr_Function_uint = OpTypePointer Function %uint
-         %22 = OpConstantNull %uint
+         %25 = OpConstantNull %uint
 %_ptr_Function_float = OpTypePointer Function %float
-         %25 = OpConstantNull %float
-         %29 = OpTypeSampledImage %3
+         %28 = OpConstantNull %float
+         %32 = OpTypeSampledImage %3
     %v3float = OpTypeVector %float 3
         %int = OpTypeInt 32 1
       %v2int = OpTypeVector %int 2
       %int_1 = OpConstant %int 1
-         %42 = OpConstantComposite %v2int %int_1 %int_1
-%textureSampleCompare_7b5025 = OpFunction %void None %8
-         %11 = OpLabel
-      %arg_2 = OpVariable %_ptr_Function_v2float Function %17
-      %arg_3 = OpVariable %_ptr_Function_uint Function %22
-      %arg_4 = OpVariable %_ptr_Function_float Function %25
-        %res = OpVariable %_ptr_Function_float Function %25
-               OpStore %arg_2 %14
+         %45 = OpConstantComposite %v2int %int_1 %int_1
+     %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float
+%textureSampleCompare_7b5025 = OpFunction %void None %11
+         %14 = OpLabel
+      %arg_2 = OpVariable %_ptr_Function_v2float Function %20
+      %arg_3 = OpVariable %_ptr_Function_uint Function %25
+      %arg_4 = OpVariable %_ptr_Function_float Function %28
+        %res = OpVariable %_ptr_Function_float Function %28
+               OpStore %arg_2 %17
                OpStore %arg_3 %uint_1
                OpStore %arg_4 %float_1
-         %27 = OpLoad %7 %arg_1
-         %28 = OpLoad %3 %arg_0
-         %30 = OpSampledImage %29 %28 %27
-         %32 = OpLoad %v2float %arg_2
-         %33 = OpCompositeExtract %float %32 0
-         %34 = OpCompositeExtract %float %32 1
-         %36 = OpLoad %uint %arg_3
-         %35 = OpConvertUToF %float %36
-         %37 = OpCompositeConstruct %v3float %33 %34 %35
-         %38 = OpLoad %float %arg_4
-         %26 = OpImageSampleDrefImplicitLod %float %30 %37 %38 ConstOffset %42
-               OpStore %res %26
+         %30 = OpLoad %7 %arg_1
+         %31 = OpLoad %3 %arg_0
+         %33 = OpSampledImage %32 %31 %30
+         %35 = OpLoad %v2float %arg_2
+         %36 = OpCompositeExtract %float %35 0
+         %37 = OpCompositeExtract %float %35 1
+         %39 = OpLoad %uint %arg_3
+         %38 = OpConvertUToF %float %39
+         %40 = OpCompositeConstruct %v3float %36 %37 %38
+         %41 = OpLoad %float %arg_4
+         %29 = OpImageSampleDrefImplicitLod %float %33 %40 %41 ConstOffset %45
+               OpStore %res %29
+         %49 = OpAccessChain %_ptr_StorageBuffer_float %prevent_dce %uint_0
+         %50 = OpLoad %float %res
+               OpStore %49 %50
                OpReturn
                OpFunctionEnd
-%fragment_main = OpFunction %void None %8
-         %45 = OpLabel
-         %46 = OpFunctionCall %void %textureSampleCompare_7b5025
+%fragment_main = OpFunction %void None %11
+         %52 = OpLabel
+         %53 = OpFunctionCall %void %textureSampleCompare_7b5025
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureSampleCompare/7b5025.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleCompare/7b5025.wgsl.expected.wgsl
index 7df4e6f..1a035d7 100644
--- a/test/tint/builtins/gen/var/textureSampleCompare/7b5025.wgsl.expected.wgsl
+++ b/test/tint/builtins/gen/var/textureSampleCompare/7b5025.wgsl.expected.wgsl
@@ -8,8 +8,11 @@
   var arg_4 = 1.0f;
   const arg_5 = vec2<i32>(1i);
   var res : f32 = textureSampleCompare(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5);
+  prevent_dce = res;
 }
 
+@group(2) @binding(0) var<storage, read_write> prevent_dce : f32;
+
 @fragment
 fn fragment_main() {
   textureSampleCompare_7b5025();
diff --git a/test/tint/builtins/gen/var/textureSampleCompare/90ae56.wgsl b/test/tint/builtins/gen/var/textureSampleCompare/90ae56.wgsl
index 94aa4fe..d1cb695 100644
--- a/test/tint/builtins/gen/var/textureSampleCompare/90ae56.wgsl
+++ b/test/tint/builtins/gen/var/textureSampleCompare/90ae56.wgsl
@@ -29,7 +29,9 @@
   var arg_3 = 1u;
   var arg_4 = 1.f;
   var res: f32 = textureSampleCompare(arg_0, arg_1, arg_2, arg_3, arg_4);
+  prevent_dce = res;
 }
+@group(2) @binding(0) var<storage, read_write> prevent_dce : f32;
 
 @fragment
 fn fragment_main() {
diff --git a/test/tint/builtins/gen/var/textureSampleCompare/90ae56.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureSampleCompare/90ae56.wgsl.expected.dxc.hlsl
index 6f59515..9f49603 100644
--- a/test/tint/builtins/gen/var/textureSampleCompare/90ae56.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/var/textureSampleCompare/90ae56.wgsl.expected.dxc.hlsl
@@ -1,11 +1,13 @@
 Texture2DArray arg_0 : register(t0, space1);
 SamplerComparisonState arg_1 : register(s1, space1);
+RWByteAddressBuffer prevent_dce : register(u0, space2);
 
 void textureSampleCompare_90ae56() {
   float2 arg_2 = (1.0f).xx;
   uint arg_3 = 1u;
   float arg_4 = 1.0f;
   float res = arg_0.SampleCmp(arg_1, float3(arg_2, float(arg_3)), arg_4);
+  prevent_dce.Store(0u, asuint(res));
 }
 
 void fragment_main() {
diff --git a/test/tint/builtins/gen/var/textureSampleCompare/90ae56.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureSampleCompare/90ae56.wgsl.expected.fxc.hlsl
index 6f59515..9f49603 100644
--- a/test/tint/builtins/gen/var/textureSampleCompare/90ae56.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/var/textureSampleCompare/90ae56.wgsl.expected.fxc.hlsl
@@ -1,11 +1,13 @@
 Texture2DArray arg_0 : register(t0, space1);
 SamplerComparisonState arg_1 : register(s1, space1);
+RWByteAddressBuffer prevent_dce : register(u0, space2);
 
 void textureSampleCompare_90ae56() {
   float2 arg_2 = (1.0f).xx;
   uint arg_3 = 1u;
   float arg_4 = 1.0f;
   float res = arg_0.SampleCmp(arg_1, float3(arg_2, float(arg_3)), arg_4);
+  prevent_dce.Store(0u, asuint(res));
 }
 
 void fragment_main() {
diff --git a/test/tint/builtins/gen/var/textureSampleCompare/90ae56.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleCompare/90ae56.wgsl.expected.glsl
index 1999c7e..6624672 100644
--- a/test/tint/builtins/gen/var/textureSampleCompare/90ae56.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/textureSampleCompare/90ae56.wgsl.expected.glsl
@@ -3,11 +3,16 @@
 
 uniform highp sampler2DArrayShadow arg_0_arg_1;
 
+layout(binding = 0, std430) buffer prevent_dce_block_ssbo {
+  float inner;
+} prevent_dce;
+
 void textureSampleCompare_90ae56() {
   vec2 arg_2 = vec2(1.0f);
   uint arg_3 = 1u;
   float arg_4 = 1.0f;
   float res = texture(arg_0_arg_1, vec4(vec3(arg_2, float(arg_3)), arg_4));
+  prevent_dce.inner = res;
 }
 
 void fragment_main() {
diff --git a/test/tint/builtins/gen/var/textureSampleCompare/90ae56.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleCompare/90ae56.wgsl.expected.msl
index d88ca51..4b4060b 100644
--- a/test/tint/builtins/gen/var/textureSampleCompare/90ae56.wgsl.expected.msl
+++ b/test/tint/builtins/gen/var/textureSampleCompare/90ae56.wgsl.expected.msl
@@ -1,15 +1,16 @@
 #include <metal_stdlib>
 
 using namespace metal;
-void textureSampleCompare_90ae56(depth2d_array<float, access::sample> tint_symbol, sampler tint_symbol_1) {
+void textureSampleCompare_90ae56(depth2d_array<float, access::sample> tint_symbol, sampler tint_symbol_1, device float* const tint_symbol_2) {
   float2 arg_2 = float2(1.0f);
   uint arg_3 = 1u;
   float arg_4 = 1.0f;
   float res = tint_symbol.sample_compare(tint_symbol_1, arg_2, arg_3, arg_4);
+  *(tint_symbol_2) = res;
 }
 
-fragment void fragment_main(depth2d_array<float, access::sample> tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) {
-  textureSampleCompare_90ae56(tint_symbol_2, tint_symbol_3);
+fragment void fragment_main(depth2d_array<float, access::sample> tint_symbol_3 [[texture(0)]], sampler tint_symbol_4 [[sampler(0)]], device float* tint_symbol_5 [[buffer(0)]]) {
+  textureSampleCompare_90ae56(tint_symbol_3, tint_symbol_4, tint_symbol_5);
   return;
 }
 
diff --git a/test/tint/builtins/gen/var/textureSampleCompare/90ae56.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleCompare/90ae56.wgsl.expected.spvasm
index 56a26c3..d7cd082 100644
--- a/test/tint/builtins/gen/var/textureSampleCompare/90ae56.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/var/textureSampleCompare/90ae56.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 43
+; Bound: 50
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -9,6 +9,9 @@
                OpExecutionMode %fragment_main OriginUpperLeft
                OpName %arg_0 "arg_0"
                OpName %arg_1 "arg_1"
+               OpName %prevent_dce_block "prevent_dce_block"
+               OpMemberName %prevent_dce_block 0 "inner"
+               OpName %prevent_dce "prevent_dce"
                OpName %textureSampleCompare_90ae56 "textureSampleCompare_90ae56"
                OpName %arg_2 "arg_2"
                OpName %arg_3 "arg_3"
@@ -19,6 +22,10 @@
                OpDecorate %arg_0 Binding 0
                OpDecorate %arg_1 DescriptorSet 1
                OpDecorate %arg_1 Binding 1
+               OpDecorate %prevent_dce_block Block
+               OpMemberDecorate %prevent_dce_block 0 Offset 0
+               OpDecorate %prevent_dce DescriptorSet 2
+               OpDecorate %prevent_dce Binding 0
       %float = OpTypeFloat 32
           %3 = OpTypeImage %float 2D 0 1 0 1 Unknown
 %_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
@@ -26,46 +33,54 @@
           %7 = OpTypeSampler
 %_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7
       %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant
+%prevent_dce_block = OpTypeStruct %float
+%_ptr_StorageBuffer_prevent_dce_block = OpTypePointer StorageBuffer %prevent_dce_block
+%prevent_dce = OpVariable %_ptr_StorageBuffer_prevent_dce_block StorageBuffer
        %void = OpTypeVoid
-          %8 = OpTypeFunction %void
+         %11 = OpTypeFunction %void
     %v2float = OpTypeVector %float 2
     %float_1 = OpConstant %float 1
-         %14 = OpConstantComposite %v2float %float_1 %float_1
+         %17 = OpConstantComposite %v2float %float_1 %float_1
 %_ptr_Function_v2float = OpTypePointer Function %v2float
-         %17 = OpConstantNull %v2float
+         %20 = OpConstantNull %v2float
        %uint = OpTypeInt 32 0
      %uint_1 = OpConstant %uint 1
 %_ptr_Function_uint = OpTypePointer Function %uint
-         %22 = OpConstantNull %uint
+         %25 = OpConstantNull %uint
 %_ptr_Function_float = OpTypePointer Function %float
-         %25 = OpConstantNull %float
-         %29 = OpTypeSampledImage %3
+         %28 = OpConstantNull %float
+         %32 = OpTypeSampledImage %3
     %v3float = OpTypeVector %float 3
-%textureSampleCompare_90ae56 = OpFunction %void None %8
-         %11 = OpLabel
-      %arg_2 = OpVariable %_ptr_Function_v2float Function %17
-      %arg_3 = OpVariable %_ptr_Function_uint Function %22
-      %arg_4 = OpVariable %_ptr_Function_float Function %25
-        %res = OpVariable %_ptr_Function_float Function %25
-               OpStore %arg_2 %14
+     %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float
+%textureSampleCompare_90ae56 = OpFunction %void None %11
+         %14 = OpLabel
+      %arg_2 = OpVariable %_ptr_Function_v2float Function %20
+      %arg_3 = OpVariable %_ptr_Function_uint Function %25
+      %arg_4 = OpVariable %_ptr_Function_float Function %28
+        %res = OpVariable %_ptr_Function_float Function %28
+               OpStore %arg_2 %17
                OpStore %arg_3 %uint_1
                OpStore %arg_4 %float_1
-         %27 = OpLoad %7 %arg_1
-         %28 = OpLoad %3 %arg_0
-         %30 = OpSampledImage %29 %28 %27
-         %32 = OpLoad %v2float %arg_2
-         %33 = OpCompositeExtract %float %32 0
-         %34 = OpCompositeExtract %float %32 1
-         %36 = OpLoad %uint %arg_3
-         %35 = OpConvertUToF %float %36
-         %37 = OpCompositeConstruct %v3float %33 %34 %35
-         %38 = OpLoad %float %arg_4
-         %26 = OpImageSampleDrefImplicitLod %float %30 %37 %38
-               OpStore %res %26
+         %30 = OpLoad %7 %arg_1
+         %31 = OpLoad %3 %arg_0
+         %33 = OpSampledImage %32 %31 %30
+         %35 = OpLoad %v2float %arg_2
+         %36 = OpCompositeExtract %float %35 0
+         %37 = OpCompositeExtract %float %35 1
+         %39 = OpLoad %uint %arg_3
+         %38 = OpConvertUToF %float %39
+         %40 = OpCompositeConstruct %v3float %36 %37 %38
+         %41 = OpLoad %float %arg_4
+         %29 = OpImageSampleDrefImplicitLod %float %33 %40 %41
+               OpStore %res %29
+         %45 = OpAccessChain %_ptr_StorageBuffer_float %prevent_dce %uint_0
+         %46 = OpLoad %float %res
+               OpStore %45 %46
                OpReturn
                OpFunctionEnd
-%fragment_main = OpFunction %void None %8
-         %41 = OpLabel
-         %42 = OpFunctionCall %void %textureSampleCompare_90ae56
+%fragment_main = OpFunction %void None %11
+         %48 = OpLabel
+         %49 = OpFunctionCall %void %textureSampleCompare_90ae56
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureSampleCompare/90ae56.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleCompare/90ae56.wgsl.expected.wgsl
index dad5b9d..3a5450f 100644
--- a/test/tint/builtins/gen/var/textureSampleCompare/90ae56.wgsl.expected.wgsl
+++ b/test/tint/builtins/gen/var/textureSampleCompare/90ae56.wgsl.expected.wgsl
@@ -7,8 +7,11 @@
   var arg_3 = 1u;
   var arg_4 = 1.0f;
   var res : f32 = textureSampleCompare(arg_0, arg_1, arg_2, arg_3, arg_4);
+  prevent_dce = res;
 }
 
+@group(2) @binding(0) var<storage, read_write> prevent_dce : f32;
+
 @fragment
 fn fragment_main() {
   textureSampleCompare_90ae56();
diff --git a/test/tint/builtins/gen/var/textureSampleCompare/a3ca7e.wgsl b/test/tint/builtins/gen/var/textureSampleCompare/a3ca7e.wgsl
index adb1f55..e7f41d4 100644
--- a/test/tint/builtins/gen/var/textureSampleCompare/a3ca7e.wgsl
+++ b/test/tint/builtins/gen/var/textureSampleCompare/a3ca7e.wgsl
@@ -29,7 +29,9 @@
   var arg_3 = 1i;
   var arg_4 = 1.f;
   var res: f32 = textureSampleCompare(arg_0, arg_1, arg_2, arg_3, arg_4);
+  prevent_dce = res;
 }
+@group(2) @binding(0) var<storage, read_write> prevent_dce : f32;
 
 @fragment
 fn fragment_main() {
diff --git a/test/tint/builtins/gen/var/textureSampleCompare/a3ca7e.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureSampleCompare/a3ca7e.wgsl.expected.dxc.hlsl
index dca9cdf..70a88a6 100644
--- a/test/tint/builtins/gen/var/textureSampleCompare/a3ca7e.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/var/textureSampleCompare/a3ca7e.wgsl.expected.dxc.hlsl
@@ -1,11 +1,13 @@
 TextureCubeArray arg_0 : register(t0, space1);
 SamplerComparisonState arg_1 : register(s1, space1);
+RWByteAddressBuffer prevent_dce : register(u0, space2);
 
 void textureSampleCompare_a3ca7e() {
   float3 arg_2 = (1.0f).xxx;
   int arg_3 = 1;
   float arg_4 = 1.0f;
   float res = arg_0.SampleCmp(arg_1, float4(arg_2, float(arg_3)), arg_4);
+  prevent_dce.Store(0u, asuint(res));
 }
 
 void fragment_main() {
diff --git a/test/tint/builtins/gen/var/textureSampleCompare/a3ca7e.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureSampleCompare/a3ca7e.wgsl.expected.fxc.hlsl
index dca9cdf..70a88a6 100644
--- a/test/tint/builtins/gen/var/textureSampleCompare/a3ca7e.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/var/textureSampleCompare/a3ca7e.wgsl.expected.fxc.hlsl
@@ -1,11 +1,13 @@
 TextureCubeArray arg_0 : register(t0, space1);
 SamplerComparisonState arg_1 : register(s1, space1);
+RWByteAddressBuffer prevent_dce : register(u0, space2);
 
 void textureSampleCompare_a3ca7e() {
   float3 arg_2 = (1.0f).xxx;
   int arg_3 = 1;
   float arg_4 = 1.0f;
   float res = arg_0.SampleCmp(arg_1, float4(arg_2, float(arg_3)), arg_4);
+  prevent_dce.Store(0u, asuint(res));
 }
 
 void fragment_main() {
diff --git a/test/tint/builtins/gen/var/textureSampleCompare/a3ca7e.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleCompare/a3ca7e.wgsl.expected.msl
index 81e30a3..e8752bc 100644
--- a/test/tint/builtins/gen/var/textureSampleCompare/a3ca7e.wgsl.expected.msl
+++ b/test/tint/builtins/gen/var/textureSampleCompare/a3ca7e.wgsl.expected.msl
@@ -1,15 +1,16 @@
 #include <metal_stdlib>
 
 using namespace metal;
-void textureSampleCompare_a3ca7e(depthcube_array<float, access::sample> tint_symbol, sampler tint_symbol_1) {
+void textureSampleCompare_a3ca7e(depthcube_array<float, access::sample> tint_symbol, sampler tint_symbol_1, device float* const tint_symbol_2) {
   float3 arg_2 = float3(1.0f);
   int arg_3 = 1;
   float arg_4 = 1.0f;
   float res = tint_symbol.sample_compare(tint_symbol_1, arg_2, arg_3, arg_4);
+  *(tint_symbol_2) = res;
 }
 
-fragment void fragment_main(depthcube_array<float, access::sample> tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) {
-  textureSampleCompare_a3ca7e(tint_symbol_2, tint_symbol_3);
+fragment void fragment_main(depthcube_array<float, access::sample> tint_symbol_3 [[texture(0)]], sampler tint_symbol_4 [[sampler(0)]], device float* tint_symbol_5 [[buffer(0)]]) {
+  textureSampleCompare_a3ca7e(tint_symbol_3, tint_symbol_4, tint_symbol_5);
   return;
 }
 
diff --git a/test/tint/builtins/gen/var/textureSampleCompare/a3ca7e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleCompare/a3ca7e.wgsl.expected.spvasm
index 14c991b..076677a 100644
--- a/test/tint/builtins/gen/var/textureSampleCompare/a3ca7e.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/var/textureSampleCompare/a3ca7e.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 44
+; Bound: 52
 ; Schema: 0
                OpCapability Shader
                OpCapability SampledCubeArray
@@ -10,6 +10,9 @@
                OpExecutionMode %fragment_main OriginUpperLeft
                OpName %arg_0 "arg_0"
                OpName %arg_1 "arg_1"
+               OpName %prevent_dce_block "prevent_dce_block"
+               OpMemberName %prevent_dce_block 0 "inner"
+               OpName %prevent_dce "prevent_dce"
                OpName %textureSampleCompare_a3ca7e "textureSampleCompare_a3ca7e"
                OpName %arg_2 "arg_2"
                OpName %arg_3 "arg_3"
@@ -20,6 +23,10 @@
                OpDecorate %arg_0 Binding 0
                OpDecorate %arg_1 DescriptorSet 1
                OpDecorate %arg_1 Binding 1
+               OpDecorate %prevent_dce_block Block
+               OpMemberDecorate %prevent_dce_block 0 Offset 0
+               OpDecorate %prevent_dce DescriptorSet 2
+               OpDecorate %prevent_dce Binding 0
       %float = OpTypeFloat 32
           %3 = OpTypeImage %float Cube 0 1 0 1 Unknown
 %_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
@@ -27,47 +34,56 @@
           %7 = OpTypeSampler
 %_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7
       %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant
+%prevent_dce_block = OpTypeStruct %float
+%_ptr_StorageBuffer_prevent_dce_block = OpTypePointer StorageBuffer %prevent_dce_block
+%prevent_dce = OpVariable %_ptr_StorageBuffer_prevent_dce_block StorageBuffer
        %void = OpTypeVoid
-          %8 = OpTypeFunction %void
+         %11 = OpTypeFunction %void
     %v3float = OpTypeVector %float 3
     %float_1 = OpConstant %float 1
-         %14 = OpConstantComposite %v3float %float_1 %float_1 %float_1
+         %17 = OpConstantComposite %v3float %float_1 %float_1 %float_1
 %_ptr_Function_v3float = OpTypePointer Function %v3float
-         %17 = OpConstantNull %v3float
+         %20 = OpConstantNull %v3float
         %int = OpTypeInt 32 1
       %int_1 = OpConstant %int 1
 %_ptr_Function_int = OpTypePointer Function %int
-         %22 = OpConstantNull %int
+         %25 = OpConstantNull %int
 %_ptr_Function_float = OpTypePointer Function %float
-         %25 = OpConstantNull %float
-         %29 = OpTypeSampledImage %3
+         %28 = OpConstantNull %float
+         %32 = OpTypeSampledImage %3
     %v4float = OpTypeVector %float 4
-%textureSampleCompare_a3ca7e = OpFunction %void None %8
-         %11 = OpLabel
-      %arg_2 = OpVariable %_ptr_Function_v3float Function %17
-      %arg_3 = OpVariable %_ptr_Function_int Function %22
-      %arg_4 = OpVariable %_ptr_Function_float Function %25
-        %res = OpVariable %_ptr_Function_float Function %25
-               OpStore %arg_2 %14
+       %uint = OpTypeInt 32 0
+     %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float
+%textureSampleCompare_a3ca7e = OpFunction %void None %11
+         %14 = OpLabel
+      %arg_2 = OpVariable %_ptr_Function_v3float Function %20
+      %arg_3 = OpVariable %_ptr_Function_int Function %25
+      %arg_4 = OpVariable %_ptr_Function_float Function %28
+        %res = OpVariable %_ptr_Function_float Function %28
+               OpStore %arg_2 %17
                OpStore %arg_3 %int_1
                OpStore %arg_4 %float_1
-         %27 = OpLoad %7 %arg_1
-         %28 = OpLoad %3 %arg_0
-         %30 = OpSampledImage %29 %28 %27
-         %32 = OpLoad %v3float %arg_2
-         %33 = OpCompositeExtract %float %32 0
-         %34 = OpCompositeExtract %float %32 1
-         %35 = OpCompositeExtract %float %32 2
-         %37 = OpLoad %int %arg_3
-         %36 = OpConvertSToF %float %37
-         %38 = OpCompositeConstruct %v4float %33 %34 %35 %36
-         %39 = OpLoad %float %arg_4
-         %26 = OpImageSampleDrefImplicitLod %float %30 %38 %39
-               OpStore %res %26
+         %30 = OpLoad %7 %arg_1
+         %31 = OpLoad %3 %arg_0
+         %33 = OpSampledImage %32 %31 %30
+         %35 = OpLoad %v3float %arg_2
+         %36 = OpCompositeExtract %float %35 0
+         %37 = OpCompositeExtract %float %35 1
+         %38 = OpCompositeExtract %float %35 2
+         %40 = OpLoad %int %arg_3
+         %39 = OpConvertSToF %float %40
+         %41 = OpCompositeConstruct %v4float %36 %37 %38 %39
+         %42 = OpLoad %float %arg_4
+         %29 = OpImageSampleDrefImplicitLod %float %33 %41 %42
+               OpStore %res %29
+         %47 = OpAccessChain %_ptr_StorageBuffer_float %prevent_dce %uint_0
+         %48 = OpLoad %float %res
+               OpStore %47 %48
                OpReturn
                OpFunctionEnd
-%fragment_main = OpFunction %void None %8
-         %42 = OpLabel
-         %43 = OpFunctionCall %void %textureSampleCompare_a3ca7e
+%fragment_main = OpFunction %void None %11
+         %50 = OpLabel
+         %51 = OpFunctionCall %void %textureSampleCompare_a3ca7e
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureSampleCompare/a3ca7e.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleCompare/a3ca7e.wgsl.expected.wgsl
index fa3a6a8..118e563 100644
--- a/test/tint/builtins/gen/var/textureSampleCompare/a3ca7e.wgsl.expected.wgsl
+++ b/test/tint/builtins/gen/var/textureSampleCompare/a3ca7e.wgsl.expected.wgsl
@@ -7,8 +7,11 @@
   var arg_3 = 1i;
   var arg_4 = 1.0f;
   var res : f32 = textureSampleCompare(arg_0, arg_1, arg_2, arg_3, arg_4);
+  prevent_dce = res;
 }
 
+@group(2) @binding(0) var<storage, read_write> prevent_dce : f32;
+
 @fragment
 fn fragment_main() {
   textureSampleCompare_a3ca7e();
diff --git a/test/tint/builtins/gen/var/textureSampleCompare/af1051.wgsl b/test/tint/builtins/gen/var/textureSampleCompare/af1051.wgsl
index cde0d28..8bc2e6a 100644
--- a/test/tint/builtins/gen/var/textureSampleCompare/af1051.wgsl
+++ b/test/tint/builtins/gen/var/textureSampleCompare/af1051.wgsl
@@ -30,7 +30,9 @@
   var arg_4 = 1.f;
   const arg_5 = vec2<i32>(1i);
   var res: f32 = textureSampleCompare(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5);
+  prevent_dce = res;
 }
+@group(2) @binding(0) var<storage, read_write> prevent_dce : f32;
 
 @fragment
 fn fragment_main() {
diff --git a/test/tint/builtins/gen/var/textureSampleCompare/af1051.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureSampleCompare/af1051.wgsl.expected.dxc.hlsl
index 3a08b41..3fce7a3 100644
--- a/test/tint/builtins/gen/var/textureSampleCompare/af1051.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/var/textureSampleCompare/af1051.wgsl.expected.dxc.hlsl
@@ -1,14 +1,31 @@
+SKIP: FAILED
+
 Texture2DArray arg_0 : register(t0, space1);
 SamplerComparisonState arg_1 : register(s1, space1);
+RWByteAddressBuffer prevent_dce : register(u0, space2);
 
 void textureSampleCompare_af1051() {
   float2 arg_2 = (1.0f).xx;
   int arg_3 = 1;
   float arg_4 = 1.0f;
   float res = arg_0.SampleCmp(arg_1, float3(arg_2, float(arg_3)), arg_4, (1).xx);
+  prevent_dce.Store(0u, asuint(res));
 }
 
 void fragment_main() {
   textureSampleCompare_af1051();
   return;
 }
+DXC validation failure:
+warning: DXIL.dll not found.  Resulting DXIL will not be signed for use in release environments.
+
+error: validation errors
+error: Module bitcode is invalid.
+error: Call parameter type does not match function signature!
+i64 1
+ i32  %4 = call %dx.types.ResRet.f32 @dx.op.sampleCmp.f32(i32 64, %dx.types.Handle %2, %dx.types.Handle %3, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float undef, i64 1, i64 1, i32 undef, float 1.000000e+00, float undef)
+
+Validation failed.
+
+
+
diff --git a/test/tint/builtins/gen/var/textureSampleCompare/af1051.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureSampleCompare/af1051.wgsl.expected.fxc.hlsl
index 3a08b41..a5b2ef3 100644
--- a/test/tint/builtins/gen/var/textureSampleCompare/af1051.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/var/textureSampleCompare/af1051.wgsl.expected.fxc.hlsl
@@ -1,11 +1,13 @@
 Texture2DArray arg_0 : register(t0, space1);
 SamplerComparisonState arg_1 : register(s1, space1);
+RWByteAddressBuffer prevent_dce : register(u0, space2);
 
 void textureSampleCompare_af1051() {
   float2 arg_2 = (1.0f).xx;
   int arg_3 = 1;
   float arg_4 = 1.0f;
   float res = arg_0.SampleCmp(arg_1, float3(arg_2, float(arg_3)), arg_4, (1).xx);
+  prevent_dce.Store(0u, asuint(res));
 }
 
 void fragment_main() {
diff --git a/test/tint/builtins/gen/var/textureSampleCompare/af1051.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleCompare/af1051.wgsl.expected.msl
index b1cc778..32e8f8f 100644
--- a/test/tint/builtins/gen/var/textureSampleCompare/af1051.wgsl.expected.msl
+++ b/test/tint/builtins/gen/var/textureSampleCompare/af1051.wgsl.expected.msl
@@ -1,15 +1,16 @@
 #include <metal_stdlib>
 
 using namespace metal;
-void textureSampleCompare_af1051(depth2d_array<float, access::sample> tint_symbol, sampler tint_symbol_1) {
+void textureSampleCompare_af1051(depth2d_array<float, access::sample> tint_symbol, sampler tint_symbol_1, device float* const tint_symbol_2) {
   float2 arg_2 = float2(1.0f);
   int arg_3 = 1;
   float arg_4 = 1.0f;
   float res = tint_symbol.sample_compare(tint_symbol_1, arg_2, arg_3, arg_4, int2(1));
+  *(tint_symbol_2) = res;
 }
 
-fragment void fragment_main(depth2d_array<float, access::sample> tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) {
-  textureSampleCompare_af1051(tint_symbol_2, tint_symbol_3);
+fragment void fragment_main(depth2d_array<float, access::sample> tint_symbol_3 [[texture(0)]], sampler tint_symbol_4 [[sampler(0)]], device float* tint_symbol_5 [[buffer(0)]]) {
+  textureSampleCompare_af1051(tint_symbol_3, tint_symbol_4, tint_symbol_5);
   return;
 }
 
diff --git a/test/tint/builtins/gen/var/textureSampleCompare/af1051.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleCompare/af1051.wgsl.expected.spvasm
index 36521c5..5ab7121 100644
--- a/test/tint/builtins/gen/var/textureSampleCompare/af1051.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/var/textureSampleCompare/af1051.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 45
+; Bound: 53
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -9,6 +9,9 @@
                OpExecutionMode %fragment_main OriginUpperLeft
                OpName %arg_0 "arg_0"
                OpName %arg_1 "arg_1"
+               OpName %prevent_dce_block "prevent_dce_block"
+               OpMemberName %prevent_dce_block 0 "inner"
+               OpName %prevent_dce "prevent_dce"
                OpName %textureSampleCompare_af1051 "textureSampleCompare_af1051"
                OpName %arg_2 "arg_2"
                OpName %arg_3 "arg_3"
@@ -19,6 +22,10 @@
                OpDecorate %arg_0 Binding 0
                OpDecorate %arg_1 DescriptorSet 1
                OpDecorate %arg_1 Binding 1
+               OpDecorate %prevent_dce_block Block
+               OpMemberDecorate %prevent_dce_block 0 Offset 0
+               OpDecorate %prevent_dce DescriptorSet 2
+               OpDecorate %prevent_dce Binding 0
       %float = OpTypeFloat 32
           %3 = OpTypeImage %float 2D 0 1 0 1 Unknown
 %_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
@@ -26,48 +33,57 @@
           %7 = OpTypeSampler
 %_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7
       %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant
+%prevent_dce_block = OpTypeStruct %float
+%_ptr_StorageBuffer_prevent_dce_block = OpTypePointer StorageBuffer %prevent_dce_block
+%prevent_dce = OpVariable %_ptr_StorageBuffer_prevent_dce_block StorageBuffer
        %void = OpTypeVoid
-          %8 = OpTypeFunction %void
+         %11 = OpTypeFunction %void
     %v2float = OpTypeVector %float 2
     %float_1 = OpConstant %float 1
-         %14 = OpConstantComposite %v2float %float_1 %float_1
+         %17 = OpConstantComposite %v2float %float_1 %float_1
 %_ptr_Function_v2float = OpTypePointer Function %v2float
-         %17 = OpConstantNull %v2float
+         %20 = OpConstantNull %v2float
         %int = OpTypeInt 32 1
       %int_1 = OpConstant %int 1
 %_ptr_Function_int = OpTypePointer Function %int
-         %22 = OpConstantNull %int
+         %25 = OpConstantNull %int
 %_ptr_Function_float = OpTypePointer Function %float
-         %25 = OpConstantNull %float
-         %29 = OpTypeSampledImage %3
+         %28 = OpConstantNull %float
+         %32 = OpTypeSampledImage %3
     %v3float = OpTypeVector %float 3
       %v2int = OpTypeVector %int 2
-         %40 = OpConstantComposite %v2int %int_1 %int_1
-%textureSampleCompare_af1051 = OpFunction %void None %8
-         %11 = OpLabel
-      %arg_2 = OpVariable %_ptr_Function_v2float Function %17
-      %arg_3 = OpVariable %_ptr_Function_int Function %22
-      %arg_4 = OpVariable %_ptr_Function_float Function %25
-        %res = OpVariable %_ptr_Function_float Function %25
-               OpStore %arg_2 %14
+         %43 = OpConstantComposite %v2int %int_1 %int_1
+       %uint = OpTypeInt 32 0
+     %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float
+%textureSampleCompare_af1051 = OpFunction %void None %11
+         %14 = OpLabel
+      %arg_2 = OpVariable %_ptr_Function_v2float Function %20
+      %arg_3 = OpVariable %_ptr_Function_int Function %25
+      %arg_4 = OpVariable %_ptr_Function_float Function %28
+        %res = OpVariable %_ptr_Function_float Function %28
+               OpStore %arg_2 %17
                OpStore %arg_3 %int_1
                OpStore %arg_4 %float_1
-         %27 = OpLoad %7 %arg_1
-         %28 = OpLoad %3 %arg_0
-         %30 = OpSampledImage %29 %28 %27
-         %32 = OpLoad %v2float %arg_2
-         %33 = OpCompositeExtract %float %32 0
-         %34 = OpCompositeExtract %float %32 1
-         %36 = OpLoad %int %arg_3
-         %35 = OpConvertSToF %float %36
-         %37 = OpCompositeConstruct %v3float %33 %34 %35
-         %38 = OpLoad %float %arg_4
-         %26 = OpImageSampleDrefImplicitLod %float %30 %37 %38 ConstOffset %40
-               OpStore %res %26
+         %30 = OpLoad %7 %arg_1
+         %31 = OpLoad %3 %arg_0
+         %33 = OpSampledImage %32 %31 %30
+         %35 = OpLoad %v2float %arg_2
+         %36 = OpCompositeExtract %float %35 0
+         %37 = OpCompositeExtract %float %35 1
+         %39 = OpLoad %int %arg_3
+         %38 = OpConvertSToF %float %39
+         %40 = OpCompositeConstruct %v3float %36 %37 %38
+         %41 = OpLoad %float %arg_4
+         %29 = OpImageSampleDrefImplicitLod %float %33 %40 %41 ConstOffset %43
+               OpStore %res %29
+         %48 = OpAccessChain %_ptr_StorageBuffer_float %prevent_dce %uint_0
+         %49 = OpLoad %float %res
+               OpStore %48 %49
                OpReturn
                OpFunctionEnd
-%fragment_main = OpFunction %void None %8
-         %43 = OpLabel
-         %44 = OpFunctionCall %void %textureSampleCompare_af1051
+%fragment_main = OpFunction %void None %11
+         %51 = OpLabel
+         %52 = OpFunctionCall %void %textureSampleCompare_af1051
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureSampleCompare/af1051.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleCompare/af1051.wgsl.expected.wgsl
index 60fba5e..e5b6b7c 100644
--- a/test/tint/builtins/gen/var/textureSampleCompare/af1051.wgsl.expected.wgsl
+++ b/test/tint/builtins/gen/var/textureSampleCompare/af1051.wgsl.expected.wgsl
@@ -8,8 +8,11 @@
   var arg_4 = 1.0f;
   const arg_5 = vec2<i32>(1i);
   var res : f32 = textureSampleCompare(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5);
+  prevent_dce = res;
 }
 
+@group(2) @binding(0) var<storage, read_write> prevent_dce : f32;
+
 @fragment
 fn fragment_main() {
   textureSampleCompare_af1051();
diff --git a/test/tint/builtins/gen/var/textureSampleCompare/dd431d.wgsl b/test/tint/builtins/gen/var/textureSampleCompare/dd431d.wgsl
index a4d132e..39fd343 100644
--- a/test/tint/builtins/gen/var/textureSampleCompare/dd431d.wgsl
+++ b/test/tint/builtins/gen/var/textureSampleCompare/dd431d.wgsl
@@ -29,7 +29,9 @@
   var arg_3 = 1i;
   var arg_4 = 1.f;
   var res: f32 = textureSampleCompare(arg_0, arg_1, arg_2, arg_3, arg_4);
+  prevent_dce = res;
 }
+@group(2) @binding(0) var<storage, read_write> prevent_dce : f32;
 
 @fragment
 fn fragment_main() {
diff --git a/test/tint/builtins/gen/var/textureSampleCompare/dd431d.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureSampleCompare/dd431d.wgsl.expected.dxc.hlsl
index 6a97450..4a2d29c 100644
--- a/test/tint/builtins/gen/var/textureSampleCompare/dd431d.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/var/textureSampleCompare/dd431d.wgsl.expected.dxc.hlsl
@@ -1,11 +1,13 @@
 Texture2DArray arg_0 : register(t0, space1);
 SamplerComparisonState arg_1 : register(s1, space1);
+RWByteAddressBuffer prevent_dce : register(u0, space2);
 
 void textureSampleCompare_dd431d() {
   float2 arg_2 = (1.0f).xx;
   int arg_3 = 1;
   float arg_4 = 1.0f;
   float res = arg_0.SampleCmp(arg_1, float3(arg_2, float(arg_3)), arg_4);
+  prevent_dce.Store(0u, asuint(res));
 }
 
 void fragment_main() {
diff --git a/test/tint/builtins/gen/var/textureSampleCompare/dd431d.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureSampleCompare/dd431d.wgsl.expected.fxc.hlsl
index 6a97450..4a2d29c 100644
--- a/test/tint/builtins/gen/var/textureSampleCompare/dd431d.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/var/textureSampleCompare/dd431d.wgsl.expected.fxc.hlsl
@@ -1,11 +1,13 @@
 Texture2DArray arg_0 : register(t0, space1);
 SamplerComparisonState arg_1 : register(s1, space1);
+RWByteAddressBuffer prevent_dce : register(u0, space2);
 
 void textureSampleCompare_dd431d() {
   float2 arg_2 = (1.0f).xx;
   int arg_3 = 1;
   float arg_4 = 1.0f;
   float res = arg_0.SampleCmp(arg_1, float3(arg_2, float(arg_3)), arg_4);
+  prevent_dce.Store(0u, asuint(res));
 }
 
 void fragment_main() {
diff --git a/test/tint/builtins/gen/var/textureSampleCompare/dd431d.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleCompare/dd431d.wgsl.expected.glsl
index 69cd114..b00d8d5 100644
--- a/test/tint/builtins/gen/var/textureSampleCompare/dd431d.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/textureSampleCompare/dd431d.wgsl.expected.glsl
@@ -3,11 +3,16 @@
 
 uniform highp sampler2DArrayShadow arg_0_arg_1;
 
+layout(binding = 0, std430) buffer prevent_dce_block_ssbo {
+  float inner;
+} prevent_dce;
+
 void textureSampleCompare_dd431d() {
   vec2 arg_2 = vec2(1.0f);
   int arg_3 = 1;
   float arg_4 = 1.0f;
   float res = texture(arg_0_arg_1, vec4(vec3(arg_2, float(arg_3)), arg_4));
+  prevent_dce.inner = res;
 }
 
 void fragment_main() {
diff --git a/test/tint/builtins/gen/var/textureSampleCompare/dd431d.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleCompare/dd431d.wgsl.expected.msl
index d9041fa..61bf101 100644
--- a/test/tint/builtins/gen/var/textureSampleCompare/dd431d.wgsl.expected.msl
+++ b/test/tint/builtins/gen/var/textureSampleCompare/dd431d.wgsl.expected.msl
@@ -1,15 +1,16 @@
 #include <metal_stdlib>
 
 using namespace metal;
-void textureSampleCompare_dd431d(depth2d_array<float, access::sample> tint_symbol, sampler tint_symbol_1) {
+void textureSampleCompare_dd431d(depth2d_array<float, access::sample> tint_symbol, sampler tint_symbol_1, device float* const tint_symbol_2) {
   float2 arg_2 = float2(1.0f);
   int arg_3 = 1;
   float arg_4 = 1.0f;
   float res = tint_symbol.sample_compare(tint_symbol_1, arg_2, arg_3, arg_4);
+  *(tint_symbol_2) = res;
 }
 
-fragment void fragment_main(depth2d_array<float, access::sample> tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) {
-  textureSampleCompare_dd431d(tint_symbol_2, tint_symbol_3);
+fragment void fragment_main(depth2d_array<float, access::sample> tint_symbol_3 [[texture(0)]], sampler tint_symbol_4 [[sampler(0)]], device float* tint_symbol_5 [[buffer(0)]]) {
+  textureSampleCompare_dd431d(tint_symbol_3, tint_symbol_4, tint_symbol_5);
   return;
 }
 
diff --git a/test/tint/builtins/gen/var/textureSampleCompare/dd431d.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleCompare/dd431d.wgsl.expected.spvasm
index 4f1f1a0..69531ff 100644
--- a/test/tint/builtins/gen/var/textureSampleCompare/dd431d.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/var/textureSampleCompare/dd431d.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 43
+; Bound: 51
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -9,6 +9,9 @@
                OpExecutionMode %fragment_main OriginUpperLeft
                OpName %arg_0 "arg_0"
                OpName %arg_1 "arg_1"
+               OpName %prevent_dce_block "prevent_dce_block"
+               OpMemberName %prevent_dce_block 0 "inner"
+               OpName %prevent_dce "prevent_dce"
                OpName %textureSampleCompare_dd431d "textureSampleCompare_dd431d"
                OpName %arg_2 "arg_2"
                OpName %arg_3 "arg_3"
@@ -19,6 +22,10 @@
                OpDecorate %arg_0 Binding 0
                OpDecorate %arg_1 DescriptorSet 1
                OpDecorate %arg_1 Binding 1
+               OpDecorate %prevent_dce_block Block
+               OpMemberDecorate %prevent_dce_block 0 Offset 0
+               OpDecorate %prevent_dce DescriptorSet 2
+               OpDecorate %prevent_dce Binding 0
       %float = OpTypeFloat 32
           %3 = OpTypeImage %float 2D 0 1 0 1 Unknown
 %_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
@@ -26,46 +33,55 @@
           %7 = OpTypeSampler
 %_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7
       %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant
+%prevent_dce_block = OpTypeStruct %float
+%_ptr_StorageBuffer_prevent_dce_block = OpTypePointer StorageBuffer %prevent_dce_block
+%prevent_dce = OpVariable %_ptr_StorageBuffer_prevent_dce_block StorageBuffer
        %void = OpTypeVoid
-          %8 = OpTypeFunction %void
+         %11 = OpTypeFunction %void
     %v2float = OpTypeVector %float 2
     %float_1 = OpConstant %float 1
-         %14 = OpConstantComposite %v2float %float_1 %float_1
+         %17 = OpConstantComposite %v2float %float_1 %float_1
 %_ptr_Function_v2float = OpTypePointer Function %v2float
-         %17 = OpConstantNull %v2float
+         %20 = OpConstantNull %v2float
         %int = OpTypeInt 32 1
       %int_1 = OpConstant %int 1
 %_ptr_Function_int = OpTypePointer Function %int
-         %22 = OpConstantNull %int
+         %25 = OpConstantNull %int
 %_ptr_Function_float = OpTypePointer Function %float
-         %25 = OpConstantNull %float
-         %29 = OpTypeSampledImage %3
+         %28 = OpConstantNull %float
+         %32 = OpTypeSampledImage %3
     %v3float = OpTypeVector %float 3
-%textureSampleCompare_dd431d = OpFunction %void None %8
-         %11 = OpLabel
-      %arg_2 = OpVariable %_ptr_Function_v2float Function %17
-      %arg_3 = OpVariable %_ptr_Function_int Function %22
-      %arg_4 = OpVariable %_ptr_Function_float Function %25
-        %res = OpVariable %_ptr_Function_float Function %25
-               OpStore %arg_2 %14
+       %uint = OpTypeInt 32 0
+     %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float
+%textureSampleCompare_dd431d = OpFunction %void None %11
+         %14 = OpLabel
+      %arg_2 = OpVariable %_ptr_Function_v2float Function %20
+      %arg_3 = OpVariable %_ptr_Function_int Function %25
+      %arg_4 = OpVariable %_ptr_Function_float Function %28
+        %res = OpVariable %_ptr_Function_float Function %28
+               OpStore %arg_2 %17
                OpStore %arg_3 %int_1
                OpStore %arg_4 %float_1
-         %27 = OpLoad %7 %arg_1
-         %28 = OpLoad %3 %arg_0
-         %30 = OpSampledImage %29 %28 %27
-         %32 = OpLoad %v2float %arg_2
-         %33 = OpCompositeExtract %float %32 0
-         %34 = OpCompositeExtract %float %32 1
-         %36 = OpLoad %int %arg_3
-         %35 = OpConvertSToF %float %36
-         %37 = OpCompositeConstruct %v3float %33 %34 %35
-         %38 = OpLoad %float %arg_4
-         %26 = OpImageSampleDrefImplicitLod %float %30 %37 %38
-               OpStore %res %26
+         %30 = OpLoad %7 %arg_1
+         %31 = OpLoad %3 %arg_0
+         %33 = OpSampledImage %32 %31 %30
+         %35 = OpLoad %v2float %arg_2
+         %36 = OpCompositeExtract %float %35 0
+         %37 = OpCompositeExtract %float %35 1
+         %39 = OpLoad %int %arg_3
+         %38 = OpConvertSToF %float %39
+         %40 = OpCompositeConstruct %v3float %36 %37 %38
+         %41 = OpLoad %float %arg_4
+         %29 = OpImageSampleDrefImplicitLod %float %33 %40 %41
+               OpStore %res %29
+         %46 = OpAccessChain %_ptr_StorageBuffer_float %prevent_dce %uint_0
+         %47 = OpLoad %float %res
+               OpStore %46 %47
                OpReturn
                OpFunctionEnd
-%fragment_main = OpFunction %void None %8
-         %41 = OpLabel
-         %42 = OpFunctionCall %void %textureSampleCompare_dd431d
+%fragment_main = OpFunction %void None %11
+         %49 = OpLabel
+         %50 = OpFunctionCall %void %textureSampleCompare_dd431d
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureSampleCompare/dd431d.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleCompare/dd431d.wgsl.expected.wgsl
index c973460..269db6b 100644
--- a/test/tint/builtins/gen/var/textureSampleCompare/dd431d.wgsl.expected.wgsl
+++ b/test/tint/builtins/gen/var/textureSampleCompare/dd431d.wgsl.expected.wgsl
@@ -7,8 +7,11 @@
   var arg_3 = 1i;
   var arg_4 = 1.0f;
   var res : f32 = textureSampleCompare(arg_0, arg_1, arg_2, arg_3, arg_4);
+  prevent_dce = res;
 }
 
+@group(2) @binding(0) var<storage, read_write> prevent_dce : f32;
+
 @fragment
 fn fragment_main() {
   textureSampleCompare_dd431d();
diff --git a/test/tint/builtins/gen/var/textureSampleCompare/dec064.wgsl b/test/tint/builtins/gen/var/textureSampleCompare/dec064.wgsl
index c479d1e..5e0bbb5 100644
--- a/test/tint/builtins/gen/var/textureSampleCompare/dec064.wgsl
+++ b/test/tint/builtins/gen/var/textureSampleCompare/dec064.wgsl
@@ -29,7 +29,9 @@
   var arg_3 = 1.f;
   const arg_4 = vec2<i32>(1i);
   var res: f32 = textureSampleCompare(arg_0, arg_1, arg_2, arg_3, arg_4);
+  prevent_dce = res;
 }
+@group(2) @binding(0) var<storage, read_write> prevent_dce : f32;
 
 @fragment
 fn fragment_main() {
diff --git a/test/tint/builtins/gen/var/textureSampleCompare/dec064.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureSampleCompare/dec064.wgsl.expected.dxc.hlsl
index b955a0f..01aaf8a 100644
--- a/test/tint/builtins/gen/var/textureSampleCompare/dec064.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/var/textureSampleCompare/dec064.wgsl.expected.dxc.hlsl
@@ -1,13 +1,30 @@
+SKIP: FAILED
+
 Texture2D arg_0 : register(t0, space1);
 SamplerComparisonState arg_1 : register(s1, space1);
+RWByteAddressBuffer prevent_dce : register(u0, space2);
 
 void textureSampleCompare_dec064() {
   float2 arg_2 = (1.0f).xx;
   float arg_3 = 1.0f;
   float res = arg_0.SampleCmp(arg_1, arg_2, arg_3, (1).xx);
+  prevent_dce.Store(0u, asuint(res));
 }
 
 void fragment_main() {
   textureSampleCompare_dec064();
   return;
 }
+DXC validation failure:
+warning: DXIL.dll not found.  Resulting DXIL will not be signed for use in release environments.
+
+error: validation errors
+error: Module bitcode is invalid.
+error: Call parameter type does not match function signature!
+i64 1
+ i32  %4 = call %dx.types.ResRet.f32 @dx.op.sampleCmp.f32(i32 64, %dx.types.Handle %2, %dx.types.Handle %3, float 1.000000e+00, float 1.000000e+00, float undef, float undef, i64 1, i64 1, i32 undef, float 1.000000e+00, float undef)
+
+Validation failed.
+
+
+
diff --git a/test/tint/builtins/gen/var/textureSampleCompare/dec064.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureSampleCompare/dec064.wgsl.expected.fxc.hlsl
index b955a0f..68f2211 100644
--- a/test/tint/builtins/gen/var/textureSampleCompare/dec064.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/var/textureSampleCompare/dec064.wgsl.expected.fxc.hlsl
@@ -1,10 +1,12 @@
 Texture2D arg_0 : register(t0, space1);
 SamplerComparisonState arg_1 : register(s1, space1);
+RWByteAddressBuffer prevent_dce : register(u0, space2);
 
 void textureSampleCompare_dec064() {
   float2 arg_2 = (1.0f).xx;
   float arg_3 = 1.0f;
   float res = arg_0.SampleCmp(arg_1, arg_2, arg_3, (1).xx);
+  prevent_dce.Store(0u, asuint(res));
 }
 
 void fragment_main() {
diff --git a/test/tint/builtins/gen/var/textureSampleCompare/dec064.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleCompare/dec064.wgsl.expected.glsl
index 01e9c58..c28c43b 100644
--- a/test/tint/builtins/gen/var/textureSampleCompare/dec064.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/textureSampleCompare/dec064.wgsl.expected.glsl
@@ -3,10 +3,15 @@
 
 uniform highp sampler2DShadow arg_0_arg_1;
 
+layout(binding = 0, std430) buffer prevent_dce_block_ssbo {
+  float inner;
+} prevent_dce;
+
 void textureSampleCompare_dec064() {
   vec2 arg_2 = vec2(1.0f);
   float arg_3 = 1.0f;
   float res = textureOffset(arg_0_arg_1, vec3(arg_2, arg_3), ivec2(1));
+  prevent_dce.inner = res;
 }
 
 void fragment_main() {
diff --git a/test/tint/builtins/gen/var/textureSampleCompare/dec064.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleCompare/dec064.wgsl.expected.msl
index 7625b7c..233bbb1 100644
--- a/test/tint/builtins/gen/var/textureSampleCompare/dec064.wgsl.expected.msl
+++ b/test/tint/builtins/gen/var/textureSampleCompare/dec064.wgsl.expected.msl
@@ -1,14 +1,15 @@
 #include <metal_stdlib>
 
 using namespace metal;
-void textureSampleCompare_dec064(depth2d<float, access::sample> tint_symbol, sampler tint_symbol_1) {
+void textureSampleCompare_dec064(depth2d<float, access::sample> tint_symbol, sampler tint_symbol_1, device float* const tint_symbol_2) {
   float2 arg_2 = float2(1.0f);
   float arg_3 = 1.0f;
   float res = tint_symbol.sample_compare(tint_symbol_1, arg_2, arg_3, int2(1));
+  *(tint_symbol_2) = res;
 }
 
-fragment void fragment_main(depth2d<float, access::sample> tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) {
-  textureSampleCompare_dec064(tint_symbol_2, tint_symbol_3);
+fragment void fragment_main(depth2d<float, access::sample> tint_symbol_3 [[texture(0)]], sampler tint_symbol_4 [[sampler(0)]], device float* tint_symbol_5 [[buffer(0)]]) {
+  textureSampleCompare_dec064(tint_symbol_3, tint_symbol_4, tint_symbol_5);
   return;
 }
 
diff --git a/test/tint/builtins/gen/var/textureSampleCompare/dec064.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleCompare/dec064.wgsl.expected.spvasm
index 9713419..8e53e61 100644
--- a/test/tint/builtins/gen/var/textureSampleCompare/dec064.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/var/textureSampleCompare/dec064.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 36
+; Bound: 44
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -9,6 +9,9 @@
                OpExecutionMode %fragment_main OriginUpperLeft
                OpName %arg_0 "arg_0"
                OpName %arg_1 "arg_1"
+               OpName %prevent_dce_block "prevent_dce_block"
+               OpMemberName %prevent_dce_block 0 "inner"
+               OpName %prevent_dce "prevent_dce"
                OpName %textureSampleCompare_dec064 "textureSampleCompare_dec064"
                OpName %arg_2 "arg_2"
                OpName %arg_3 "arg_3"
@@ -18,6 +21,10 @@
                OpDecorate %arg_0 Binding 0
                OpDecorate %arg_1 DescriptorSet 1
                OpDecorate %arg_1 Binding 1
+               OpDecorate %prevent_dce_block Block
+               OpMemberDecorate %prevent_dce_block 0 Offset 0
+               OpDecorate %prevent_dce DescriptorSet 2
+               OpDecorate %prevent_dce Binding 0
       %float = OpTypeFloat 32
           %3 = OpTypeImage %float 2D 0 0 0 1 Unknown
 %_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
@@ -25,38 +32,47 @@
           %7 = OpTypeSampler
 %_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7
       %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant
+%prevent_dce_block = OpTypeStruct %float
+%_ptr_StorageBuffer_prevent_dce_block = OpTypePointer StorageBuffer %prevent_dce_block
+%prevent_dce = OpVariable %_ptr_StorageBuffer_prevent_dce_block StorageBuffer
        %void = OpTypeVoid
-          %8 = OpTypeFunction %void
+         %11 = OpTypeFunction %void
     %v2float = OpTypeVector %float 2
     %float_1 = OpConstant %float 1
-         %14 = OpConstantComposite %v2float %float_1 %float_1
+         %17 = OpConstantComposite %v2float %float_1 %float_1
 %_ptr_Function_v2float = OpTypePointer Function %v2float
-         %17 = OpConstantNull %v2float
+         %20 = OpConstantNull %v2float
 %_ptr_Function_float = OpTypePointer Function %float
-         %20 = OpConstantNull %float
-         %24 = OpTypeSampledImage %3
+         %23 = OpConstantNull %float
+         %27 = OpTypeSampledImage %3
         %int = OpTypeInt 32 1
       %v2int = OpTypeVector %int 2
       %int_1 = OpConstant %int 1
-         %31 = OpConstantComposite %v2int %int_1 %int_1
-%textureSampleCompare_dec064 = OpFunction %void None %8
-         %11 = OpLabel
-      %arg_2 = OpVariable %_ptr_Function_v2float Function %17
-      %arg_3 = OpVariable %_ptr_Function_float Function %20
-        %res = OpVariable %_ptr_Function_float Function %20
-               OpStore %arg_2 %14
+         %34 = OpConstantComposite %v2int %int_1 %int_1
+       %uint = OpTypeInt 32 0
+     %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float
+%textureSampleCompare_dec064 = OpFunction %void None %11
+         %14 = OpLabel
+      %arg_2 = OpVariable %_ptr_Function_v2float Function %20
+      %arg_3 = OpVariable %_ptr_Function_float Function %23
+        %res = OpVariable %_ptr_Function_float Function %23
+               OpStore %arg_2 %17
                OpStore %arg_3 %float_1
-         %22 = OpLoad %7 %arg_1
-         %23 = OpLoad %3 %arg_0
-         %25 = OpSampledImage %24 %23 %22
-         %26 = OpLoad %v2float %arg_2
-         %27 = OpLoad %float %arg_3
-         %21 = OpImageSampleDrefImplicitLod %float %25 %26 %27 ConstOffset %31
-               OpStore %res %21
+         %25 = OpLoad %7 %arg_1
+         %26 = OpLoad %3 %arg_0
+         %28 = OpSampledImage %27 %26 %25
+         %29 = OpLoad %v2float %arg_2
+         %30 = OpLoad %float %arg_3
+         %24 = OpImageSampleDrefImplicitLod %float %28 %29 %30 ConstOffset %34
+               OpStore %res %24
+         %39 = OpAccessChain %_ptr_StorageBuffer_float %prevent_dce %uint_0
+         %40 = OpLoad %float %res
+               OpStore %39 %40
                OpReturn
                OpFunctionEnd
-%fragment_main = OpFunction %void None %8
-         %34 = OpLabel
-         %35 = OpFunctionCall %void %textureSampleCompare_dec064
+%fragment_main = OpFunction %void None %11
+         %42 = OpLabel
+         %43 = OpFunctionCall %void %textureSampleCompare_dec064
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureSampleCompare/dec064.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleCompare/dec064.wgsl.expected.wgsl
index 43246d2..caaf141 100644
--- a/test/tint/builtins/gen/var/textureSampleCompare/dec064.wgsl.expected.wgsl
+++ b/test/tint/builtins/gen/var/textureSampleCompare/dec064.wgsl.expected.wgsl
@@ -7,8 +7,11 @@
   var arg_3 = 1.0f;
   const arg_4 = vec2<i32>(1i);
   var res : f32 = textureSampleCompare(arg_0, arg_1, arg_2, arg_3, arg_4);
+  prevent_dce = res;
 }
 
+@group(2) @binding(0) var<storage, read_write> prevent_dce : f32;
+
 @fragment
 fn fragment_main() {
   textureSampleCompare_dec064();