[msl] Add polyfill for textureLoad()

Add MSL member function definitions for `read()`.

Bug: 42251016
Change-Id: I25ef6a48c5958872a9810eb0ddbee3837754ee97
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/192943
Reviewed-by: dan sinclair <dsinclair@chromium.org>
diff --git a/src/tint/lang/msl/builtin_fn.cc b/src/tint/lang/msl/builtin_fn.cc
index a8c4604..652560d 100644
--- a/src/tint/lang/msl/builtin_fn.cc
+++ b/src/tint/lang/msl/builtin_fn.cc
@@ -70,6 +70,8 @@
             return "get_height";
         case BuiltinFn::kGetDepth:
             return "get_depth";
+        case BuiltinFn::kRead:
+            return "read";
         case BuiltinFn::kSample:
             return "sample";
         case BuiltinFn::kThreadgroupBarrier:
diff --git a/src/tint/lang/msl/builtin_fn.h b/src/tint/lang/msl/builtin_fn.h
index e2dc320..866a290 100644
--- a/src/tint/lang/msl/builtin_fn.h
+++ b/src/tint/lang/msl/builtin_fn.h
@@ -61,6 +61,7 @@
     kGetWidth,
     kGetHeight,
     kGetDepth,
+    kRead,
     kSample,
     kThreadgroupBarrier,
     kNone,
diff --git a/src/tint/lang/msl/intrinsic/data.cc b/src/tint/lang/msl/intrinsic/data.cc
index 3303b49..a663ca2 100644
--- a/src/tint/lang/msl/intrinsic/data.cc
+++ b/src/tint/lang/msl/intrinsic/data.cc
@@ -620,6 +620,22 @@
   }
 };
 
+/// EnumMatcher for 'match readable'
+constexpr NumberMatcher kReadableMatcher {
+/* match */ [](MatchState&, Number number) -> Number {
+    switch (static_cast<core::Access>(number.Value())) {
+      case core::Access::kRead:
+      case core::Access::kReadWrite:
+        return number;
+      default:
+        return Number::invalid;
+    }
+  },
+/* print */ [](MatchState*, StyledText& out) {
+  out<< style::Enum("read")<< style::Plain(" or ") << style::Enum("read_write");
+  }
+};
+
 /// EnumMatcher for 'match function'
 constexpr NumberMatcher kFunctionMatcher {
 /* match */ [](MatchState&, Number number) -> Number {
@@ -649,118 +665,224 @@
   }
 };
 
+/// EnumMatcher for 'match f32_texel_format'
+constexpr NumberMatcher kF32TexelFormatMatcher {
+/* match */ [](MatchState&, Number number) -> Number {
+    switch (static_cast<core::TexelFormat>(number.Value())) {
+      case core::TexelFormat::kR8Unorm:
+      case core::TexelFormat::kBgra8Unorm:
+      case core::TexelFormat::kRgba8Unorm:
+      case core::TexelFormat::kRgba8Snorm:
+      case core::TexelFormat::kRgba16Float:
+      case core::TexelFormat::kR32Float:
+      case core::TexelFormat::kRg32Float:
+      case core::TexelFormat::kRgba32Float:
+        return number;
+      default:
+        return Number::invalid;
+    }
+  },
+/* print */ [](MatchState*, StyledText& out) {
+  out<< style::Enum("r8unorm")<< style::Plain(", ") << style::Enum("bgra8unorm")<< style::Plain(", ") << style::Enum("rgba8unorm")<< style::Plain(", ") << style::Enum("rgba8snorm")<< style::Plain(", ") << style::Enum("rgba16float")<< style::Plain(", ") << style::Enum("r32float")<< style::Plain(", ") << style::Enum("rg32float")<< style::Plain(" or ") << style::Enum("rgba32float");
+  }
+};
+
+/// EnumMatcher for 'match i32_texel_format'
+constexpr NumberMatcher kI32TexelFormatMatcher {
+/* match */ [](MatchState&, Number number) -> Number {
+    switch (static_cast<core::TexelFormat>(number.Value())) {
+      case core::TexelFormat::kRgba8Sint:
+      case core::TexelFormat::kRgba16Sint:
+      case core::TexelFormat::kR32Sint:
+      case core::TexelFormat::kRg32Sint:
+      case core::TexelFormat::kRgba32Sint:
+        return number;
+      default:
+        return Number::invalid;
+    }
+  },
+/* print */ [](MatchState*, StyledText& out) {
+  out<< style::Enum("rgba8sint")<< style::Plain(", ") << style::Enum("rgba16sint")<< style::Plain(", ") << style::Enum("r32sint")<< style::Plain(", ") << style::Enum("rg32sint")<< style::Plain(" or ") << style::Enum("rgba32sint");
+  }
+};
+
+/// EnumMatcher for 'match u32_texel_format'
+constexpr NumberMatcher kU32TexelFormatMatcher {
+/* match */ [](MatchState&, Number number) -> Number {
+    switch (static_cast<core::TexelFormat>(number.Value())) {
+      case core::TexelFormat::kRgba8Uint:
+      case core::TexelFormat::kRgba16Uint:
+      case core::TexelFormat::kR32Uint:
+      case core::TexelFormat::kRg32Uint:
+      case core::TexelFormat::kRgba32Uint:
+        return number;
+      default:
+        return Number::invalid;
+    }
+  },
+/* print */ [](MatchState*, StyledText& out) {
+  out<< style::Enum("rgba8uint")<< style::Plain(", ") << style::Enum("rgba16uint")<< style::Plain(", ") << style::Enum("r32uint")<< style::Plain(", ") << style::Enum("rg32uint")<< style::Plain(" or ") << style::Enum("rgba32uint");
+  }
+};
+
 /// Type and number matchers
 
 /// The template types, types, and type matchers
 constexpr TypeMatcher kTypeMatchers[] = {
   /* [0] */ TemplateTypeMatcher<0>::matcher,
   /* [1] */ TemplateTypeMatcher<1>::matcher,
-  /* [2] */ kBoolMatcher,
-  /* [3] */ kI32Matcher,
-  /* [4] */ kU32Matcher,
-  /* [5] */ kF32Matcher,
-  /* [6] */ kVec2Matcher,
-  /* [7] */ kVec3Matcher,
-  /* [8] */ kVec4Matcher,
-  /* [9] */ kAtomicMatcher,
-  /* [10] */ kPtrMatcher,
-  /* [11] */ kSamplerMatcher,
-  /* [12] */ kTexture1DMatcher,
-  /* [13] */ kTexture2DMatcher,
-  /* [14] */ kTexture2DArrayMatcher,
-  /* [15] */ kTexture3DMatcher,
-  /* [16] */ kTextureCubeMatcher,
-  /* [17] */ kTextureCubeArrayMatcher,
-  /* [18] */ kTextureDepth2DMatcher,
-  /* [19] */ kTextureDepth2DArrayMatcher,
-  /* [20] */ kTextureDepthCubeMatcher,
-  /* [21] */ kTextureDepthCubeArrayMatcher,
-  /* [22] */ kTextureDepthMultisampled2DMatcher,
-  /* [23] */ kTextureMultisampled2DMatcher,
-  /* [24] */ kTextureStorage1DMatcher,
-  /* [25] */ kTextureStorage2DMatcher,
-  /* [26] */ kTextureStorage2DArrayMatcher,
-  /* [27] */ kTextureStorage3DMatcher,
-  /* [28] */ kIu32Matcher,
-  /* [29] */ kFiu32Matcher,
+  /* [2] */ TemplateTypeMatcher<2>::matcher,
+  /* [3] */ kBoolMatcher,
+  /* [4] */ kI32Matcher,
+  /* [5] */ kU32Matcher,
+  /* [6] */ kF32Matcher,
+  /* [7] */ kVec2Matcher,
+  /* [8] */ kVec3Matcher,
+  /* [9] */ kVec4Matcher,
+  /* [10] */ kAtomicMatcher,
+  /* [11] */ kPtrMatcher,
+  /* [12] */ kSamplerMatcher,
+  /* [13] */ kTexture1DMatcher,
+  /* [14] */ kTexture2DMatcher,
+  /* [15] */ kTexture2DArrayMatcher,
+  /* [16] */ kTexture3DMatcher,
+  /* [17] */ kTextureCubeMatcher,
+  /* [18] */ kTextureCubeArrayMatcher,
+  /* [19] */ kTextureDepth2DMatcher,
+  /* [20] */ kTextureDepth2DArrayMatcher,
+  /* [21] */ kTextureDepthCubeMatcher,
+  /* [22] */ kTextureDepthCubeArrayMatcher,
+  /* [23] */ kTextureDepthMultisampled2DMatcher,
+  /* [24] */ kTextureMultisampled2DMatcher,
+  /* [25] */ kTextureStorage1DMatcher,
+  /* [26] */ kTextureStorage2DMatcher,
+  /* [27] */ kTextureStorage2DArrayMatcher,
+  /* [28] */ kTextureStorage3DMatcher,
+  /* [29] */ kIu32Matcher,
+  /* [30] */ kFiu32Matcher,
 };
 
 /// The template numbers, and number matchers
 constexpr NumberMatcher kNumberMatchers[] = {
   /* [0] */ TemplateNumberMatcher<0>::matcher,
   /* [1] */ TemplateNumberMatcher<1>::matcher,
-  /* [2] */ kReadWriteMatcher,
-  /* [3] */ kFunctionMatcher,
-  /* [4] */ kWorkgroupOrStorageMatcher,
+  /* [2] */ TemplateNumberMatcher<2>::matcher,
+  /* [3] */ kReadWriteMatcher,
+  /* [4] */ kReadableMatcher,
+  /* [5] */ kFunctionMatcher,
+  /* [6] */ kWorkgroupOrStorageMatcher,
+  /* [7] */ kF32TexelFormatMatcher,
+  /* [8] */ kI32TexelFormatMatcher,
+  /* [9] */ kU32TexelFormatMatcher,
 };
 
 constexpr MatcherIndex kMatcherIndices[] = {
-  /* [0] */ MatcherIndex(10),
+  /* [0] */ MatcherIndex(11),
   /* [1] */ MatcherIndex(1),
-  /* [2] */ MatcherIndex(9),
+  /* [2] */ MatcherIndex(10),
   /* [3] */ MatcherIndex(0),
-  /* [4] */ MatcherIndex(2),
-  /* [5] */ MatcherIndex(10),
-  /* [6] */ MatcherIndex(3),
+  /* [4] */ MatcherIndex(3),
+  /* [5] */ MatcherIndex(11),
+  /* [6] */ MatcherIndex(5),
   /* [7] */ MatcherIndex(0),
-  /* [8] */ MatcherIndex(2),
-  /* [9] */ MatcherIndex(24),
+  /* [8] */ MatcherIndex(3),
+  /* [9] */ MatcherIndex(25),
   /* [10] */ MatcherIndex(0),
   /* [11] */ MatcherIndex(1),
-  /* [12] */ MatcherIndex(25),
+  /* [12] */ MatcherIndex(26),
   /* [13] */ MatcherIndex(0),
   /* [14] */ MatcherIndex(1),
-  /* [15] */ MatcherIndex(26),
+  /* [15] */ MatcherIndex(27),
   /* [16] */ MatcherIndex(0),
   /* [17] */ MatcherIndex(1),
-  /* [18] */ MatcherIndex(27),
+  /* [18] */ MatcherIndex(28),
   /* [19] */ MatcherIndex(0),
   /* [20] */ MatcherIndex(1),
-  /* [21] */ MatcherIndex(12),
-  /* [22] */ MatcherIndex(0),
-  /* [23] */ MatcherIndex(13),
-  /* [24] */ MatcherIndex(0),
-  /* [25] */ MatcherIndex(14),
-  /* [26] */ MatcherIndex(0),
-  /* [27] */ MatcherIndex(15),
-  /* [28] */ MatcherIndex(0),
-  /* [29] */ MatcherIndex(16),
-  /* [30] */ MatcherIndex(0),
-  /* [31] */ MatcherIndex(17),
-  /* [32] */ MatcherIndex(0),
-  /* [33] */ MatcherIndex(23),
-  /* [34] */ MatcherIndex(0),
-  /* [35] */ MatcherIndex(8),
-  /* [36] */ MatcherIndex(5),
-  /* [37] */ MatcherIndex(12),
-  /* [38] */ MatcherIndex(5),
-  /* [39] */ MatcherIndex(13),
-  /* [40] */ MatcherIndex(5),
-  /* [41] */ MatcherIndex(6),
-  /* [42] */ MatcherIndex(5),
-  /* [43] */ MatcherIndex(6),
-  /* [44] */ MatcherIndex(3),
-  /* [45] */ MatcherIndex(14),
-  /* [46] */ MatcherIndex(5),
-  /* [47] */ MatcherIndex(15),
-  /* [48] */ MatcherIndex(5),
-  /* [49] */ MatcherIndex(7),
-  /* [50] */ MatcherIndex(5),
-  /* [51] */ MatcherIndex(7),
-  /* [52] */ MatcherIndex(3),
-  /* [53] */ MatcherIndex(16),
-  /* [54] */ MatcherIndex(5),
-  /* [55] */ MatcherIndex(17),
-  /* [56] */ MatcherIndex(5),
-  /* [57] */ MatcherIndex(28),
-  /* [58] */ MatcherIndex(4),
-  /* [59] */ MatcherIndex(29),
-  /* [60] */ MatcherIndex(18),
-  /* [61] */ MatcherIndex(19),
-  /* [62] */ MatcherIndex(20),
-  /* [63] */ MatcherIndex(21),
-  /* [64] */ MatcherIndex(22),
-  /* [65] */ MatcherIndex(11),
+  /* [21] */ MatcherIndex(25),
+  /* [22] */ MatcherIndex(7),
+  /* [23] */ MatcherIndex(4),
+  /* [24] */ MatcherIndex(26),
+  /* [25] */ MatcherIndex(7),
+  /* [26] */ MatcherIndex(4),
+  /* [27] */ MatcherIndex(27),
+  /* [28] */ MatcherIndex(7),
+  /* [29] */ MatcherIndex(4),
+  /* [30] */ MatcherIndex(28),
+  /* [31] */ MatcherIndex(7),
+  /* [32] */ MatcherIndex(4),
+  /* [33] */ MatcherIndex(25),
+  /* [34] */ MatcherIndex(8),
+  /* [35] */ MatcherIndex(4),
+  /* [36] */ MatcherIndex(26),
+  /* [37] */ MatcherIndex(8),
+  /* [38] */ MatcherIndex(4),
+  /* [39] */ MatcherIndex(27),
+  /* [40] */ MatcherIndex(8),
+  /* [41] */ MatcherIndex(4),
+  /* [42] */ MatcherIndex(28),
+  /* [43] */ MatcherIndex(8),
+  /* [44] */ MatcherIndex(4),
+  /* [45] */ MatcherIndex(25),
+  /* [46] */ MatcherIndex(9),
+  /* [47] */ MatcherIndex(4),
+  /* [48] */ MatcherIndex(26),
+  /* [49] */ MatcherIndex(9),
+  /* [50] */ MatcherIndex(4),
+  /* [51] */ MatcherIndex(27),
+  /* [52] */ MatcherIndex(9),
+  /* [53] */ MatcherIndex(4),
+  /* [54] */ MatcherIndex(28),
+  /* [55] */ MatcherIndex(9),
+  /* [56] */ MatcherIndex(4),
+  /* [57] */ MatcherIndex(13),
+  /* [58] */ MatcherIndex(0),
+  /* [59] */ MatcherIndex(14),
+  /* [60] */ MatcherIndex(0),
+  /* [61] */ MatcherIndex(15),
+  /* [62] */ MatcherIndex(0),
+  /* [63] */ MatcherIndex(16),
+  /* [64] */ MatcherIndex(0),
+  /* [65] */ MatcherIndex(17),
+  /* [66] */ MatcherIndex(0),
+  /* [67] */ MatcherIndex(18),
+  /* [68] */ MatcherIndex(0),
+  /* [69] */ MatcherIndex(24),
+  /* [70] */ MatcherIndex(0),
+  /* [71] */ MatcherIndex(9),
+  /* [72] */ MatcherIndex(0),
+  /* [73] */ MatcherIndex(7),
+  /* [74] */ MatcherIndex(5),
+  /* [75] */ MatcherIndex(8),
+  /* [76] */ MatcherIndex(5),
+  /* [77] */ MatcherIndex(9),
+  /* [78] */ MatcherIndex(6),
+  /* [79] */ MatcherIndex(9),
+  /* [80] */ MatcherIndex(5),
+  /* [81] */ MatcherIndex(13),
+  /* [82] */ MatcherIndex(6),
+  /* [83] */ MatcherIndex(14),
+  /* [84] */ MatcherIndex(6),
+  /* [85] */ MatcherIndex(7),
+  /* [86] */ MatcherIndex(6),
+  /* [87] */ MatcherIndex(15),
+  /* [88] */ MatcherIndex(6),
+  /* [89] */ MatcherIndex(16),
+  /* [90] */ MatcherIndex(6),
+  /* [91] */ MatcherIndex(8),
+  /* [92] */ MatcherIndex(6),
+  /* [93] */ MatcherIndex(17),
+  /* [94] */ MatcherIndex(6),
+  /* [95] */ MatcherIndex(18),
+  /* [96] */ MatcherIndex(6),
+  /* [97] */ MatcherIndex(29),
+  /* [98] */ MatcherIndex(30),
+  /* [99] */ MatcherIndex(19),
+  /* [100] */ MatcherIndex(20),
+  /* [101] */ MatcherIndex(21),
+  /* [102] */ MatcherIndex(22),
+  /* [103] */ MatcherIndex(23),
+  /* [104] */ MatcherIndex(2),
+  /* [105] */ MatcherIndex(12),
 };
 
 static_assert(MatcherIndicesIndex::CanIndex(kMatcherIndices),
@@ -785,27 +907,27 @@
   {
     /* [3] */
     /* usage */ core::ParameterUsage::kNone,
-    /* matcher_indices */ MatcherIndicesIndex(58),
+    /* matcher_indices */ MatcherIndicesIndex(6),
   },
   {
     /* [4] */
     /* usage */ core::ParameterUsage::kNone,
-    /* matcher_indices */ MatcherIndicesIndex(58),
+    /* matcher_indices */ MatcherIndicesIndex(6),
   },
   {
     /* [5] */
     /* usage */ core::ParameterUsage::kTexture,
-    /* matcher_indices */ MatcherIndicesIndex(45),
+    /* matcher_indices */ MatcherIndicesIndex(87),
   },
   {
     /* [6] */
     /* usage */ core::ParameterUsage::kSampler,
-    /* matcher_indices */ MatcherIndicesIndex(65),
+    /* matcher_indices */ MatcherIndicesIndex(105),
   },
   {
     /* [7] */
     /* usage */ core::ParameterUsage::kCoords,
-    /* matcher_indices */ MatcherIndicesIndex(41),
+    /* matcher_indices */ MatcherIndicesIndex(85),
   },
   {
     /* [8] */
@@ -815,22 +937,22 @@
   {
     /* [9] */
     /* usage */ core::ParameterUsage::kOffset,
-    /* matcher_indices */ MatcherIndicesIndex(43),
+    /* matcher_indices */ MatcherIndicesIndex(22),
   },
   {
     /* [10] */
     /* usage */ core::ParameterUsage::kTexture,
-    /* matcher_indices */ MatcherIndicesIndex(61),
+    /* matcher_indices */ MatcherIndicesIndex(100),
   },
   {
     /* [11] */
     /* usage */ core::ParameterUsage::kSampler,
-    /* matcher_indices */ MatcherIndicesIndex(65),
+    /* matcher_indices */ MatcherIndicesIndex(105),
   },
   {
     /* [12] */
     /* usage */ core::ParameterUsage::kCoords,
-    /* matcher_indices */ MatcherIndicesIndex(41),
+    /* matcher_indices */ MatcherIndicesIndex(85),
   },
   {
     /* [13] */
@@ -840,102 +962,102 @@
   {
     /* [14] */
     /* usage */ core::ParameterUsage::kOffset,
-    /* matcher_indices */ MatcherIndicesIndex(43),
+    /* matcher_indices */ MatcherIndicesIndex(22),
   },
   {
     /* [15] */
     /* usage */ core::ParameterUsage::kTexture,
-    /* matcher_indices */ MatcherIndicesIndex(39),
+    /* matcher_indices */ MatcherIndicesIndex(61),
   },
   {
     /* [16] */
-    /* usage */ core::ParameterUsage::kSampler,
-    /* matcher_indices */ MatcherIndicesIndex(65),
+    /* usage */ core::ParameterUsage::kCoords,
+    /* matcher_indices */ MatcherIndicesIndex(73),
   },
   {
     /* [17] */
-    /* usage */ core::ParameterUsage::kCoords,
-    /* matcher_indices */ MatcherIndicesIndex(41),
+    /* usage */ core::ParameterUsage::kArrayIndex,
+    /* matcher_indices */ MatcherIndicesIndex(1),
   },
   {
     /* [18] */
-    /* usage */ core::ParameterUsage::kOffset,
-    /* matcher_indices */ MatcherIndicesIndex(43),
+    /* usage */ core::ParameterUsage::kLevel,
+    /* matcher_indices */ MatcherIndicesIndex(104),
   },
   {
     /* [19] */
     /* usage */ core::ParameterUsage::kTexture,
-    /* matcher_indices */ MatcherIndicesIndex(47),
+    /* matcher_indices */ MatcherIndicesIndex(100),
   },
   {
     /* [20] */
-    /* usage */ core::ParameterUsage::kSampler,
-    /* matcher_indices */ MatcherIndicesIndex(65),
+    /* usage */ core::ParameterUsage::kCoords,
+    /* matcher_indices */ MatcherIndicesIndex(73),
   },
   {
     /* [21] */
-    /* usage */ core::ParameterUsage::kCoords,
-    /* matcher_indices */ MatcherIndicesIndex(49),
-  },
-  {
-    /* [22] */
-    /* usage */ core::ParameterUsage::kOffset,
-    /* matcher_indices */ MatcherIndicesIndex(51),
-  },
-  {
-    /* [23] */
-    /* usage */ core::ParameterUsage::kTexture,
-    /* matcher_indices */ MatcherIndicesIndex(55),
-  },
-  {
-    /* [24] */
-    /* usage */ core::ParameterUsage::kSampler,
-    /* matcher_indices */ MatcherIndicesIndex(65),
-  },
-  {
-    /* [25] */
-    /* usage */ core::ParameterUsage::kCoords,
-    /* matcher_indices */ MatcherIndicesIndex(49),
-  },
-  {
-    /* [26] */
     /* usage */ core::ParameterUsage::kArrayIndex,
     /* matcher_indices */ MatcherIndicesIndex(3),
   },
   {
+    /* [22] */
+    /* usage */ core::ParameterUsage::kLevel,
+    /* matcher_indices */ MatcherIndicesIndex(1),
+  },
+  {
+    /* [23] */
+    /* usage */ core::ParameterUsage::kTexture,
+    /* matcher_indices */ MatcherIndicesIndex(83),
+  },
+  {
+    /* [24] */
+    /* usage */ core::ParameterUsage::kSampler,
+    /* matcher_indices */ MatcherIndicesIndex(105),
+  },
+  {
+    /* [25] */
+    /* usage */ core::ParameterUsage::kCoords,
+    /* matcher_indices */ MatcherIndicesIndex(85),
+  },
+  {
+    /* [26] */
+    /* usage */ core::ParameterUsage::kOffset,
+    /* matcher_indices */ MatcherIndicesIndex(22),
+  },
+  {
     /* [27] */
     /* usage */ core::ParameterUsage::kTexture,
-    /* matcher_indices */ MatcherIndicesIndex(60),
+    /* matcher_indices */ MatcherIndicesIndex(89),
   },
   {
     /* [28] */
     /* usage */ core::ParameterUsage::kSampler,
-    /* matcher_indices */ MatcherIndicesIndex(65),
+    /* matcher_indices */ MatcherIndicesIndex(105),
   },
   {
     /* [29] */
     /* usage */ core::ParameterUsage::kCoords,
-    /* matcher_indices */ MatcherIndicesIndex(41),
+    /* matcher_indices */ MatcherIndicesIndex(91),
   },
   {
     /* [30] */
     /* usage */ core::ParameterUsage::kOffset,
-    /* matcher_indices */ MatcherIndicesIndex(43),
+    /* matcher_indices */ MatcherIndicesIndex(34),
   },
   {
     /* [31] */
     /* usage */ core::ParameterUsage::kTexture,
-    /* matcher_indices */ MatcherIndicesIndex(63),
+    /* matcher_indices */ MatcherIndicesIndex(95),
   },
   {
     /* [32] */
     /* usage */ core::ParameterUsage::kSampler,
-    /* matcher_indices */ MatcherIndicesIndex(65),
+    /* matcher_indices */ MatcherIndicesIndex(105),
   },
   {
     /* [33] */
     /* usage */ core::ParameterUsage::kCoords,
-    /* matcher_indices */ MatcherIndicesIndex(49),
+    /* matcher_indices */ MatcherIndicesIndex(91),
   },
   {
     /* [34] */
@@ -944,211 +1066,456 @@
   },
   {
     /* [35] */
+    /* usage */ core::ParameterUsage::kTexture,
+    /* matcher_indices */ MatcherIndicesIndex(99),
+  },
+  {
+    /* [36] */
+    /* usage */ core::ParameterUsage::kSampler,
+    /* matcher_indices */ MatcherIndicesIndex(105),
+  },
+  {
+    /* [37] */
+    /* usage */ core::ParameterUsage::kCoords,
+    /* matcher_indices */ MatcherIndicesIndex(85),
+  },
+  {
+    /* [38] */
+    /* usage */ core::ParameterUsage::kOffset,
+    /* matcher_indices */ MatcherIndicesIndex(22),
+  },
+  {
+    /* [39] */
+    /* usage */ core::ParameterUsage::kTexture,
+    /* matcher_indices */ MatcherIndicesIndex(102),
+  },
+  {
+    /* [40] */
+    /* usage */ core::ParameterUsage::kSampler,
+    /* matcher_indices */ MatcherIndicesIndex(105),
+  },
+  {
+    /* [41] */
+    /* usage */ core::ParameterUsage::kCoords,
+    /* matcher_indices */ MatcherIndicesIndex(91),
+  },
+  {
+    /* [42] */
+    /* usage */ core::ParameterUsage::kArrayIndex,
+    /* matcher_indices */ MatcherIndicesIndex(3),
+  },
+  {
+    /* [43] */
     /* usage */ core::ParameterUsage::kNone,
     /* matcher_indices */ MatcherIndicesIndex(0),
   },
   {
-    /* [36] */
+    /* [44] */
     /* usage */ core::ParameterUsage::kNone,
     /* matcher_indices */ MatcherIndicesIndex(3),
   },
   {
-    /* [37] */
-    /* usage */ core::ParameterUsage::kNone,
-    /* matcher_indices */ MatcherIndicesIndex(58),
-  },
-  {
-    /* [38] */
-    /* usage */ core::ParameterUsage::kTexture,
-    /* matcher_indices */ MatcherIndicesIndex(37),
-  },
-  {
-    /* [39] */
-    /* usage */ core::ParameterUsage::kSampler,
-    /* matcher_indices */ MatcherIndicesIndex(65),
-  },
-  {
-    /* [40] */
-    /* usage */ core::ParameterUsage::kCoords,
-    /* matcher_indices */ MatcherIndicesIndex(36),
-  },
-  {
-    /* [41] */
-    /* usage */ core::ParameterUsage::kTexture,
-    /* matcher_indices */ MatcherIndicesIndex(53),
-  },
-  {
-    /* [42] */
-    /* usage */ core::ParameterUsage::kSampler,
-    /* matcher_indices */ MatcherIndicesIndex(65),
-  },
-  {
-    /* [43] */
-    /* usage */ core::ParameterUsage::kCoords,
-    /* matcher_indices */ MatcherIndicesIndex(49),
-  },
-  {
-    /* [44] */
-    /* usage */ core::ParameterUsage::kTexture,
-    /* matcher_indices */ MatcherIndicesIndex(62),
-  },
-  {
     /* [45] */
-    /* usage */ core::ParameterUsage::kSampler,
-    /* matcher_indices */ MatcherIndicesIndex(65),
+    /* usage */ core::ParameterUsage::kNone,
+    /* matcher_indices */ MatcherIndicesIndex(6),
   },
   {
     /* [46] */
-    /* usage */ core::ParameterUsage::kCoords,
-    /* matcher_indices */ MatcherIndicesIndex(49),
+    /* usage */ core::ParameterUsage::kTexture,
+    /* matcher_indices */ MatcherIndicesIndex(59),
   },
   {
     /* [47] */
-    /* usage */ core::ParameterUsage::kNone,
-    /* matcher_indices */ MatcherIndicesIndex(0),
+    /* usage */ core::ParameterUsage::kCoords,
+    /* matcher_indices */ MatcherIndicesIndex(73),
   },
   {
     /* [48] */
-    /* usage */ core::ParameterUsage::kNone,
-    /* matcher_indices */ MatcherIndicesIndex(58),
+    /* usage */ core::ParameterUsage::kLevel,
+    /* matcher_indices */ MatcherIndicesIndex(1),
   },
   {
     /* [49] */
     /* usage */ core::ParameterUsage::kTexture,
-    /* matcher_indices */ MatcherIndicesIndex(23),
+    /* matcher_indices */ MatcherIndicesIndex(63),
   },
   {
     /* [50] */
-    /* usage */ core::ParameterUsage::kNone,
-    /* matcher_indices */ MatcherIndicesIndex(58),
+    /* usage */ core::ParameterUsage::kCoords,
+    /* matcher_indices */ MatcherIndicesIndex(75),
   },
   {
     /* [51] */
-    /* usage */ core::ParameterUsage::kTexture,
-    /* matcher_indices */ MatcherIndicesIndex(25),
+    /* usage */ core::ParameterUsage::kLevel,
+    /* matcher_indices */ MatcherIndicesIndex(1),
   },
   {
     /* [52] */
-    /* usage */ core::ParameterUsage::kNone,
-    /* matcher_indices */ MatcherIndicesIndex(58),
+    /* usage */ core::ParameterUsage::kTexture,
+    /* matcher_indices */ MatcherIndicesIndex(69),
   },
   {
     /* [53] */
-    /* usage */ core::ParameterUsage::kTexture,
-    /* matcher_indices */ MatcherIndicesIndex(27),
+    /* usage */ core::ParameterUsage::kCoords,
+    /* matcher_indices */ MatcherIndicesIndex(73),
   },
   {
     /* [54] */
-    /* usage */ core::ParameterUsage::kNone,
-    /* matcher_indices */ MatcherIndicesIndex(58),
+    /* usage */ core::ParameterUsage::kSampleIndex,
+    /* matcher_indices */ MatcherIndicesIndex(1),
   },
   {
     /* [55] */
     /* usage */ core::ParameterUsage::kTexture,
-    /* matcher_indices */ MatcherIndicesIndex(29),
+    /* matcher_indices */ MatcherIndicesIndex(99),
   },
   {
     /* [56] */
-    /* usage */ core::ParameterUsage::kNone,
-    /* matcher_indices */ MatcherIndicesIndex(58),
+    /* usage */ core::ParameterUsage::kCoords,
+    /* matcher_indices */ MatcherIndicesIndex(73),
   },
   {
     /* [57] */
-    /* usage */ core::ParameterUsage::kTexture,
-    /* matcher_indices */ MatcherIndicesIndex(31),
+    /* usage */ core::ParameterUsage::kLevel,
+    /* matcher_indices */ MatcherIndicesIndex(3),
   },
   {
     /* [58] */
-    /* usage */ core::ParameterUsage::kNone,
-    /* matcher_indices */ MatcherIndicesIndex(58),
+    /* usage */ core::ParameterUsage::kTexture,
+    /* matcher_indices */ MatcherIndicesIndex(103),
   },
   {
     /* [59] */
-    /* usage */ core::ParameterUsage::kTexture,
-    /* matcher_indices */ MatcherIndicesIndex(60),
+    /* usage */ core::ParameterUsage::kCoords,
+    /* matcher_indices */ MatcherIndicesIndex(73),
   },
   {
     /* [60] */
-    /* usage */ core::ParameterUsage::kNone,
-    /* matcher_indices */ MatcherIndicesIndex(58),
+    /* usage */ core::ParameterUsage::kSampleIndex,
+    /* matcher_indices */ MatcherIndicesIndex(3),
   },
   {
     /* [61] */
     /* usage */ core::ParameterUsage::kTexture,
-    /* matcher_indices */ MatcherIndicesIndex(61),
+    /* matcher_indices */ MatcherIndicesIndex(27),
   },
   {
     /* [62] */
-    /* usage */ core::ParameterUsage::kNone,
-    /* matcher_indices */ MatcherIndicesIndex(58),
+    /* usage */ core::ParameterUsage::kCoords,
+    /* matcher_indices */ MatcherIndicesIndex(73),
   },
   {
     /* [63] */
-    /* usage */ core::ParameterUsage::kTexture,
-    /* matcher_indices */ MatcherIndicesIndex(62),
+    /* usage */ core::ParameterUsage::kArrayIndex,
+    /* matcher_indices */ MatcherIndicesIndex(3),
   },
   {
     /* [64] */
-    /* usage */ core::ParameterUsage::kNone,
-    /* matcher_indices */ MatcherIndicesIndex(58),
+    /* usage */ core::ParameterUsage::kTexture,
+    /* matcher_indices */ MatcherIndicesIndex(39),
   },
   {
     /* [65] */
-    /* usage */ core::ParameterUsage::kTexture,
-    /* matcher_indices */ MatcherIndicesIndex(63),
+    /* usage */ core::ParameterUsage::kCoords,
+    /* matcher_indices */ MatcherIndicesIndex(73),
   },
   {
     /* [66] */
-    /* usage */ core::ParameterUsage::kNone,
-    /* matcher_indices */ MatcherIndicesIndex(58),
+    /* usage */ core::ParameterUsage::kArrayIndex,
+    /* matcher_indices */ MatcherIndicesIndex(3),
   },
   {
     /* [67] */
     /* usage */ core::ParameterUsage::kTexture,
-    /* matcher_indices */ MatcherIndicesIndex(12),
+    /* matcher_indices */ MatcherIndicesIndex(51),
   },
   {
     /* [68] */
-    /* usage */ core::ParameterUsage::kNone,
-    /* matcher_indices */ MatcherIndicesIndex(58),
+    /* usage */ core::ParameterUsage::kCoords,
+    /* matcher_indices */ MatcherIndicesIndex(73),
   },
   {
     /* [69] */
-    /* usage */ core::ParameterUsage::kTexture,
-    /* matcher_indices */ MatcherIndicesIndex(15),
+    /* usage */ core::ParameterUsage::kArrayIndex,
+    /* matcher_indices */ MatcherIndicesIndex(3),
   },
   {
     /* [70] */
-    /* usage */ core::ParameterUsage::kNone,
-    /* matcher_indices */ MatcherIndicesIndex(58),
+    /* usage */ core::ParameterUsage::kTexture,
+    /* matcher_indices */ MatcherIndicesIndex(81),
   },
   {
     /* [71] */
-    /* usage */ core::ParameterUsage::kTexture,
-    /* matcher_indices */ MatcherIndicesIndex(18),
+    /* usage */ core::ParameterUsage::kSampler,
+    /* matcher_indices */ MatcherIndicesIndex(105),
   },
   {
     /* [72] */
-    /* usage */ core::ParameterUsage::kNone,
-    /* matcher_indices */ MatcherIndicesIndex(58),
+    /* usage */ core::ParameterUsage::kCoords,
+    /* matcher_indices */ MatcherIndicesIndex(78),
   },
   {
     /* [73] */
     /* usage */ core::ParameterUsage::kTexture,
-    /* matcher_indices */ MatcherIndicesIndex(21),
+    /* matcher_indices */ MatcherIndicesIndex(93),
   },
   {
     /* [74] */
+    /* usage */ core::ParameterUsage::kSampler,
+    /* matcher_indices */ MatcherIndicesIndex(105),
+  },
+  {
+    /* [75] */
+    /* usage */ core::ParameterUsage::kCoords,
+    /* matcher_indices */ MatcherIndicesIndex(91),
+  },
+  {
+    /* [76] */
+    /* usage */ core::ParameterUsage::kTexture,
+    /* matcher_indices */ MatcherIndicesIndex(101),
+  },
+  {
+    /* [77] */
+    /* usage */ core::ParameterUsage::kSampler,
+    /* matcher_indices */ MatcherIndicesIndex(105),
+  },
+  {
+    /* [78] */
+    /* usage */ core::ParameterUsage::kCoords,
+    /* matcher_indices */ MatcherIndicesIndex(91),
+  },
+  {
+    /* [79] */
+    /* usage */ core::ParameterUsage::kNone,
+    /* matcher_indices */ MatcherIndicesIndex(0),
+  },
+  {
+    /* [80] */
+    /* usage */ core::ParameterUsage::kNone,
+    /* matcher_indices */ MatcherIndicesIndex(6),
+  },
+  {
+    /* [81] */
+    /* usage */ core::ParameterUsage::kTexture,
+    /* matcher_indices */ MatcherIndicesIndex(59),
+  },
+  {
+    /* [82] */
+    /* usage */ core::ParameterUsage::kNone,
+    /* matcher_indices */ MatcherIndicesIndex(6),
+  },
+  {
+    /* [83] */
+    /* usage */ core::ParameterUsage::kTexture,
+    /* matcher_indices */ MatcherIndicesIndex(61),
+  },
+  {
+    /* [84] */
+    /* usage */ core::ParameterUsage::kNone,
+    /* matcher_indices */ MatcherIndicesIndex(6),
+  },
+  {
+    /* [85] */
+    /* usage */ core::ParameterUsage::kTexture,
+    /* matcher_indices */ MatcherIndicesIndex(63),
+  },
+  {
+    /* [86] */
+    /* usage */ core::ParameterUsage::kNone,
+    /* matcher_indices */ MatcherIndicesIndex(6),
+  },
+  {
+    /* [87] */
+    /* usage */ core::ParameterUsage::kTexture,
+    /* matcher_indices */ MatcherIndicesIndex(65),
+  },
+  {
+    /* [88] */
+    /* usage */ core::ParameterUsage::kNone,
+    /* matcher_indices */ MatcherIndicesIndex(6),
+  },
+  {
+    /* [89] */
+    /* usage */ core::ParameterUsage::kTexture,
+    /* matcher_indices */ MatcherIndicesIndex(67),
+  },
+  {
+    /* [90] */
+    /* usage */ core::ParameterUsage::kNone,
+    /* matcher_indices */ MatcherIndicesIndex(6),
+  },
+  {
+    /* [91] */
+    /* usage */ core::ParameterUsage::kTexture,
+    /* matcher_indices */ MatcherIndicesIndex(99),
+  },
+  {
+    /* [92] */
+    /* usage */ core::ParameterUsage::kNone,
+    /* matcher_indices */ MatcherIndicesIndex(6),
+  },
+  {
+    /* [93] */
+    /* usage */ core::ParameterUsage::kTexture,
+    /* matcher_indices */ MatcherIndicesIndex(100),
+  },
+  {
+    /* [94] */
+    /* usage */ core::ParameterUsage::kNone,
+    /* matcher_indices */ MatcherIndicesIndex(6),
+  },
+  {
+    /* [95] */
+    /* usage */ core::ParameterUsage::kTexture,
+    /* matcher_indices */ MatcherIndicesIndex(101),
+  },
+  {
+    /* [96] */
+    /* usage */ core::ParameterUsage::kNone,
+    /* matcher_indices */ MatcherIndicesIndex(6),
+  },
+  {
+    /* [97] */
+    /* usage */ core::ParameterUsage::kTexture,
+    /* matcher_indices */ MatcherIndicesIndex(102),
+  },
+  {
+    /* [98] */
+    /* usage */ core::ParameterUsage::kNone,
+    /* matcher_indices */ MatcherIndicesIndex(6),
+  },
+  {
+    /* [99] */
+    /* usage */ core::ParameterUsage::kTexture,
+    /* matcher_indices */ MatcherIndicesIndex(12),
+  },
+  {
+    /* [100] */
+    /* usage */ core::ParameterUsage::kNone,
+    /* matcher_indices */ MatcherIndicesIndex(6),
+  },
+  {
+    /* [101] */
+    /* usage */ core::ParameterUsage::kTexture,
+    /* matcher_indices */ MatcherIndicesIndex(15),
+  },
+  {
+    /* [102] */
+    /* usage */ core::ParameterUsage::kNone,
+    /* matcher_indices */ MatcherIndicesIndex(6),
+  },
+  {
+    /* [103] */
+    /* usage */ core::ParameterUsage::kTexture,
+    /* matcher_indices */ MatcherIndicesIndex(18),
+  },
+  {
+    /* [104] */
+    /* usage */ core::ParameterUsage::kNone,
+    /* matcher_indices */ MatcherIndicesIndex(6),
+  },
+  {
+    /* [105] */
+    /* usage */ core::ParameterUsage::kTexture,
+    /* matcher_indices */ MatcherIndicesIndex(57),
+  },
+  {
+    /* [106] */
+    /* usage */ core::ParameterUsage::kCoords,
+    /* matcher_indices */ MatcherIndicesIndex(6),
+  },
+  {
+    /* [107] */
+    /* usage */ core::ParameterUsage::kTexture,
+    /* matcher_indices */ MatcherIndicesIndex(21),
+  },
+  {
+    /* [108] */
+    /* usage */ core::ParameterUsage::kCoords,
+    /* matcher_indices */ MatcherIndicesIndex(6),
+  },
+  {
+    /* [109] */
+    /* usage */ core::ParameterUsage::kTexture,
+    /* matcher_indices */ MatcherIndicesIndex(24),
+  },
+  {
+    /* [110] */
+    /* usage */ core::ParameterUsage::kCoords,
+    /* matcher_indices */ MatcherIndicesIndex(73),
+  },
+  {
+    /* [111] */
+    /* usage */ core::ParameterUsage::kTexture,
+    /* matcher_indices */ MatcherIndicesIndex(30),
+  },
+  {
+    /* [112] */
+    /* usage */ core::ParameterUsage::kCoords,
+    /* matcher_indices */ MatcherIndicesIndex(75),
+  },
+  {
+    /* [113] */
     /* usage */ core::ParameterUsage::kTexture,
     /* matcher_indices */ MatcherIndicesIndex(33),
   },
   {
-    /* [75] */
-    /* usage */ core::ParameterUsage::kTexture,
-    /* matcher_indices */ MatcherIndicesIndex(64),
+    /* [114] */
+    /* usage */ core::ParameterUsage::kCoords,
+    /* matcher_indices */ MatcherIndicesIndex(6),
   },
   {
-    /* [76] */
+    /* [115] */
+    /* usage */ core::ParameterUsage::kTexture,
+    /* matcher_indices */ MatcherIndicesIndex(36),
+  },
+  {
+    /* [116] */
+    /* usage */ core::ParameterUsage::kCoords,
+    /* matcher_indices */ MatcherIndicesIndex(73),
+  },
+  {
+    /* [117] */
+    /* usage */ core::ParameterUsage::kTexture,
+    /* matcher_indices */ MatcherIndicesIndex(42),
+  },
+  {
+    /* [118] */
+    /* usage */ core::ParameterUsage::kCoords,
+    /* matcher_indices */ MatcherIndicesIndex(75),
+  },
+  {
+    /* [119] */
+    /* usage */ core::ParameterUsage::kTexture,
+    /* matcher_indices */ MatcherIndicesIndex(45),
+  },
+  {
+    /* [120] */
+    /* usage */ core::ParameterUsage::kCoords,
+    /* matcher_indices */ MatcherIndicesIndex(6),
+  },
+  {
+    /* [121] */
+    /* usage */ core::ParameterUsage::kTexture,
+    /* matcher_indices */ MatcherIndicesIndex(48),
+  },
+  {
+    /* [122] */
+    /* usage */ core::ParameterUsage::kCoords,
+    /* matcher_indices */ MatcherIndicesIndex(73),
+  },
+  {
+    /* [123] */
+    /* usage */ core::ParameterUsage::kTexture,
+    /* matcher_indices */ MatcherIndicesIndex(54),
+  },
+  {
+    /* [124] */
+    /* usage */ core::ParameterUsage::kCoords,
+    /* matcher_indices */ MatcherIndicesIndex(75),
+  },
+  {
+    /* [125] */
     /* usage */ core::ParameterUsage::kTexture,
     /* matcher_indices */ MatcherIndicesIndex(9),
   },
@@ -1161,37 +1528,67 @@
   {
     /* [0] */
     /* name */ "T",
-    /* matcher_indices */ MatcherIndicesIndex(57),
+    /* matcher_indices */ MatcherIndicesIndex(98),
     /* kind */ TemplateInfo::Kind::kType,
   },
   {
     /* [1] */
-    /* name */ "S",
-    /* matcher_indices */ MatcherIndicesIndex(58),
-    /* kind */ TemplateInfo::Kind::kNumber,
+    /* name */ "A",
+    /* matcher_indices */ MatcherIndicesIndex(97),
+    /* kind */ TemplateInfo::Kind::kType,
   },
   {
     /* [2] */
+    /* name */ "L",
+    /* matcher_indices */ MatcherIndicesIndex(97),
+    /* kind */ TemplateInfo::Kind::kType,
+  },
+  {
+    /* [3] */
+    /* name */ "T",
+    /* matcher_indices */ MatcherIndicesIndex(97),
+    /* kind */ TemplateInfo::Kind::kType,
+  },
+  {
+    /* [4] */
+    /* name */ "S",
+    /* matcher_indices */ MatcherIndicesIndex(78),
+    /* kind */ TemplateInfo::Kind::kNumber,
+  },
+  {
+    /* [5] */
     /* name */ "F",
     /* matcher_indices */ MatcherIndicesIndex(/* invalid */),
     /* kind */ TemplateInfo::Kind::kNumber,
   },
   {
-    /* [3] */
+    /* [6] */
     /* name */ "A",
     /* matcher_indices */ MatcherIndicesIndex(/* invalid */),
     /* kind */ TemplateInfo::Kind::kNumber,
   },
   {
-    /* [4] */
+    /* [7] */
     /* name */ "T",
-    /* matcher_indices */ MatcherIndicesIndex(59),
+    /* matcher_indices */ MatcherIndicesIndex(98),
     /* kind */ TemplateInfo::Kind::kType,
   },
   {
-    /* [5] */
-    /* name */ "A",
-    /* matcher_indices */ MatcherIndicesIndex(57),
+    /* [8] */
+    /* name */ "L",
+    /* matcher_indices */ MatcherIndicesIndex(97),
+    /* kind */ TemplateInfo::Kind::kType,
+  },
+  {
+    /* [9] */
+    /* name */ "T",
+    /* matcher_indices */ MatcherIndicesIndex(98),
+    /* kind */ TemplateInfo::Kind::kType,
+  },
+  {
+    /* [10] */
+    /* name */ "S",
+    /* matcher_indices */ MatcherIndicesIndex(97),
     /* kind */ TemplateInfo::Kind::kType,
   },
 };
@@ -1203,89 +1600,89 @@
   {
     /* [0] */
     /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMemberFunction),
-    /* num_parameters */ 1,
+    /* num_parameters */ 2,
     /* num_explicit_templates */ 0,
     /* num_templates   */ 1,
-    /* templates */ TemplateIndex(4),
-    /* parameters */ ParameterIndex(73),
-    /* return_matcher_indices */ MatcherIndicesIndex(58),
+    /* templates */ TemplateIndex(0),
+    /* parameters */ ParameterIndex(105),
+    /* return_matcher_indices */ MatcherIndicesIndex(71),
     /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
   },
   {
     /* [1] */
     /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMemberFunction),
-    /* num_parameters */ 2,
+    /* num_parameters */ 3,
     /* num_explicit_templates */ 0,
-    /* num_templates   */ 1,
-    /* templates */ TemplateIndex(4),
-    /* parameters */ ParameterIndex(49),
-    /* return_matcher_indices */ MatcherIndicesIndex(58),
+    /* num_templates   */ 2,
+    /* templates */ TemplateIndex(7),
+    /* parameters */ ParameterIndex(46),
+    /* return_matcher_indices */ MatcherIndicesIndex(71),
     /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
   },
   {
     /* [2] */
     /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMemberFunction),
-    /* num_parameters */ 2,
+    /* num_parameters */ 4,
     /* num_explicit_templates */ 0,
-    /* num_templates   */ 1,
-    /* templates */ TemplateIndex(4),
-    /* parameters */ ParameterIndex(51),
-    /* return_matcher_indices */ MatcherIndicesIndex(58),
+    /* num_templates   */ 3,
+    /* templates */ TemplateIndex(0),
+    /* parameters */ ParameterIndex(15),
+    /* return_matcher_indices */ MatcherIndicesIndex(71),
     /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
   },
   {
     /* [3] */
     /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMemberFunction),
-    /* num_parameters */ 2,
+    /* num_parameters */ 3,
     /* num_explicit_templates */ 0,
-    /* num_templates   */ 1,
-    /* templates */ TemplateIndex(4),
-    /* parameters */ ParameterIndex(53),
-    /* return_matcher_indices */ MatcherIndicesIndex(58),
+    /* num_templates   */ 2,
+    /* templates */ TemplateIndex(7),
+    /* parameters */ ParameterIndex(49),
+    /* return_matcher_indices */ MatcherIndicesIndex(71),
     /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
   },
   {
     /* [4] */
     /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMemberFunction),
-    /* num_parameters */ 2,
+    /* num_parameters */ 3,
     /* num_explicit_templates */ 0,
-    /* num_templates   */ 1,
-    /* templates */ TemplateIndex(4),
-    /* parameters */ ParameterIndex(55),
-    /* return_matcher_indices */ MatcherIndicesIndex(58),
+    /* num_templates   */ 2,
+    /* templates */ TemplateIndex(9),
+    /* parameters */ ParameterIndex(52),
+    /* return_matcher_indices */ MatcherIndicesIndex(71),
     /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
   },
   {
     /* [5] */
     /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMemberFunction),
-    /* num_parameters */ 2,
+    /* num_parameters */ 3,
     /* num_explicit_templates */ 0,
     /* num_templates   */ 1,
-    /* templates */ TemplateIndex(4),
-    /* parameters */ ParameterIndex(57),
-    /* return_matcher_indices */ MatcherIndicesIndex(58),
+    /* templates */ TemplateIndex(2),
+    /* parameters */ ParameterIndex(55),
+    /* return_matcher_indices */ MatcherIndicesIndex(78),
     /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
   },
   {
     /* [6] */
     /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMemberFunction),
-    /* num_parameters */ 1,
+    /* num_parameters */ 4,
     /* num_explicit_templates */ 0,
-    /* num_templates   */ 1,
-    /* templates */ TemplateIndex(4),
-    /* parameters */ ParameterIndex(74),
-    /* return_matcher_indices */ MatcherIndicesIndex(58),
+    /* num_templates   */ 2,
+    /* templates */ TemplateIndex(1),
+    /* parameters */ ParameterIndex(19),
+    /* return_matcher_indices */ MatcherIndicesIndex(78),
     /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
   },
   {
     /* [7] */
     /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMemberFunction),
-    /* num_parameters */ 2,
+    /* num_parameters */ 3,
     /* num_explicit_templates */ 0,
-    /* num_templates   */ 0,
-    /* templates */ TemplateIndex(/* invalid */),
-    /* parameters */ ParameterIndex(59),
-    /* return_matcher_indices */ MatcherIndicesIndex(58),
+    /* num_templates   */ 1,
+    /* templates */ TemplateIndex(10),
+    /* parameters */ ParameterIndex(58),
+    /* return_matcher_indices */ MatcherIndicesIndex(78),
     /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
   },
   {
@@ -1295,8 +1692,8 @@
     /* num_explicit_templates */ 0,
     /* num_templates   */ 0,
     /* templates */ TemplateIndex(/* invalid */),
-    /* parameters */ ParameterIndex(61),
-    /* return_matcher_indices */ MatcherIndicesIndex(58),
+    /* parameters */ ParameterIndex(107),
+    /* return_matcher_indices */ MatcherIndicesIndex(77),
     /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
   },
   {
@@ -1306,41 +1703,41 @@
     /* num_explicit_templates */ 0,
     /* num_templates   */ 0,
     /* templates */ TemplateIndex(/* invalid */),
-    /* parameters */ ParameterIndex(63),
-    /* return_matcher_indices */ MatcherIndicesIndex(58),
+    /* parameters */ ParameterIndex(109),
+    /* return_matcher_indices */ MatcherIndicesIndex(77),
     /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
   },
   {
     /* [10] */
     /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMemberFunction),
-    /* num_parameters */ 2,
+    /* num_parameters */ 3,
     /* num_explicit_templates */ 0,
-    /* num_templates   */ 0,
-    /* templates */ TemplateIndex(/* invalid */),
-    /* parameters */ ParameterIndex(65),
-    /* return_matcher_indices */ MatcherIndicesIndex(58),
+    /* num_templates   */ 1,
+    /* templates */ TemplateIndex(1),
+    /* parameters */ ParameterIndex(61),
+    /* return_matcher_indices */ MatcherIndicesIndex(77),
     /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
   },
   {
     /* [11] */
     /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMemberFunction),
-    /* num_parameters */ 1,
+    /* num_parameters */ 2,
     /* num_explicit_templates */ 0,
     /* num_templates   */ 0,
     /* templates */ TemplateIndex(/* invalid */),
-    /* parameters */ ParameterIndex(75),
-    /* return_matcher_indices */ MatcherIndicesIndex(58),
+    /* parameters */ ParameterIndex(111),
+    /* return_matcher_indices */ MatcherIndicesIndex(77),
     /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
   },
   {
     /* [12] */
     /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMemberFunction),
-    /* num_parameters */ 1,
+    /* num_parameters */ 2,
     /* num_explicit_templates */ 0,
-    /* num_templates   */ 2,
-    /* templates */ TemplateIndex(2),
-    /* parameters */ ParameterIndex(76),
-    /* return_matcher_indices */ MatcherIndicesIndex(58),
+    /* num_templates   */ 0,
+    /* templates */ TemplateIndex(/* invalid */),
+    /* parameters */ ParameterIndex(113),
+    /* return_matcher_indices */ MatcherIndicesIndex(46),
     /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
   },
   {
@@ -1348,21 +1745,21 @@
     /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMemberFunction),
     /* num_parameters */ 2,
     /* num_explicit_templates */ 0,
-    /* num_templates   */ 2,
-    /* templates */ TemplateIndex(2),
-    /* parameters */ ParameterIndex(67),
-    /* return_matcher_indices */ MatcherIndicesIndex(58),
+    /* num_templates   */ 0,
+    /* templates */ TemplateIndex(/* invalid */),
+    /* parameters */ ParameterIndex(115),
+    /* return_matcher_indices */ MatcherIndicesIndex(46),
     /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
   },
   {
     /* [14] */
     /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMemberFunction),
-    /* num_parameters */ 2,
+    /* num_parameters */ 3,
     /* num_explicit_templates */ 0,
-    /* num_templates   */ 2,
-    /* templates */ TemplateIndex(2),
-    /* parameters */ ParameterIndex(69),
-    /* return_matcher_indices */ MatcherIndicesIndex(58),
+    /* num_templates   */ 1,
+    /* templates */ TemplateIndex(1),
+    /* parameters */ ParameterIndex(64),
+    /* return_matcher_indices */ MatcherIndicesIndex(46),
     /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
   },
   {
@@ -1370,197 +1767,197 @@
     /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMemberFunction),
     /* num_parameters */ 2,
     /* num_explicit_templates */ 0,
-    /* num_templates   */ 2,
-    /* templates */ TemplateIndex(2),
-    /* parameters */ ParameterIndex(71),
-    /* return_matcher_indices */ MatcherIndicesIndex(58),
+    /* num_templates   */ 0,
+    /* templates */ TemplateIndex(/* invalid */),
+    /* parameters */ ParameterIndex(117),
+    /* return_matcher_indices */ MatcherIndicesIndex(46),
     /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
   },
   {
     /* [16] */
-    /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kMemberFunction),
-    /* num_parameters */ 3,
+    /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMemberFunction),
+    /* num_parameters */ 2,
     /* num_explicit_templates */ 0,
     /* num_templates   */ 0,
     /* templates */ TemplateIndex(/* invalid */),
-    /* parameters */ ParameterIndex(38),
-    /* return_matcher_indices */ MatcherIndicesIndex(35),
+    /* parameters */ ParameterIndex(119),
+    /* return_matcher_indices */ MatcherIndicesIndex(79),
     /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
   },
   {
     /* [17] */
-    /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kMemberFunction),
-    /* num_parameters */ 3,
+    /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMemberFunction),
+    /* num_parameters */ 2,
     /* num_explicit_templates */ 0,
     /* num_templates   */ 0,
     /* templates */ TemplateIndex(/* invalid */),
-    /* parameters */ ParameterIndex(15),
-    /* return_matcher_indices */ MatcherIndicesIndex(35),
+    /* parameters */ ParameterIndex(121),
+    /* return_matcher_indices */ MatcherIndicesIndex(79),
     /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
   },
   {
     /* [18] */
-    /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kMemberFunction),
-    /* num_parameters */ 4,
+    /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMemberFunction),
+    /* num_parameters */ 3,
     /* num_explicit_templates */ 0,
-    /* num_templates   */ 0,
-    /* templates */ TemplateIndex(/* invalid */),
-    /* parameters */ ParameterIndex(15),
-    /* return_matcher_indices */ MatcherIndicesIndex(35),
+    /* num_templates   */ 1,
+    /* templates */ TemplateIndex(1),
+    /* parameters */ ParameterIndex(67),
+    /* return_matcher_indices */ MatcherIndicesIndex(79),
     /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
   },
   {
     /* [19] */
-    /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kMemberFunction),
-    /* num_parameters */ 4,
+    /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMemberFunction),
+    /* num_parameters */ 2,
     /* num_explicit_templates */ 0,
-    /* num_templates   */ 1,
-    /* templates */ TemplateIndex(5),
-    /* parameters */ ParameterIndex(5),
-    /* return_matcher_indices */ MatcherIndicesIndex(35),
+    /* num_templates   */ 0,
+    /* templates */ TemplateIndex(/* invalid */),
+    /* parameters */ ParameterIndex(123),
+    /* return_matcher_indices */ MatcherIndicesIndex(79),
     /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
   },
   {
     /* [20] */
-    /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kMemberFunction),
-    /* num_parameters */ 5,
+    /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMemberFunction),
+    /* num_parameters */ 1,
     /* num_explicit_templates */ 0,
     /* num_templates   */ 1,
-    /* templates */ TemplateIndex(5),
-    /* parameters */ ParameterIndex(5),
-    /* return_matcher_indices */ MatcherIndicesIndex(35),
+    /* templates */ TemplateIndex(0),
+    /* parameters */ ParameterIndex(105),
+    /* return_matcher_indices */ MatcherIndicesIndex(6),
     /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
   },
   {
     /* [21] */
-    /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kMemberFunction),
-    /* num_parameters */ 3,
+    /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMemberFunction),
+    /* num_parameters */ 2,
     /* num_explicit_templates */ 0,
-    /* num_templates   */ 0,
-    /* templates */ TemplateIndex(/* invalid */),
-    /* parameters */ ParameterIndex(19),
-    /* return_matcher_indices */ MatcherIndicesIndex(35),
+    /* num_templates   */ 1,
+    /* templates */ TemplateIndex(0),
+    /* parameters */ ParameterIndex(81),
+    /* return_matcher_indices */ MatcherIndicesIndex(6),
     /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
   },
   {
     /* [22] */
-    /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kMemberFunction),
-    /* num_parameters */ 4,
+    /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMemberFunction),
+    /* num_parameters */ 2,
     /* num_explicit_templates */ 0,
-    /* num_templates   */ 0,
-    /* templates */ TemplateIndex(/* invalid */),
-    /* parameters */ ParameterIndex(19),
-    /* return_matcher_indices */ MatcherIndicesIndex(35),
+    /* num_templates   */ 1,
+    /* templates */ TemplateIndex(0),
+    /* parameters */ ParameterIndex(83),
+    /* return_matcher_indices */ MatcherIndicesIndex(6),
     /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
   },
   {
     /* [23] */
-    /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kMemberFunction),
-    /* num_parameters */ 3,
+    /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMemberFunction),
+    /* num_parameters */ 2,
     /* num_explicit_templates */ 0,
-    /* num_templates   */ 0,
-    /* templates */ TemplateIndex(/* invalid */),
-    /* parameters */ ParameterIndex(41),
-    /* return_matcher_indices */ MatcherIndicesIndex(35),
+    /* num_templates   */ 1,
+    /* templates */ TemplateIndex(0),
+    /* parameters */ ParameterIndex(85),
+    /* return_matcher_indices */ MatcherIndicesIndex(6),
     /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
   },
   {
     /* [24] */
-    /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kMemberFunction),
-    /* num_parameters */ 4,
+    /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMemberFunction),
+    /* num_parameters */ 2,
     /* num_explicit_templates */ 0,
     /* num_templates   */ 1,
-    /* templates */ TemplateIndex(5),
-    /* parameters */ ParameterIndex(23),
-    /* return_matcher_indices */ MatcherIndicesIndex(35),
+    /* templates */ TemplateIndex(0),
+    /* parameters */ ParameterIndex(87),
+    /* return_matcher_indices */ MatcherIndicesIndex(6),
     /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
   },
   {
     /* [25] */
-    /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kMemberFunction),
-    /* num_parameters */ 3,
+    /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMemberFunction),
+    /* num_parameters */ 2,
     /* num_explicit_templates */ 0,
-    /* num_templates   */ 0,
-    /* templates */ TemplateIndex(/* invalid */),
-    /* parameters */ ParameterIndex(27),
-    /* return_matcher_indices */ MatcherIndicesIndex(36),
+    /* num_templates   */ 1,
+    /* templates */ TemplateIndex(0),
+    /* parameters */ ParameterIndex(89),
+    /* return_matcher_indices */ MatcherIndicesIndex(6),
     /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
   },
   {
     /* [26] */
-    /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kMemberFunction),
-    /* num_parameters */ 4,
+    /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMemberFunction),
+    /* num_parameters */ 1,
     /* num_explicit_templates */ 0,
-    /* num_templates   */ 0,
-    /* templates */ TemplateIndex(/* invalid */),
-    /* parameters */ ParameterIndex(27),
-    /* return_matcher_indices */ MatcherIndicesIndex(36),
+    /* num_templates   */ 1,
+    /* templates */ TemplateIndex(0),
+    /* parameters */ ParameterIndex(52),
+    /* return_matcher_indices */ MatcherIndicesIndex(6),
     /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
   },
   {
     /* [27] */
-    /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kMemberFunction),
-    /* num_parameters */ 4,
+    /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMemberFunction),
+    /* num_parameters */ 2,
     /* num_explicit_templates */ 0,
-    /* num_templates   */ 1,
-    /* templates */ TemplateIndex(5),
-    /* parameters */ ParameterIndex(10),
-    /* return_matcher_indices */ MatcherIndicesIndex(36),
+    /* num_templates   */ 0,
+    /* templates */ TemplateIndex(/* invalid */),
+    /* parameters */ ParameterIndex(91),
+    /* return_matcher_indices */ MatcherIndicesIndex(6),
     /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
   },
   {
     /* [28] */
-    /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kMemberFunction),
-    /* num_parameters */ 5,
+    /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMemberFunction),
+    /* num_parameters */ 2,
     /* num_explicit_templates */ 0,
-    /* num_templates   */ 1,
-    /* templates */ TemplateIndex(5),
-    /* parameters */ ParameterIndex(10),
-    /* return_matcher_indices */ MatcherIndicesIndex(36),
+    /* num_templates   */ 0,
+    /* templates */ TemplateIndex(/* invalid */),
+    /* parameters */ ParameterIndex(93),
+    /* return_matcher_indices */ MatcherIndicesIndex(6),
     /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
   },
   {
     /* [29] */
-    /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kMemberFunction),
-    /* num_parameters */ 3,
+    /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMemberFunction),
+    /* num_parameters */ 2,
     /* num_explicit_templates */ 0,
     /* num_templates   */ 0,
     /* templates */ TemplateIndex(/* invalid */),
-    /* parameters */ ParameterIndex(44),
-    /* return_matcher_indices */ MatcherIndicesIndex(36),
+    /* parameters */ ParameterIndex(95),
+    /* return_matcher_indices */ MatcherIndicesIndex(6),
     /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
   },
   {
     /* [30] */
-    /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kMemberFunction),
-    /* num_parameters */ 4,
+    /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMemberFunction),
+    /* num_parameters */ 2,
     /* num_explicit_templates */ 0,
-    /* num_templates   */ 1,
-    /* templates */ TemplateIndex(5),
-    /* parameters */ ParameterIndex(31),
-    /* return_matcher_indices */ MatcherIndicesIndex(36),
+    /* num_templates   */ 0,
+    /* templates */ TemplateIndex(/* invalid */),
+    /* parameters */ ParameterIndex(97),
+    /* return_matcher_indices */ MatcherIndicesIndex(6),
     /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
   },
   {
     /* [31] */
     /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMemberFunction),
-    /* num_parameters */ 2,
+    /* num_parameters */ 1,
     /* num_explicit_templates */ 0,
-    /* num_templates   */ 1,
-    /* templates */ TemplateIndex(4),
-    /* parameters */ ParameterIndex(49),
-    /* return_matcher_indices */ MatcherIndicesIndex(58),
+    /* num_templates   */ 0,
+    /* templates */ TemplateIndex(/* invalid */),
+    /* parameters */ ParameterIndex(58),
+    /* return_matcher_indices */ MatcherIndicesIndex(6),
     /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
   },
   {
     /* [32] */
     /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMemberFunction),
-    /* num_parameters */ 2,
+    /* num_parameters */ 1,
     /* num_explicit_templates */ 0,
-    /* num_templates   */ 1,
-    /* templates */ TemplateIndex(4),
-    /* parameters */ ParameterIndex(51),
-    /* return_matcher_indices */ MatcherIndicesIndex(58),
+    /* num_templates   */ 2,
+    /* templates */ TemplateIndex(5),
+    /* parameters */ ParameterIndex(125),
+    /* return_matcher_indices */ MatcherIndicesIndex(6),
     /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
   },
   {
@@ -1568,10 +1965,10 @@
     /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMemberFunction),
     /* num_parameters */ 2,
     /* num_explicit_templates */ 0,
-    /* num_templates   */ 1,
-    /* templates */ TemplateIndex(4),
-    /* parameters */ ParameterIndex(53),
-    /* return_matcher_indices */ MatcherIndicesIndex(58),
+    /* num_templates   */ 2,
+    /* templates */ TemplateIndex(5),
+    /* parameters */ ParameterIndex(99),
+    /* return_matcher_indices */ MatcherIndicesIndex(6),
     /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
   },
   {
@@ -1579,10 +1976,10 @@
     /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMemberFunction),
     /* num_parameters */ 2,
     /* num_explicit_templates */ 0,
-    /* num_templates   */ 1,
-    /* templates */ TemplateIndex(4),
-    /* parameters */ ParameterIndex(55),
-    /* return_matcher_indices */ MatcherIndicesIndex(58),
+    /* num_templates   */ 2,
+    /* templates */ TemplateIndex(5),
+    /* parameters */ ParameterIndex(101),
+    /* return_matcher_indices */ MatcherIndicesIndex(6),
     /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
   },
   {
@@ -1590,179 +1987,399 @@
     /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMemberFunction),
     /* num_parameters */ 2,
     /* num_explicit_templates */ 0,
-    /* num_templates   */ 1,
-    /* templates */ TemplateIndex(4),
-    /* parameters */ ParameterIndex(57),
-    /* return_matcher_indices */ MatcherIndicesIndex(58),
+    /* num_templates   */ 2,
+    /* templates */ TemplateIndex(5),
+    /* parameters */ ParameterIndex(103),
+    /* return_matcher_indices */ MatcherIndicesIndex(6),
     /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
   },
   {
     /* [36] */
-    /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMemberFunction),
-    /* num_parameters */ 1,
+    /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kMemberFunction),
+    /* num_parameters */ 3,
     /* num_explicit_templates */ 0,
-    /* num_templates   */ 1,
-    /* templates */ TemplateIndex(4),
-    /* parameters */ ParameterIndex(74),
-    /* return_matcher_indices */ MatcherIndicesIndex(58),
+    /* num_templates   */ 0,
+    /* templates */ TemplateIndex(/* invalid */),
+    /* parameters */ ParameterIndex(70),
+    /* return_matcher_indices */ MatcherIndicesIndex(77),
     /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
   },
   {
     /* [37] */
-    /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMemberFunction),
-    /* num_parameters */ 2,
+    /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kMemberFunction),
+    /* num_parameters */ 3,
     /* num_explicit_templates */ 0,
     /* num_templates   */ 0,
     /* templates */ TemplateIndex(/* invalid */),
-    /* parameters */ ParameterIndex(59),
-    /* return_matcher_indices */ MatcherIndicesIndex(58),
+    /* parameters */ ParameterIndex(23),
+    /* return_matcher_indices */ MatcherIndicesIndex(77),
     /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
   },
   {
     /* [38] */
-    /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMemberFunction),
-    /* num_parameters */ 2,
+    /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kMemberFunction),
+    /* num_parameters */ 4,
     /* num_explicit_templates */ 0,
     /* num_templates   */ 0,
     /* templates */ TemplateIndex(/* invalid */),
-    /* parameters */ ParameterIndex(61),
-    /* return_matcher_indices */ MatcherIndicesIndex(58),
+    /* parameters */ ParameterIndex(23),
+    /* return_matcher_indices */ MatcherIndicesIndex(77),
     /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
   },
   {
     /* [39] */
-    /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMemberFunction),
-    /* num_parameters */ 2,
+    /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kMemberFunction),
+    /* num_parameters */ 4,
     /* num_explicit_templates */ 0,
-    /* num_templates   */ 0,
-    /* templates */ TemplateIndex(/* invalid */),
-    /* parameters */ ParameterIndex(63),
-    /* return_matcher_indices */ MatcherIndicesIndex(58),
+    /* num_templates   */ 1,
+    /* templates */ TemplateIndex(1),
+    /* parameters */ ParameterIndex(5),
+    /* return_matcher_indices */ MatcherIndicesIndex(77),
     /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
   },
   {
     /* [40] */
+    /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kMemberFunction),
+    /* num_parameters */ 5,
+    /* num_explicit_templates */ 0,
+    /* num_templates   */ 1,
+    /* templates */ TemplateIndex(1),
+    /* parameters */ ParameterIndex(5),
+    /* return_matcher_indices */ MatcherIndicesIndex(77),
+    /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
+  },
+  {
+    /* [41] */
+    /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kMemberFunction),
+    /* num_parameters */ 3,
+    /* num_explicit_templates */ 0,
+    /* num_templates   */ 0,
+    /* templates */ TemplateIndex(/* invalid */),
+    /* parameters */ ParameterIndex(27),
+    /* return_matcher_indices */ MatcherIndicesIndex(77),
+    /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
+  },
+  {
+    /* [42] */
+    /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kMemberFunction),
+    /* num_parameters */ 4,
+    /* num_explicit_templates */ 0,
+    /* num_templates   */ 0,
+    /* templates */ TemplateIndex(/* invalid */),
+    /* parameters */ ParameterIndex(27),
+    /* return_matcher_indices */ MatcherIndicesIndex(77),
+    /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
+  },
+  {
+    /* [43] */
+    /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kMemberFunction),
+    /* num_parameters */ 3,
+    /* num_explicit_templates */ 0,
+    /* num_templates   */ 0,
+    /* templates */ TemplateIndex(/* invalid */),
+    /* parameters */ ParameterIndex(73),
+    /* return_matcher_indices */ MatcherIndicesIndex(77),
+    /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
+  },
+  {
+    /* [44] */
+    /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kMemberFunction),
+    /* num_parameters */ 4,
+    /* num_explicit_templates */ 0,
+    /* num_templates   */ 1,
+    /* templates */ TemplateIndex(1),
+    /* parameters */ ParameterIndex(31),
+    /* return_matcher_indices */ MatcherIndicesIndex(77),
+    /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
+  },
+  {
+    /* [45] */
+    /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kMemberFunction),
+    /* num_parameters */ 3,
+    /* num_explicit_templates */ 0,
+    /* num_templates   */ 0,
+    /* templates */ TemplateIndex(/* invalid */),
+    /* parameters */ ParameterIndex(35),
+    /* return_matcher_indices */ MatcherIndicesIndex(78),
+    /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
+  },
+  {
+    /* [46] */
+    /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kMemberFunction),
+    /* num_parameters */ 4,
+    /* num_explicit_templates */ 0,
+    /* num_templates   */ 0,
+    /* templates */ TemplateIndex(/* invalid */),
+    /* parameters */ ParameterIndex(35),
+    /* return_matcher_indices */ MatcherIndicesIndex(78),
+    /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
+  },
+  {
+    /* [47] */
+    /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kMemberFunction),
+    /* num_parameters */ 4,
+    /* num_explicit_templates */ 0,
+    /* num_templates   */ 1,
+    /* templates */ TemplateIndex(1),
+    /* parameters */ ParameterIndex(10),
+    /* return_matcher_indices */ MatcherIndicesIndex(78),
+    /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
+  },
+  {
+    /* [48] */
+    /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kMemberFunction),
+    /* num_parameters */ 5,
+    /* num_explicit_templates */ 0,
+    /* num_templates   */ 1,
+    /* templates */ TemplateIndex(1),
+    /* parameters */ ParameterIndex(10),
+    /* return_matcher_indices */ MatcherIndicesIndex(78),
+    /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
+  },
+  {
+    /* [49] */
+    /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kMemberFunction),
+    /* num_parameters */ 3,
+    /* num_explicit_templates */ 0,
+    /* num_templates   */ 0,
+    /* templates */ TemplateIndex(/* invalid */),
+    /* parameters */ ParameterIndex(76),
+    /* return_matcher_indices */ MatcherIndicesIndex(78),
+    /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
+  },
+  {
+    /* [50] */
+    /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kMemberFunction),
+    /* num_parameters */ 4,
+    /* num_explicit_templates */ 0,
+    /* num_templates   */ 1,
+    /* templates */ TemplateIndex(1),
+    /* parameters */ ParameterIndex(39),
+    /* return_matcher_indices */ MatcherIndicesIndex(78),
+    /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
+  },
+  {
+    /* [51] */
+    /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMemberFunction),
+    /* num_parameters */ 2,
+    /* num_explicit_templates */ 0,
+    /* num_templates   */ 1,
+    /* templates */ TemplateIndex(0),
+    /* parameters */ ParameterIndex(81),
+    /* return_matcher_indices */ MatcherIndicesIndex(6),
+    /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
+  },
+  {
+    /* [52] */
+    /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMemberFunction),
+    /* num_parameters */ 2,
+    /* num_explicit_templates */ 0,
+    /* num_templates   */ 1,
+    /* templates */ TemplateIndex(0),
+    /* parameters */ ParameterIndex(83),
+    /* return_matcher_indices */ MatcherIndicesIndex(6),
+    /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
+  },
+  {
+    /* [53] */
+    /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMemberFunction),
+    /* num_parameters */ 2,
+    /* num_explicit_templates */ 0,
+    /* num_templates   */ 1,
+    /* templates */ TemplateIndex(0),
+    /* parameters */ ParameterIndex(85),
+    /* return_matcher_indices */ MatcherIndicesIndex(6),
+    /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
+  },
+  {
+    /* [54] */
+    /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMemberFunction),
+    /* num_parameters */ 2,
+    /* num_explicit_templates */ 0,
+    /* num_templates   */ 1,
+    /* templates */ TemplateIndex(0),
+    /* parameters */ ParameterIndex(87),
+    /* return_matcher_indices */ MatcherIndicesIndex(6),
+    /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
+  },
+  {
+    /* [55] */
+    /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMemberFunction),
+    /* num_parameters */ 2,
+    /* num_explicit_templates */ 0,
+    /* num_templates   */ 1,
+    /* templates */ TemplateIndex(0),
+    /* parameters */ ParameterIndex(89),
+    /* return_matcher_indices */ MatcherIndicesIndex(6),
+    /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
+  },
+  {
+    /* [56] */
+    /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMemberFunction),
+    /* num_parameters */ 1,
+    /* num_explicit_templates */ 0,
+    /* num_templates   */ 1,
+    /* templates */ TemplateIndex(0),
+    /* parameters */ ParameterIndex(52),
+    /* return_matcher_indices */ MatcherIndicesIndex(6),
+    /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
+  },
+  {
+    /* [57] */
     /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMemberFunction),
     /* num_parameters */ 2,
     /* num_explicit_templates */ 0,
     /* num_templates   */ 0,
     /* templates */ TemplateIndex(/* invalid */),
-    /* parameters */ ParameterIndex(65),
-    /* return_matcher_indices */ MatcherIndicesIndex(58),
+    /* parameters */ ParameterIndex(91),
+    /* return_matcher_indices */ MatcherIndicesIndex(6),
     /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
   },
   {
-    /* [41] */
+    /* [58] */
+    /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMemberFunction),
+    /* num_parameters */ 2,
+    /* num_explicit_templates */ 0,
+    /* num_templates   */ 0,
+    /* templates */ TemplateIndex(/* invalid */),
+    /* parameters */ ParameterIndex(93),
+    /* return_matcher_indices */ MatcherIndicesIndex(6),
+    /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
+  },
+  {
+    /* [59] */
+    /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMemberFunction),
+    /* num_parameters */ 2,
+    /* num_explicit_templates */ 0,
+    /* num_templates   */ 0,
+    /* templates */ TemplateIndex(/* invalid */),
+    /* parameters */ ParameterIndex(95),
+    /* return_matcher_indices */ MatcherIndicesIndex(6),
+    /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
+  },
+  {
+    /* [60] */
+    /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMemberFunction),
+    /* num_parameters */ 2,
+    /* num_explicit_templates */ 0,
+    /* num_templates   */ 0,
+    /* templates */ TemplateIndex(/* invalid */),
+    /* parameters */ ParameterIndex(97),
+    /* return_matcher_indices */ MatcherIndicesIndex(6),
+    /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
+  },
+  {
+    /* [61] */
     /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMemberFunction),
     /* num_parameters */ 1,
     /* num_explicit_templates */ 0,
     /* num_templates   */ 0,
     /* templates */ TemplateIndex(/* invalid */),
-    /* parameters */ ParameterIndex(75),
-    /* return_matcher_indices */ MatcherIndicesIndex(58),
+    /* parameters */ ParameterIndex(58),
+    /* return_matcher_indices */ MatcherIndicesIndex(6),
     /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
   },
   {
-    /* [42] */
+    /* [62] */
     /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMemberFunction),
     /* num_parameters */ 2,
     /* num_explicit_templates */ 0,
     /* num_templates   */ 2,
-    /* templates */ TemplateIndex(2),
-    /* parameters */ ParameterIndex(67),
-    /* return_matcher_indices */ MatcherIndicesIndex(58),
+    /* templates */ TemplateIndex(5),
+    /* parameters */ ParameterIndex(99),
+    /* return_matcher_indices */ MatcherIndicesIndex(6),
     /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
   },
   {
-    /* [43] */
+    /* [63] */
     /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMemberFunction),
     /* num_parameters */ 2,
     /* num_explicit_templates */ 0,
     /* num_templates   */ 2,
-    /* templates */ TemplateIndex(2),
-    /* parameters */ ParameterIndex(69),
-    /* return_matcher_indices */ MatcherIndicesIndex(58),
+    /* templates */ TemplateIndex(5),
+    /* parameters */ ParameterIndex(101),
+    /* return_matcher_indices */ MatcherIndicesIndex(6),
     /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
   },
   {
-    /* [44] */
+    /* [64] */
     /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMemberFunction),
     /* num_parameters */ 2,
     /* num_explicit_templates */ 0,
     /* num_templates   */ 2,
-    /* templates */ TemplateIndex(2),
-    /* parameters */ ParameterIndex(71),
-    /* return_matcher_indices */ MatcherIndicesIndex(58),
+    /* templates */ TemplateIndex(5),
+    /* parameters */ ParameterIndex(103),
+    /* return_matcher_indices */ MatcherIndicesIndex(6),
     /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
   },
   {
-    /* [45] */
+    /* [65] */
     /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMemberFunction),
     /* num_parameters */ 2,
     /* num_explicit_templates */ 0,
     /* num_templates   */ 1,
-    /* templates */ TemplateIndex(4),
-    /* parameters */ ParameterIndex(53),
-    /* return_matcher_indices */ MatcherIndicesIndex(58),
+    /* templates */ TemplateIndex(0),
+    /* parameters */ ParameterIndex(85),
+    /* return_matcher_indices */ MatcherIndicesIndex(6),
     /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
   },
   {
-    /* [46] */
+    /* [66] */
     /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMemberFunction),
     /* num_parameters */ 2,
     /* num_explicit_templates */ 0,
     /* num_templates   */ 2,
-    /* templates */ TemplateIndex(2),
-    /* parameters */ ParameterIndex(71),
-    /* return_matcher_indices */ MatcherIndicesIndex(58),
+    /* templates */ TemplateIndex(5),
+    /* parameters */ ParameterIndex(103),
+    /* return_matcher_indices */ MatcherIndicesIndex(6),
     /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
   },
   {
-    /* [47] */
+    /* [67] */
     /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline),
     /* num_parameters */ 5,
     /* num_explicit_templates */ 0,
     /* num_templates   */ 2,
-    /* templates */ TemplateIndex(0),
+    /* templates */ TemplateIndex(3),
     /* parameters */ ParameterIndex(0),
     /* return_matcher_indices */ MatcherIndicesIndex(4),
     /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
   },
   {
-    /* [48] */
+    /* [68] */
     /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline),
     /* num_parameters */ 3,
     /* num_explicit_templates */ 0,
     /* num_templates   */ 2,
-    /* templates */ TemplateIndex(0),
-    /* parameters */ ParameterIndex(35),
+    /* templates */ TemplateIndex(3),
+    /* parameters */ ParameterIndex(43),
     /* return_matcher_indices */ MatcherIndicesIndex(3),
     /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
   },
   {
-    /* [49] */
+    /* [69] */
     /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline),
     /* num_parameters */ 2,
     /* num_explicit_templates */ 0,
     /* num_templates   */ 2,
-    /* templates */ TemplateIndex(0),
-    /* parameters */ ParameterIndex(47),
+    /* templates */ TemplateIndex(3),
+    /* parameters */ ParameterIndex(79),
     /* return_matcher_indices */ MatcherIndicesIndex(3),
     /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
   },
   {
-    /* [50] */
+    /* [70] */
     /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline),
     /* num_parameters */ 3,
     /* num_explicit_templates */ 0,
     /* num_templates   */ 2,
-    /* templates */ TemplateIndex(0),
-    /* parameters */ ParameterIndex(35),
+    /* templates */ TemplateIndex(3),
+    /* parameters */ ParameterIndex(43),
     /* return_matcher_indices */ MatcherIndicesIndex(/* invalid */),
     /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
   },
   {
-    /* [51] */
+    /* [71] */
     /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsComputePipeline),
     /* num_parameters */ 1,
     /* num_explicit_templates */ 0,
@@ -1782,67 +2399,67 @@
     /* [0] */
     /* fn atomic_compare_exchange_weak_explicit[T : iu32, S : workgroup_or_storage](ptr<S, atomic<T>, read_write>, ptr<function, T, read_write>, T, u32, u32) -> bool */
     /* num overloads */ 1,
-    /* overloads */ OverloadIndex(47),
+    /* overloads */ OverloadIndex(67),
   },
   {
     /* [1] */
     /* fn atomic_exchange_explicit[T : iu32, S : workgroup_or_storage](ptr<S, atomic<T>, read_write>, T, u32) -> T */
     /* num overloads */ 1,
-    /* overloads */ OverloadIndex(48),
+    /* overloads */ OverloadIndex(68),
   },
   {
     /* [2] */
     /* fn atomic_fetch_add_explicit[T : iu32, S : workgroup_or_storage](ptr<S, atomic<T>, read_write>, T, u32) -> T */
     /* num overloads */ 1,
-    /* overloads */ OverloadIndex(48),
+    /* overloads */ OverloadIndex(68),
   },
   {
     /* [3] */
     /* fn atomic_fetch_and_explicit[T : iu32, S : workgroup_or_storage](ptr<S, atomic<T>, read_write>, T, u32) -> T */
     /* num overloads */ 1,
-    /* overloads */ OverloadIndex(48),
+    /* overloads */ OverloadIndex(68),
   },
   {
     /* [4] */
     /* fn atomic_fetch_max_explicit[T : iu32, S : workgroup_or_storage](ptr<S, atomic<T>, read_write>, T, u32) -> T */
     /* num overloads */ 1,
-    /* overloads */ OverloadIndex(48),
+    /* overloads */ OverloadIndex(68),
   },
   {
     /* [5] */
     /* fn atomic_fetch_min_explicit[T : iu32, S : workgroup_or_storage](ptr<S, atomic<T>, read_write>, T, u32) -> T */
     /* num overloads */ 1,
-    /* overloads */ OverloadIndex(48),
+    /* overloads */ OverloadIndex(68),
   },
   {
     /* [6] */
     /* fn atomic_fetch_or_explicit[T : iu32, S : workgroup_or_storage](ptr<S, atomic<T>, read_write>, T, u32) -> T */
     /* num overloads */ 1,
-    /* overloads */ OverloadIndex(48),
+    /* overloads */ OverloadIndex(68),
   },
   {
     /* [7] */
     /* fn atomic_fetch_sub_explicit[T : iu32, S : workgroup_or_storage](ptr<S, atomic<T>, read_write>, T, u32) -> T */
     /* num overloads */ 1,
-    /* overloads */ OverloadIndex(48),
+    /* overloads */ OverloadIndex(68),
   },
   {
     /* [8] */
     /* fn atomic_fetch_xor_explicit[T : iu32, S : workgroup_or_storage](ptr<S, atomic<T>, read_write>, T, u32) -> T */
     /* num overloads */ 1,
-    /* overloads */ OverloadIndex(48),
+    /* overloads */ OverloadIndex(68),
   },
   {
     /* [9] */
     /* fn atomic_load_explicit[T : iu32, S : workgroup_or_storage](ptr<S, atomic<T>, read_write>, u32) -> T */
     /* num overloads */ 1,
-    /* overloads */ OverloadIndex(49),
+    /* overloads */ OverloadIndex(69),
   },
   {
     /* [10] */
     /* fn atomic_store_explicit[T : iu32, S : workgroup_or_storage](ptr<S, atomic<T>, read_write>, T, u32) */
     /* num overloads */ 1,
-    /* overloads */ OverloadIndex(50),
+    /* overloads */ OverloadIndex(70),
   },
   {
     /* [11] */
@@ -1863,7 +2480,7 @@
     /* fn get_width[F : texel_format, A : access](texture: texture_storage_2d_array<F, A>, u32) -> u32 */
     /* fn get_width[F : texel_format, A : access](texture: texture_storage_3d<F, A>, u32) -> u32 */
     /* num overloads */ 16,
-    /* overloads */ OverloadIndex(0),
+    /* overloads */ OverloadIndex(20),
   },
   {
     /* [12] */
@@ -1882,17 +2499,42 @@
     /* fn get_height[F : texel_format, A : access](texture: texture_storage_2d_array<F, A>, u32) -> u32 */
     /* fn get_height[F : texel_format, A : access](texture: texture_storage_3d<F, A>, u32) -> u32 */
     /* num overloads */ 14,
-    /* overloads */ OverloadIndex(31),
+    /* overloads */ OverloadIndex(51),
   },
   {
     /* [13] */
     /* fn get_depth[T : fiu32](texture: texture_3d<T>, u32) -> u32 */
     /* fn get_depth[F : texel_format, A : access](texture: texture_storage_3d<F, A>, u32) -> u32 */
     /* num overloads */ 2,
-    /* overloads */ OverloadIndex(45),
+    /* overloads */ OverloadIndex(65),
   },
   {
     /* [14] */
+    /* fn read[T : fiu32](texture: texture_1d<T>, coords: u32) -> vec4<T> */
+    /* fn read[T : fiu32, L : iu32](texture: texture_2d<T>, coords: vec2<u32>, level: L) -> vec4<T> */
+    /* fn read[T : fiu32, A : iu32, L : iu32](texture: texture_2d_array<T>, coords: vec2<u32>, array_index: A, level: L) -> vec4<T> */
+    /* fn read[T : fiu32, L : iu32](texture: texture_3d<T>, coords: vec3<u32>, level: L) -> vec4<T> */
+    /* fn read[T : fiu32, S : iu32](texture: texture_multisampled_2d<T>, coords: vec2<u32>, sample_index: S) -> vec4<T> */
+    /* fn read[L : iu32](texture: texture_depth_2d, coords: vec2<u32>, level: L) -> f32 */
+    /* fn read[A : iu32, L : iu32](texture: texture_depth_2d_array, coords: vec2<u32>, array_index: A, level: L) -> f32 */
+    /* fn read[S : iu32](texture: texture_depth_multisampled_2d, coords: vec2<u32>, sample_index: S) -> f32 */
+    /* fn read(texture: texture_storage_1d<f32_texel_format, readable>, coords: u32) -> vec4<f32> */
+    /* fn read(texture: texture_storage_2d<f32_texel_format, readable>, coords: vec2<u32>) -> vec4<f32> */
+    /* fn read[A : iu32](texture: texture_storage_2d_array<f32_texel_format, readable>, coords: vec2<u32>, array_index: A) -> vec4<f32> */
+    /* fn read(texture: texture_storage_3d<f32_texel_format, readable>, coords: vec3<u32>) -> vec4<f32> */
+    /* fn read(texture: texture_storage_1d<i32_texel_format, readable>, coords: u32) -> vec4<i32> */
+    /* fn read(texture: texture_storage_2d<i32_texel_format, readable>, coords: vec2<u32>) -> vec4<i32> */
+    /* fn read[A : iu32](texture: texture_storage_2d_array<i32_texel_format, readable>, coords: vec2<u32>, array_index: A) -> vec4<i32> */
+    /* fn read(texture: texture_storage_3d<i32_texel_format, readable>, coords: vec3<u32>) -> vec4<i32> */
+    /* fn read(texture: texture_storage_1d<u32_texel_format, readable>, coords: u32) -> vec4<u32> */
+    /* fn read(texture: texture_storage_2d<u32_texel_format, readable>, coords: vec2<u32>) -> vec4<u32> */
+    /* fn read[A : iu32](texture: texture_storage_2d_array<u32_texel_format, readable>, coords: vec2<u32>, array_index: A) -> vec4<u32> */
+    /* fn read(texture: texture_storage_3d<u32_texel_format, readable>, coords: vec3<u32>) -> vec4<u32> */
+    /* num overloads */ 20,
+    /* overloads */ OverloadIndex(0),
+  },
+  {
+    /* [15] */
     /* fn sample(texture: texture_1d<f32>, sampler: sampler, coords: f32) -> vec4<f32> */
     /* fn sample(texture: texture_2d<f32>, sampler: sampler, coords: vec2<f32>) -> vec4<f32> */
     /* fn sample(texture: texture_2d<f32>, sampler: sampler, coords: vec2<f32>, @const offset: vec2<i32>) -> vec4<f32> */
@@ -1909,13 +2551,13 @@
     /* fn sample(texture: texture_depth_cube, sampler: sampler, coords: vec3<f32>) -> f32 */
     /* fn sample[A : iu32](texture: texture_depth_cube_array, sampler: sampler, coords: vec3<f32>, array_index: A) -> f32 */
     /* num overloads */ 15,
-    /* overloads */ OverloadIndex(16),
+    /* overloads */ OverloadIndex(36),
   },
   {
-    /* [15] */
+    /* [16] */
     /* fn threadgroup_barrier(u32) */
     /* num overloads */ 1,
-    /* overloads */ OverloadIndex(51),
+    /* overloads */ OverloadIndex(71),
   },
 };
 
diff --git a/src/tint/lang/msl/msl.def b/src/tint/lang/msl/msl.def
index 47f6c3c..ffe389e 100644
--- a/src/tint/lang/msl/msl.def
+++ b/src/tint/lang/msl/msl.def
@@ -44,12 +44,37 @@
 ////////////////////////////////////////////////////////////////////////////////
 
 match read_write: access.read_write
+match readable
+  : access.read
+  | access.read_write
 
 match function: address_space.function
 match workgroup_or_storage
   : address_space.workgroup
   | address_space.storage
 
+match f32_texel_format
+  : texel_format.r8unorm
+  | texel_format.bgra8unorm
+  | texel_format.rgba8unorm
+  | texel_format.rgba8snorm
+  | texel_format.rgba16float
+  | texel_format.r32float
+  | texel_format.rg32float
+  | texel_format.rgba32float
+match i32_texel_format
+  : texel_format.rgba8sint
+  | texel_format.rgba16sint
+  | texel_format.r32sint
+  | texel_format.rg32sint
+  | texel_format.rgba32sint
+match u32_texel_format
+  : texel_format.rgba8uint
+  | texel_format.rgba16uint
+  | texel_format.r32uint
+  | texel_format.rg32uint
+  | texel_format.rgba32uint
+
 ////////////////////////////////////////////////////////////////////////////////
 // Types                                                                      //
 ////////////////////////////////////////////////////////////////////////////////
@@ -138,6 +163,27 @@
 @member_function fn get_depth[T: fiu32](texture: texture_3d<T>, u32) -> u32
 @member_function fn get_depth[F: texel_format, A: access](texture: texture_storage_3d<F, A>, u32) -> u32
 
+@member_function fn read[T: fiu32](texture: texture_1d<T>, coords: u32) -> vec4<T>
+@member_function fn read[T: fiu32, L: iu32](texture: texture_2d<T>, coords: vec2<u32>, level: L) -> vec4<T>
+@member_function fn read[T: fiu32, A: iu32, L: iu32](texture: texture_2d_array<T>, coords: vec2<u32>, array_index: A, level: L) -> vec4<T>
+@member_function fn read[T: fiu32, L: iu32](texture: texture_3d<T>, coords: vec3<u32>, level: L) -> vec4<T>
+@member_function fn read[T: fiu32, S: iu32](texture: texture_multisampled_2d<T>, coords: vec2<u32>, sample_index: S) -> vec4<T>
+@member_function fn read[L: iu32](texture: texture_depth_2d, coords: vec2<u32>, level: L) -> f32
+@member_function fn read[A: iu32, L: iu32](texture: texture_depth_2d_array, coords: vec2<u32>, array_index: A, level: L) -> f32
+@member_function fn read[S: iu32](texture: texture_depth_multisampled_2d, coords: vec2<u32>, sample_index: S) -> f32
+@member_function fn read(texture: texture_storage_1d<f32_texel_format, readable>, coords: u32) -> vec4<f32>
+@member_function fn read(texture: texture_storage_2d<f32_texel_format, readable>, coords: vec2<u32>) -> vec4<f32>
+@member_function fn read[A: iu32](texture: texture_storage_2d_array<f32_texel_format, readable>, coords: vec2<u32>, array_index: A) -> vec4<f32>
+@member_function fn read(texture: texture_storage_3d<f32_texel_format, readable>, coords: vec3<u32>) -> vec4<f32>
+@member_function fn read(texture: texture_storage_1d<i32_texel_format, readable>, coords: u32) -> vec4<i32>
+@member_function fn read(texture: texture_storage_2d<i32_texel_format, readable>, coords: vec2<u32>) -> vec4<i32>
+@member_function fn read[A: iu32](texture: texture_storage_2d_array<i32_texel_format, readable>, coords: vec2<u32>, array_index: A) -> vec4<i32>
+@member_function fn read(texture: texture_storage_3d<i32_texel_format, readable>, coords: vec3<u32>) -> vec4<i32>
+@member_function fn read(texture: texture_storage_1d<u32_texel_format, readable>, coords: u32) -> vec4<u32>
+@member_function fn read(texture: texture_storage_2d<u32_texel_format, readable>, coords: vec2<u32>) -> vec4<u32>
+@member_function fn read[A: iu32](texture: texture_storage_2d_array<u32_texel_format, readable>, coords: vec2<u32>, array_index: A) -> vec4<u32>
+@member_function fn read(texture: texture_storage_3d<u32_texel_format, readable>, coords: vec3<u32>) -> vec4<u32>
+
 @member_function @stage("fragment") fn sample(texture: texture_1d<f32>, sampler: sampler, coords: f32) -> vec4<f32>
 @member_function @stage("fragment") fn sample(texture: texture_2d<f32>, sampler: sampler, coords: vec2<f32>) -> vec4<f32>
 @member_function @stage("fragment") fn sample(texture: texture_2d<f32>, sampler: sampler, coords: vec2<f32>, @const offset: vec2<i32>) -> vec4<f32>
diff --git a/src/tint/lang/msl/writer/raise/builtin_polyfill.cc b/src/tint/lang/msl/writer/raise/builtin_polyfill.cc
index 8e8ef6d..1a5824a 100644
--- a/src/tint/lang/msl/writer/raise/builtin_polyfill.cc
+++ b/src/tint/lang/msl/writer/raise/builtin_polyfill.cc
@@ -28,6 +28,7 @@
 #include "src/tint/lang/msl/writer/raise/builtin_polyfill.h"
 
 #include <atomic>
+#include <cstdint>
 #include <utility>
 
 #include "src/tint/lang/core/fluent_types.h"
@@ -38,8 +39,10 @@
 #include "src/tint/lang/core/ir/validator.h"
 #include "src/tint/lang/core/type/depth_multisampled_texture.h"
 #include "src/tint/lang/core/type/multisampled_texture.h"
+#include "src/tint/lang/core/type/storage_texture.h"
 #include "src/tint/lang/core/type/texture.h"
 #include "src/tint/lang/core/type/texture_dimension.h"
+#include "src/tint/lang/core/type/vector.h"
 #include "src/tint/lang/msl/barrier_type.h"
 #include "src/tint/lang/msl/builtin_fn.h"
 #include "src/tint/lang/msl/ir/builtin_call.h"
@@ -85,6 +88,7 @@
                     case core::BuiltinFn::kAtomicSub:
                     case core::BuiltinFn::kAtomicXor:
                     case core::BuiltinFn::kTextureDimensions:
+                    case core::BuiltinFn::kTextureLoad:
                     case core::BuiltinFn::kTextureSample:
                     case core::BuiltinFn::kStorageBarrier:
                     case core::BuiltinFn::kWorkgroupBarrier:
@@ -139,6 +143,9 @@
                 case core::BuiltinFn::kTextureDimensions:
                     TextureDimensions(builtin);
                     break;
+                case core::BuiltinFn::kTextureLoad:
+                    TextureLoad(builtin);
+                    break;
                 case core::BuiltinFn::kTextureSample:
                     TextureSample(builtin);
                     break;
@@ -259,6 +266,49 @@
         builtin->Destroy();
     }
 
+    /// Replace a textureLoad call with the equivalent MSL intrinsic.
+    /// @param builtin the builtin call instruction
+    void TextureLoad(core::ir::CoreBuiltinCall* builtin) {
+        uint32_t next_arg = 0;
+        auto* tex = builtin->Args()[next_arg++];
+        auto* tex_type = tex->Type()->As<core::type::Texture>();
+
+        // Extract the arguments from the core builtin call.
+        auto* coords = builtin->Args()[next_arg++];
+        core::ir::Value* index = nullptr;
+        core::ir::Value* lod_or_sample = nullptr;
+        if (tex_type->dim() == core::type::TextureDimension::k2dArray) {
+            index = builtin->Args()[next_arg++];
+        }
+        if (tex_type->dim() != core::type::TextureDimension::k1d &&
+            !tex_type->Is<core::type::StorageTexture>()) {
+            lod_or_sample = builtin->Args()[next_arg++];
+        }
+
+        b.InsertBefore(builtin, [&] {
+            // Convert the coordinates to unsigned integers if necessary.
+            if (coords->Type()->is_signed_integer_scalar_or_vector()) {
+                if (auto* vec = coords->Type()->As<core::type::Vector>()) {
+                    coords = b.Convert(ty.vec(ty.u32(), vec->Width()), coords)->Result(0);
+                } else {
+                    coords = b.Convert(ty.u32(), coords)->Result(0);
+                }
+            }
+
+            // Call the `read()` member function.
+            Vector<core::ir::Value*, 4> args{coords};
+            if (index) {
+                args.Push(index);
+            }
+            if (lod_or_sample) {
+                args.Push(lod_or_sample);
+            }
+            b.MemberCallWithResult<msl::ir::MemberBuiltinCall>(
+                builtin->DetachResult(), msl::BuiltinFn::kRead, tex, std::move(args));
+        });
+        builtin->Destroy();
+    }
+
     /// Replace a textureSample call with the equivalent MSL intrinsic.
     /// @param builtin the builtin call instruction
     void TextureSample(core::ir::CoreBuiltinCall* builtin) {
diff --git a/src/tint/lang/msl/writer/raise/builtin_polyfill_test.cc b/src/tint/lang/msl/writer/raise/builtin_polyfill_test.cc
index e5b17de..8f8a76b 100644
--- a/src/tint/lang/msl/writer/raise/builtin_polyfill_test.cc
+++ b/src/tint/lang/msl/writer/raise/builtin_polyfill_test.cc
@@ -30,12 +30,15 @@
 #include <utility>
 
 #include "gtest/gtest.h"
+#include "src/tint/lang/core/access.h"
 #include "src/tint/lang/core/fluent_types.h"
 #include "src/tint/lang/core/ir/transform/helper_test.h"
 #include "src/tint/lang/core/number.h"
+#include "src/tint/lang/core/texel_format.h"
 #include "src/tint/lang/core/type/atomic.h"
 #include "src/tint/lang/core/type/builtin_structs.h"
 #include "src/tint/lang/core/type/sampled_texture.h"
+#include "src/tint/lang/core/type/storage_texture.h"
 #include "src/tint/lang/core/type/texture_dimension.h"
 
 using namespace tint::core::fluent_types;     // NOLINT
@@ -898,6 +901,356 @@
     EXPECT_EQ(expect, str());
 }
 
+TEST_F(MslWriter_BuiltinPolyfillTest, TextureLoad_1d_U32Coord) {
+    auto format = core::TexelFormat::kRgba8Unorm;
+    auto* texture_ty = ty.Get<core::type::StorageTexture>(
+        core::type::TextureDimension::k1d, format, core::Access::kRead,
+        core::type::StorageTexture::SubtypeFor(format, ty));
+    auto* t = b.FunctionParam("t", texture_ty);
+    auto* coords = b.FunctionParam("coords", ty.u32());
+    auto* func = b.Function("foo", ty.vec4<f32>());
+    func->SetParams({t, coords});
+    b.Append(func->Block(), [&] {
+        auto* result = b.Call<vec4<f32>>(core::BuiltinFn::kTextureLoad, t, coords);
+        b.Return(func, result);
+    });
+
+    auto* src = R"(
+%foo = func(%t:texture_storage_1d<rgba8unorm, read>, %coords:u32):vec4<f32> {
+  $B1: {
+    %4:vec4<f32> = textureLoad %t, %coords
+    ret %4
+  }
+}
+)";
+    EXPECT_EQ(src, str());
+
+    auto* expect = R"(
+%foo = func(%t:texture_storage_1d<rgba8unorm, read>, %coords:u32):vec4<f32> {
+  $B1: {
+    %4:vec4<f32> = %t.read %coords
+    ret %4
+  }
+}
+)";
+
+    Run(BuiltinPolyfill);
+
+    EXPECT_EQ(expect, str());
+}
+
+TEST_F(MslWriter_BuiltinPolyfillTest, TextureLoad_1d_I32Coord) {
+    auto format = core::TexelFormat::kRgba8Unorm;
+    auto* texture_ty = ty.Get<core::type::StorageTexture>(
+        core::type::TextureDimension::k1d, format, core::Access::kRead,
+        core::type::StorageTexture::SubtypeFor(format, ty));
+    auto* t = b.FunctionParam("t", texture_ty);
+    auto* coords = b.FunctionParam("coords", ty.i32());
+    auto* func = b.Function("foo", ty.vec4<f32>());
+    func->SetParams({t, coords});
+    b.Append(func->Block(), [&] {
+        auto* result = b.Call<vec4<f32>>(core::BuiltinFn::kTextureLoad, t, coords);
+        b.Return(func, result);
+    });
+
+    auto* src = R"(
+%foo = func(%t:texture_storage_1d<rgba8unorm, read>, %coords:i32):vec4<f32> {
+  $B1: {
+    %4:vec4<f32> = textureLoad %t, %coords
+    ret %4
+  }
+}
+)";
+    EXPECT_EQ(src, str());
+
+    auto* expect = R"(
+%foo = func(%t:texture_storage_1d<rgba8unorm, read>, %coords:i32):vec4<f32> {
+  $B1: {
+    %4:u32 = convert %coords
+    %5:vec4<f32> = %t.read %4
+    ret %5
+  }
+}
+)";
+
+    Run(BuiltinPolyfill);
+
+    EXPECT_EQ(expect, str());
+}
+
+TEST_F(MslWriter_BuiltinPolyfillTest, TextureLoad_2d_U32Coords) {
+    auto format = core::TexelFormat::kRgba8Unorm;
+    auto* texture_ty = ty.Get<core::type::StorageTexture>(
+        core::type::TextureDimension::k2d, format, core::Access::kRead,
+        core::type::StorageTexture::SubtypeFor(format, ty));
+    auto* t = b.FunctionParam("t", texture_ty);
+    auto* coords = b.FunctionParam("coords", ty.vec2<u32>());
+    auto* func = b.Function("foo", ty.vec4<f32>());
+    func->SetParams({t, coords});
+    b.Append(func->Block(), [&] {
+        auto* result = b.Call<vec4<f32>>(core::BuiltinFn::kTextureLoad, t, coords);
+        b.Return(func, result);
+    });
+
+    auto* src = R"(
+%foo = func(%t:texture_storage_2d<rgba8unorm, read>, %coords:vec2<u32>):vec4<f32> {
+  $B1: {
+    %4:vec4<f32> = textureLoad %t, %coords
+    ret %4
+  }
+}
+)";
+    EXPECT_EQ(src, str());
+
+    auto* expect = R"(
+%foo = func(%t:texture_storage_2d<rgba8unorm, read>, %coords:vec2<u32>):vec4<f32> {
+  $B1: {
+    %4:vec4<f32> = %t.read %coords
+    ret %4
+  }
+}
+)";
+
+    Run(BuiltinPolyfill);
+
+    EXPECT_EQ(expect, str());
+}
+
+TEST_F(MslWriter_BuiltinPolyfillTest, TextureLoad_2d_I32Coords) {
+    auto format = core::TexelFormat::kRgba8Unorm;
+    auto* texture_ty = ty.Get<core::type::StorageTexture>(
+        core::type::TextureDimension::k2d, format, core::Access::kRead,
+        core::type::StorageTexture::SubtypeFor(format, ty));
+    auto* t = b.FunctionParam("t", texture_ty);
+    auto* coords = b.FunctionParam("coords", ty.vec2<i32>());
+    auto* func = b.Function("foo", ty.vec4<f32>());
+    func->SetParams({t, coords});
+    b.Append(func->Block(), [&] {
+        auto* result = b.Call<vec4<f32>>(core::BuiltinFn::kTextureLoad, t, coords);
+        b.Return(func, result);
+    });
+
+    auto* src = R"(
+%foo = func(%t:texture_storage_2d<rgba8unorm, read>, %coords:vec2<i32>):vec4<f32> {
+  $B1: {
+    %4:vec4<f32> = textureLoad %t, %coords
+    ret %4
+  }
+}
+)";
+    EXPECT_EQ(src, str());
+
+    auto* expect = R"(
+%foo = func(%t:texture_storage_2d<rgba8unorm, read>, %coords:vec2<i32>):vec4<f32> {
+  $B1: {
+    %4:vec2<u32> = convert %coords
+    %5:vec4<f32> = %t.read %4
+    ret %5
+  }
+}
+)";
+
+    Run(BuiltinPolyfill);
+
+    EXPECT_EQ(expect, str());
+}
+
+TEST_F(MslWriter_BuiltinPolyfillTest, TextureLoad_2d_WithLevel) {
+    auto* texture_ty =
+        ty.Get<core::type::SampledTexture>(core::type::TextureDimension::k2d, ty.i32());
+    auto* t = b.FunctionParam("t", texture_ty);
+    auto* coords = b.FunctionParam("coords", ty.vec2<i32>());
+    auto* level = b.FunctionParam("level", ty.i32());
+    auto* func = b.Function("foo", ty.vec4<i32>());
+    func->SetParams({t, coords, level});
+    b.Append(func->Block(), [&] {
+        auto* result = b.Call<vec4<i32>>(core::BuiltinFn::kTextureLoad, t, coords, level);
+        b.Return(func, result);
+    });
+
+    auto* src = R"(
+%foo = func(%t:texture_2d<i32>, %coords:vec2<i32>, %level:i32):vec4<i32> {
+  $B1: {
+    %5:vec4<i32> = textureLoad %t, %coords, %level
+    ret %5
+  }
+}
+)";
+    EXPECT_EQ(src, str());
+
+    auto* expect = R"(
+%foo = func(%t:texture_2d<i32>, %coords:vec2<i32>, %level:i32):vec4<i32> {
+  $B1: {
+    %5:vec2<u32> = convert %coords
+    %6:vec4<i32> = %t.read %5, %level
+    ret %6
+  }
+}
+)";
+
+    Run(BuiltinPolyfill);
+
+    EXPECT_EQ(expect, str());
+}
+
+TEST_F(MslWriter_BuiltinPolyfillTest, TextureLoad_2darray_U32Index) {
+    auto format = core::TexelFormat::kRgba8Unorm;
+    auto* texture_ty = ty.Get<core::type::StorageTexture>(
+        core::type::TextureDimension::k2dArray, format, core::Access::kRead,
+        core::type::StorageTexture::SubtypeFor(format, ty));
+    auto* t = b.FunctionParam("t", texture_ty);
+    auto* coords = b.FunctionParam("coords", ty.vec2<i32>());
+    auto* index = b.FunctionParam("index", ty.u32());
+    auto* func = b.Function("foo", ty.vec4<f32>());
+    func->SetParams({t, coords, index});
+    b.Append(func->Block(), [&] {
+        auto* result = b.Call<vec4<f32>>(core::BuiltinFn::kTextureLoad, t, coords, index);
+        b.Return(func, result);
+    });
+
+    auto* src = R"(
+%foo = func(%t:texture_storage_2d_array<rgba8unorm, read>, %coords:vec2<i32>, %index:u32):vec4<f32> {
+  $B1: {
+    %5:vec4<f32> = textureLoad %t, %coords, %index
+    ret %5
+  }
+}
+)";
+    EXPECT_EQ(src, str());
+
+    auto* expect = R"(
+%foo = func(%t:texture_storage_2d_array<rgba8unorm, read>, %coords:vec2<i32>, %index:u32):vec4<f32> {
+  $B1: {
+    %5:vec2<u32> = convert %coords
+    %6:vec4<f32> = %t.read %5, %index
+    ret %6
+  }
+}
+)";
+
+    Run(BuiltinPolyfill);
+
+    EXPECT_EQ(expect, str());
+}
+
+TEST_F(MslWriter_BuiltinPolyfillTest, TextureLoad_2darray_I32Index) {
+    auto format = core::TexelFormat::kRgba8Unorm;
+    auto* texture_ty = ty.Get<core::type::StorageTexture>(
+        core::type::TextureDimension::k2dArray, format, core::Access::kRead,
+        core::type::StorageTexture::SubtypeFor(format, ty));
+    auto* t = b.FunctionParam("t", texture_ty);
+    auto* coords = b.FunctionParam("coords", ty.vec2<i32>());
+    auto* index = b.FunctionParam("index", ty.i32());
+    auto* func = b.Function("foo", ty.vec4<f32>());
+    func->SetParams({t, coords, index});
+    b.Append(func->Block(), [&] {
+        auto* result = b.Call<vec4<f32>>(core::BuiltinFn::kTextureLoad, t, coords, index);
+        b.Return(func, result);
+    });
+
+    auto* src = R"(
+%foo = func(%t:texture_storage_2d_array<rgba8unorm, read>, %coords:vec2<i32>, %index:i32):vec4<f32> {
+  $B1: {
+    %5:vec4<f32> = textureLoad %t, %coords, %index
+    ret %5
+  }
+}
+)";
+    EXPECT_EQ(src, str());
+
+    auto* expect = R"(
+%foo = func(%t:texture_storage_2d_array<rgba8unorm, read>, %coords:vec2<i32>, %index:i32):vec4<f32> {
+  $B1: {
+    %5:vec2<u32> = convert %coords
+    %6:vec4<f32> = %t.read %5, %index
+    ret %6
+  }
+}
+)";
+
+    Run(BuiltinPolyfill);
+
+    EXPECT_EQ(expect, str());
+}
+
+TEST_F(MslWriter_BuiltinPolyfillTest, TextureLoad_2darray_WithLevel) {
+    auto* texture_ty =
+        ty.Get<core::type::SampledTexture>(core::type::TextureDimension::k2dArray, ty.f32());
+    auto* t = b.FunctionParam("t", texture_ty);
+    auto* coords = b.FunctionParam("coords", ty.vec2<i32>());
+    auto* index = b.FunctionParam("index", ty.i32());
+    auto* level = b.FunctionParam("level", ty.i32());
+    auto* func = b.Function("foo", ty.vec4<f32>());
+    func->SetParams({t, coords, index, level});
+    b.Append(func->Block(), [&] {
+        auto* result = b.Call<vec4<f32>>(core::BuiltinFn::kTextureLoad, t, coords, index, level);
+        b.Return(func, result);
+    });
+
+    auto* src = R"(
+%foo = func(%t:texture_2d_array<f32>, %coords:vec2<i32>, %index:i32, %level:i32):vec4<f32> {
+  $B1: {
+    %6:vec4<f32> = textureLoad %t, %coords, %index, %level
+    ret %6
+  }
+}
+)";
+    EXPECT_EQ(src, str());
+
+    auto* expect = R"(
+%foo = func(%t:texture_2d_array<f32>, %coords:vec2<i32>, %index:i32, %level:i32):vec4<f32> {
+  $B1: {
+    %6:vec2<u32> = convert %coords
+    %7:vec4<f32> = %t.read %6, %index, %level
+    ret %7
+  }
+}
+)";
+
+    Run(BuiltinPolyfill);
+
+    EXPECT_EQ(expect, str());
+}
+
+TEST_F(MslWriter_BuiltinPolyfillTest, TextureLoad_3d) {
+    auto format = core::TexelFormat::kRgba8Unorm;
+    auto* texture_ty = ty.Get<core::type::StorageTexture>(
+        core::type::TextureDimension::k3d, format, core::Access::kRead,
+        core::type::StorageTexture::SubtypeFor(format, ty));
+    auto* t = b.FunctionParam("t", texture_ty);
+    auto* coords = b.FunctionParam("coords", ty.vec3<i32>());
+    auto* func = b.Function("foo", ty.vec4<f32>());
+    func->SetParams({t, coords});
+    b.Append(func->Block(), [&] {
+        auto* result = b.Call<vec4<f32>>(core::BuiltinFn::kTextureLoad, t, coords);
+        b.Return(func, result);
+    });
+
+    auto* src = R"(
+%foo = func(%t:texture_storage_3d<rgba8unorm, read>, %coords:vec3<i32>):vec4<f32> {
+  $B1: {
+    %4:vec4<f32> = textureLoad %t, %coords
+    ret %4
+  }
+}
+)";
+    EXPECT_EQ(src, str());
+
+    auto* expect = R"(
+%foo = func(%t:texture_storage_3d<rgba8unorm, read>, %coords:vec3<i32>):vec4<f32> {
+  $B1: {
+    %4:vec3<u32> = convert %coords
+    %5:vec4<f32> = %t.read %4
+    ret %5
+  }
+}
+)";
+
+    Run(BuiltinPolyfill);
+
+    EXPECT_EQ(expect, str());
+}
+
 TEST_F(MslWriter_BuiltinPolyfillTest, TextureSample) {
     auto* t = b.FunctionParam(
         "t", ty.Get<core::type::SampledTexture>(core::type::TextureDimension::k2d, ty.f32()));
diff --git a/test/tint/bug/chromium/1405676.wgsl.expected.ir.msl b/test/tint/bug/chromium/1405676.wgsl.expected.ir.msl
index ee65b2d..9636505 100644
--- a/test/tint/bug/chromium/1405676.wgsl.expected.ir.msl
+++ b/test/tint/bug/chromium/1405676.wgsl.expected.ir.msl
@@ -1,9 +1,10 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<int, access::sample> arg_0;
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:924 internal compiler error: TINT_UNREACHABLE unhandled: textureLoad
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
+void d(tint_module_vars_struct tint_module_vars) {
+  tint_module_vars.arg_0.read(uint(1));
+  float const l = 0.14112000167369842529f;
+}
diff --git a/test/tint/bug/tint/1976.wgsl.expected.ir.msl b/test/tint/bug/tint/1976.wgsl.expected.ir.msl
index 949e8a4..2d39a3b 100644
--- a/test/tint/bug/tint/1976.wgsl.expected.ir.msl
+++ b/test/tint/bug/tint/1976.wgsl.expected.ir.msl
@@ -1,29 +1,26 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+template<typename T, size_t N>
+struct tint_array {
+  const constant T& operator[](size_t i) const constant { return elements[i]; }
+  device T& operator[](size_t i) device { return elements[i]; }
+  const device T& operator[](size_t i) const device { return elements[i]; }
+  thread T& operator[](size_t i) thread { return elements[i]; }
+  const thread T& operator[](size_t i) const thread { return elements[i]; }
+  threadgroup T& operator[](size_t i) threadgroup { return elements[i]; }
+  const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; }
+  T elements[N];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: Results = struct @align(4) {
-  colorSamples:array<f32, 4> @offset(0)
+struct Results {
+  tint_array<float, 4> colorSamples;
+};
+struct tint_module_vars_struct {
+  texture2d_ms<float, access::read> texture0;
+  device Results* results;
+};
+
+kernel void tint_symbol(texture2d_ms<float, access::read> texture0 [[texture(0)]], device Results* results [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.texture0=texture0, .results=results};
+  (*tint_module_vars.results).colorSamples[0] = tint_module_vars.texture0.read(uint2(int2(0)), 0)[0u];
 }
-
-$B1: {  # root
-  %texture0:ptr<handle, texture_multisampled_2d<f32>, read> = var @binding_point(0, 0)
-  %results:ptr<storage, Results, read_write> = var @binding_point(0, 2)
-}
-
-%tint_symbol = @compute @workgroup_size(1, 1, 1) func():void {
-  $B2: {
-    %4:ptr<storage, f32, read_write> = access %results, 0u, 0i
-    %5:texture_multisampled_2d<f32> = load %texture0
-    %6:vec4<f32> = textureLoad %5, vec2<i32>(0i), 0i
-    %7:f32 = access %6, 0u
-    store %4, %7
-    ret
-  }
-}
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/bug/tint/534.wgsl.expected.ir.msl b/test/tint/bug/tint/534.wgsl.expected.ir.msl
index 23a4a58..e5c0247 100644
--- a/test/tint/bug/tint/534.wgsl.expected.ir.msl
+++ b/test/tint/bug/tint/534.wgsl.expected.ir.msl
@@ -1,151 +1,82 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+template<typename T, size_t N>
+struct tint_array {
+  const constant T& operator[](size_t i) const constant { return elements[i]; }
+  device T& operator[](size_t i) device { return elements[i]; }
+  const device T& operator[](size_t i) const device { return elements[i]; }
+  thread T& operator[](size_t i) thread { return elements[i]; }
+  const thread T& operator[](size_t i) const thread { return elements[i]; }
+  threadgroup T& operator[](size_t i) threadgroup { return elements[i]; }
+  const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; }
+  T elements[N];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: OutputBuf = struct @align(4) {
-  result:array<u32> @offset(0)
+struct OutputBuf {
+  tint_array<uint, 1> result;
+};
+struct Uniforms {
+  uint dstTextureFlipY;
+  uint isFloat16;
+  uint isRGB10A2Unorm;
+  uint channelCount;
+};
+struct tint_module_vars_struct {
+  texture2d<float, access::sample> src;
+  texture2d<float, access::sample> dst;
+  device OutputBuf* output;
+  const constant Uniforms* uniforms;
+};
+
+uint ConvertToFp16FloatValue(float fp32) {
+  return 1u;
 }
-
-Uniforms = struct @align(4) {
-  dstTextureFlipY:u32 @offset(0)
-  isFloat16:u32 @offset(4)
-  isRGB10A2Unorm:u32 @offset(8)
-  channelCount:u32 @offset(12)
+uint4 tint_v4f32_to_v4u32(float4 value) {
+  return select(uint4(4294967295u), select(uint4(0u), uint4(value), (value >= float4(0.0f))), (value <= float4(4294967040.0f)));
 }
-
-$B1: {  # root
-  %src:ptr<handle, texture_2d<f32>, read> = var @binding_point(0, 0)
-  %dst:ptr<handle, texture_2d<f32>, read> = var @binding_point(0, 1)
-  %output:ptr<storage, OutputBuf, read_write> = var @binding_point(0, 2)
-  %uniforms:ptr<uniform, Uniforms, read> = var @binding_point(0, 3)
-}
-
-%ConvertToFp16FloatValue = func(%fp32:f32):u32 {
-  $B2: {
-    ret 1u
+void tint_symbol_inner(uint3 GlobalInvocationID, tint_module_vars_struct tint_module_vars) {
+  uint const v = tint_module_vars.src.get_width(0u);
+  uint2 size = uint2(v, tint_module_vars.src.get_height(0u));
+  uint2 dstTexCoord = GlobalInvocationID.xy;
+  uint2 srcTexCoord = dstTexCoord;
+  if (((*tint_module_vars.uniforms).dstTextureFlipY == 1u)) {
+    srcTexCoord[1u] = ((size[1u] - dstTexCoord[1u]) - 1u);
+  }
+  float4 srcColor = tint_module_vars.src.read(srcTexCoord, 0);
+  float4 dstColor = tint_module_vars.dst.read(dstTexCoord, 0);
+  bool success = true;
+  uint4 srcColorBits = 0u;
+  uint4 dstColorBits = tint_v4f32_to_v4u32(dstColor);
+  {
+    uint i = 0u;
+    while(true) {
+      if ((i < (*tint_module_vars.uniforms).channelCount)) {
+      } else {
+        break;
+      }
+      uint const v_1 = i;
+      srcColorBits[v_1] = ConvertToFp16FloatValue(srcColor[i]);
+      bool v_2 = false;
+      if (success) {
+        v_2 = (srcColorBits[i] == dstColorBits[i]);
+      } else {
+        v_2 = false;
+      }
+      success = v_2;
+      {
+        i = (i + 1u);
+      }
+      continue;
+    }
+  }
+  uint outputIndex = ((GlobalInvocationID[1u] * uint(size[0u])) + GlobalInvocationID[0u]);
+  if (success) {
+    (*tint_module_vars.output).result[outputIndex] = 1u;
+  } else {
+    (*tint_module_vars.output).result[outputIndex] = 0u;
   }
 }
-%tint_symbol = @compute @workgroup_size(1, 1, 1) func(%GlobalInvocationID:vec3<u32> [@global_invocation_id]):void {
-  $B3: {
-    %9:texture_2d<f32> = load %src
-    %10:vec2<u32> = textureDimensions %9
-    %size:ptr<function, vec2<u32>, read_write> = var, %10
-    %12:vec2<u32> = swizzle %GlobalInvocationID, xy
-    %dstTexCoord:ptr<function, vec2<u32>, read_write> = var, %12
-    %14:vec2<u32> = load %dstTexCoord
-    %srcTexCoord:ptr<function, vec2<u32>, read_write> = var, %14
-    %16:ptr<uniform, u32, read> = access %uniforms, 0u
-    %17:u32 = load %16
-    %18:bool = eq %17, 1u
-    if %18 [t: $B4] {  # if_1
-      $B4: {  # true
-        %19:u32 = load_vector_element %size, 1u
-        %20:u32 = load_vector_element %dstTexCoord, 1u
-        %21:u32 = sub %19, %20
-        %22:u32 = sub %21, 1u
-        store_vector_element %srcTexCoord, 1u, %22
-        exit_if  # if_1
-      }
-    }
-    %23:texture_2d<f32> = load %src
-    %24:vec2<u32> = load %srcTexCoord
-    %25:vec4<f32> = textureLoad %23, %24, 0i
-    %srcColor:ptr<function, vec4<f32>, read_write> = var, %25
-    %27:texture_2d<f32> = load %dst
-    %28:vec2<u32> = load %dstTexCoord
-    %29:vec4<f32> = textureLoad %27, %28, 0i
-    %dstColor:ptr<function, vec4<f32>, read_write> = var, %29
-    %success:ptr<function, bool, read_write> = var, true
-    %srcColorBits:ptr<function, vec4<u32>, read_write> = var
-    %33:vec4<f32> = load %dstColor
-    %34:vec4<u32> = call %tint_v4f32_to_v4u32, %33
-    %dstColorBits:ptr<function, vec4<u32>, read_write> = var, %34
-    loop [i: $B5, b: $B6, c: $B7] {  # loop_1
-      $B5: {  # initializer
-        %i:ptr<function, u32, read_write> = var, 0u
-        next_iteration  # -> $B6
-      }
-      $B6: {  # body
-        %38:u32 = load %i
-        %39:ptr<uniform, u32, read> = access %uniforms, 3u
-        %40:u32 = load %39
-        %41:bool = lt %38, %40
-        if %41 [t: $B8, f: $B9] {  # if_2
-          $B8: {  # true
-            exit_if  # if_2
-          }
-          $B9: {  # false
-            exit_loop  # loop_1
-          }
-        }
-        %42:u32 = load %i
-        %43:u32 = let %42
-        %44:u32 = load %i
-        %45:f32 = load_vector_element %srcColor, %44
-        %46:u32 = call %ConvertToFp16FloatValue, %45
-        store_vector_element %srcColorBits, %43, %46
-        %47:bool = load %success
-        %48:bool = if %47 [t: $B10, f: $B11] {  # if_3
-          $B10: {  # true
-            %49:u32 = load %i
-            %50:u32 = load_vector_element %srcColorBits, %49
-            %51:u32 = load %i
-            %52:u32 = load_vector_element %dstColorBits, %51
-            %53:bool = eq %50, %52
-            exit_if %53  # if_3
-          }
-          $B11: {  # false
-            exit_if false  # if_3
-          }
-        }
-        store %success, %48
-        continue  # -> $B7
-      }
-      $B7: {  # continuing
-        %54:u32 = load %i
-        %55:u32 = add %54, 1u
-        store %i, %55
-        next_iteration  # -> $B6
-      }
-    }
-    %56:u32 = access %GlobalInvocationID, 1u
-    %57:u32 = load_vector_element %size, 0u
-    %58:u32 = construct %57
-    %59:u32 = mul %56, %58
-    %60:u32 = access %GlobalInvocationID, 0u
-    %61:u32 = add %59, %60
-    %outputIndex:ptr<function, u32, read_write> = var, %61
-    %63:bool = load %success
-    if %63 [t: $B12, f: $B13] {  # if_4
-      $B12: {  # true
-        %64:u32 = load %outputIndex
-        %65:ptr<storage, u32, read_write> = access %output, 0u, %64
-        store %65, 1u
-        exit_if  # if_4
-      }
-      $B13: {  # false
-        %66:u32 = load %outputIndex
-        %67:ptr<storage, u32, read_write> = access %output, 0u, %66
-        store %67, 0u
-        exit_if  # if_4
-      }
-    }
-    ret
-  }
+kernel void tint_symbol(uint3 GlobalInvocationID [[thread_position_in_grid]], texture2d<float, access::sample> src [[texture(0)]], texture2d<float, access::sample> dst [[texture(1)]], device OutputBuf* output [[buffer(1)]], const constant Uniforms* uniforms [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.src=src, .dst=dst, .output=output, .uniforms=uniforms};
+  tint_symbol_inner(GlobalInvocationID, tint_module_vars);
 }
-%tint_v4f32_to_v4u32 = func(%value:vec4<f32>):vec4<u32> {
-  $B14: {
-    %69:vec4<u32> = convert %value
-    %70:vec4<bool> = gte %value, vec4<f32>(0.0f)
-    %71:vec4<u32> = select vec4<u32>(0u), %69, %70
-    %72:vec4<bool> = lte %value, vec4<f32>(4294967040.0f)
-    %73:vec4<u32> = select vec4<u32>(4294967295u), %71, %72
-    ret %73
-  }
-}
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/bug/tint/827.wgsl.expected.ir.msl b/test/tint/bug/tint/827.wgsl.expected.ir.msl
index dd5bb6b..dd442727 100644
--- a/test/tint/bug/tint/827.wgsl.expected.ir.msl
+++ b/test/tint/bug/tint/827.wgsl.expected.ir.msl
@@ -1,39 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+template<typename T, size_t N>
+struct tint_array {
+  const constant T& operator[](size_t i) const constant { return elements[i]; }
+  device T& operator[](size_t i) device { return elements[i]; }
+  const device T& operator[](size_t i) const device { return elements[i]; }
+  thread T& operator[](size_t i) thread { return elements[i]; }
+  const thread T& operator[](size_t i) const thread { return elements[i]; }
+  threadgroup T& operator[](size_t i) threadgroup { return elements[i]; }
+  const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; }
+  T elements[N];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: Result = struct @align(4) {
-  values:array<f32> @offset(0)
+struct Result {
+  tint_array<float, 1> values;
+};
+struct tint_module_vars_struct {
+  depth2d<float, access::sample> tex;
+  device Result* result;
+};
+
+void tint_symbol_inner(uint3 GlobalInvocationId, tint_module_vars_struct tint_module_vars) {
+  int const v = int(GlobalInvocationId[0u]);
+  (*tint_module_vars.result).values[((GlobalInvocationId[1u] * 128u) + GlobalInvocationId[0u])] = tint_module_vars.tex.read(uint2(int2(v, int(GlobalInvocationId[1u]))), 0);
 }
-
-$B1: {  # root
-  %tex:ptr<handle, texture_depth_2d, read> = var @binding_point(0, 0)
-  %result:ptr<storage, Result, read_write> = var @binding_point(0, 1)
+kernel void tint_symbol(uint3 GlobalInvocationId [[thread_position_in_grid]], depth2d<float, access::sample> tex [[texture(0)]], device Result* result [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.tex=tex, .result=result};
+  tint_symbol_inner(GlobalInvocationId, tint_module_vars);
 }
-
-%tint_symbol = @compute @workgroup_size(1, 1, 1) func(%GlobalInvocationId:vec3<u32> [@global_invocation_id]):void {
-  $B2: {
-    %5:u32 = access %GlobalInvocationId, 1u
-    %6:u32 = mul %5, 128u
-    %7:u32 = access %GlobalInvocationId, 0u
-    %8:u32 = add %6, %7
-    %9:ptr<storage, f32, read_write> = access %result, 0u, %8
-    %10:texture_depth_2d = load %tex
-    %11:texture_depth_2d = let %10
-    %12:u32 = access %GlobalInvocationId, 0u
-    %13:i32 = convert %12
-    %14:i32 = let %13
-    %15:u32 = access %GlobalInvocationId, 1u
-    %16:i32 = convert %15
-    %17:vec2<i32> = construct %14, %16
-    %18:f32 = textureLoad %11, %17, 0i
-    store %9, %18
-    ret
-  }
-}
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/012e11.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/012e11.wgsl.expected.ir.msl
index 36f4d14..39c3cbb 100644
--- a/test/tint/builtins/gen/literal/textureLoad/012e11.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/012e11.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<rgba8unorm, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_012e11(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint3(int3(1)));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_012e11 = func():void {
-  $B2: {
-    %4:texture_storage_3d<rgba8unorm, read_write> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec3<i32>(1i)
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_012e11(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_012e11
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_012e11(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_012e11
-    ret
-  }
+kernel void compute_main(texture3d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_012e11(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_012e11
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/019da0.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/019da0.wgsl.expected.ir.msl
index b0cad39..95ae22c 100644
--- a/test/tint/builtins/gen/literal/textureLoad/019da0.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/019da0.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<float, access::sample> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_3d<f32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_019da0(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint3(int3(1)), 1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_019da0 = func():void {
-  $B2: {
-    %4:texture_3d<f32> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec3<i32>(1i), 1u
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_019da0(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_019da0
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_019da0(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_019da0
-    ret
-  }
+kernel void compute_main(texture3d<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_019da0(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_019da0
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/01cd01.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/01cd01.wgsl.expected.ir.msl
index 2941dc7..69dacbe 100644
--- a/test/tint/builtins/gen/literal/textureLoad/01cd01.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/01cd01.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<int, access::read_write> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<r32sint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_01cd01(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(uint2(1u), 1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_01cd01 = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<r32sint, read_write> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, vec2<u32>(1u), 1u
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_01cd01(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_01cd01
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_01cd01(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_01cd01
-    ret
-  }
+kernel void compute_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_01cd01(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_01cd01
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/026217.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/026217.wgsl.expected.ir.msl
index a88be3d..adef763 100644
--- a/test/tint/builtins/gen/literal/textureLoad/026217.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/026217.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<uint, access::sample> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_2d_array<u32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_026217(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(uint2(1u), 1u, 1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_026217 = func():void {
-  $B2: {
-    %4:texture_2d_array<u32> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, vec2<u32>(1u), 1u, 1i
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_026217(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_026217
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_026217(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_026217
-    ret
-  }
+kernel void compute_main(texture2d_array<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_026217(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_026217
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/02c48d.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/02c48d.wgsl.expected.ir.msl
index 04e2cff..aa91c46 100644
--- a/test/tint/builtins/gen/literal/textureLoad/02c48d.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/02c48d.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<uint, access::read_write> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<rgba16uint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_02c48d(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(uint3(1u));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_02c48d = func():void {
-  $B2: {
-    %4:texture_storage_3d<rgba16uint, read_write> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, vec3<u32>(1u)
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_02c48d(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_02c48d
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_02c48d(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_02c48d
-    ret
-  }
+kernel void compute_main(texture3d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_02c48d(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_02c48d
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/02ef1f.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/02ef1f.wgsl.expected.ir.msl
index 99115d2..6003894 100644
--- a/test/tint/builtins/gen/literal/textureLoad/02ef1f.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/02ef1f.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<uint, access::read_write> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<r32uint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_02ef1f(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(uint2(int2(1)));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_02ef1f = func():void {
-  $B2: {
-    %4:texture_storage_2d<r32uint, read_write> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, vec2<i32>(1i)
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_02ef1f(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_02ef1f
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_02ef1f(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_02ef1f
-    ret
-  }
+kernel void compute_main(texture2d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_02ef1f(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_02ef1f
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/03e03e.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/03e03e.wgsl.expected.ir.msl
index 6ac4028..4aa9a73 100644
--- a/test/tint/builtins/gen/literal/textureLoad/03e03e.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/03e03e.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<int, access::read_write> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<rgba16sint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_03e03e(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(uint3(int3(1)));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_03e03e = func():void {
-  $B2: {
-    %4:texture_storage_3d<rgba16sint, read_write> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, vec3<i32>(1i)
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_03e03e(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_03e03e
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_03e03e(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_03e03e
-    ret
-  }
+kernel void compute_main(texture3d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_03e03e(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_03e03e
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/045ec9.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/045ec9.wgsl.expected.ir.msl
index 2187362..97a9b37 100644
--- a/test/tint/builtins/gen/literal/textureLoad/045ec9.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/045ec9.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<int, access::read> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<rgba8sint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_045ec9(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(uint3(1u));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_045ec9 = func():void {
-  $B2: {
-    %4:texture_storage_3d<rgba8sint, read> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, vec3<u32>(1u)
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_045ec9(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_045ec9
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_045ec9(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_045ec9
-    ret
-  }
+kernel void compute_main(texture3d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_045ec9(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_045ec9
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/04b911.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/04b911.wgsl.expected.ir.msl
index a0059d1..055fdb4 100644
--- a/test/tint/builtins/gen/literal/textureLoad/04b911.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/04b911.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  depth2d_array<float, access::sample> arg_0;
+  device float* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_depth_2d_array, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, f32, read_write> = var @binding_point(2, 0)
+void textureLoad_04b911(tint_module_vars_struct tint_module_vars) {
+  float res = tint_module_vars.arg_0.read(uint2(1u), 1, 1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_04b911 = func():void {
-  $B2: {
-    %4:texture_depth_2d_array = load %arg_0
-    %5:f32 = textureLoad %4, vec2<u32>(1u), 1i, 1u
-    %res:ptr<function, f32, read_write> = var, %5
-    %7:f32 = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_04b911(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_04b911
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(depth2d_array<float, access::sample> arg_0 [[texture(0)]], device float* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_04b911(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_04b911
-    ret
-  }
+kernel void compute_main(depth2d_array<float, access::sample> arg_0 [[texture(0)]], device float* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_04b911(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_04b911
-    ret
-  }
+vertex vertex_main_outputs vertex_main(depth2d_array<float, access::sample> arg_0 [[texture(0)]], device float* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/050c33.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/050c33.wgsl.expected.ir.msl
index faf0593..69721eb 100644
--- a/test/tint/builtins/gen/literal/textureLoad/050c33.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/050c33.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<uint, access::read> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<rg32uint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_050c33(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(uint2(int2(1)));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_050c33 = func():void {
-  $B2: {
-    %4:texture_storage_2d<rg32uint, read> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, vec2<i32>(1i)
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_050c33(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_050c33
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_050c33(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_050c33
-    ret
-  }
+kernel void compute_main(texture2d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_050c33(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_050c33
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/054350.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/054350.wgsl.expected.ir.msl
index 22c060a..0d77bbb 100644
--- a/test/tint/builtins/gen/literal/textureLoad/054350.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/054350.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<uint, access::read_write> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<rgba8uint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_054350(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_054350 = func():void {
-  $B2: {
-    %4:texture_storage_1d<rgba8uint, read_write> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, 1u
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_054350(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_054350
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_054350(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_054350
-    ret
-  }
+kernel void compute_main(texture1d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_054350(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_054350
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/0674b1.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/0674b1.wgsl.expected.ir.msl
index 1095e81..68a4185 100644
--- a/test/tint/builtins/gen/literal/textureLoad/0674b1.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/0674b1.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<rgba8snorm, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_0674b1(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint3(1u));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_0674b1 = func():void {
-  $B2: {
-    %4:texture_storage_3d<rgba8snorm, read> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec3<u32>(1u)
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_0674b1(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_0674b1
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_0674b1(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_0674b1
-    ret
-  }
+kernel void compute_main(texture3d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_0674b1(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_0674b1
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/06ac37.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/06ac37.wgsl.expected.ir.msl
index 607b1dd..7fbfa6e 100644
--- a/test/tint/builtins/gen/literal/textureLoad/06ac37.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/06ac37.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba32float, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_06ac37(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint2(1u), 1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_06ac37 = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<rgba32float, read> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec2<u32>(1u), 1u
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_06ac37(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_06ac37
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_06ac37(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_06ac37
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_06ac37(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_06ac37
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/072e26.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/072e26.wgsl.expected.ir.msl
index 459910a..280d0cc 100644
--- a/test/tint/builtins/gen/literal/textureLoad/072e26.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/072e26.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba8snorm, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_072e26(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint2(int2(1)), 1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_072e26 = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<rgba8snorm, read> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec2<i32>(1i), 1i
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_072e26(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_072e26
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_072e26(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_072e26
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_072e26(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_072e26
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/078bc4.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/078bc4.wgsl.expected.ir.msl
index 889d13f..6482902 100644
--- a/test/tint/builtins/gen/literal/textureLoad/078bc4.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/078bc4.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<rgba8snorm, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_078bc4(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint2(int2(1)));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_078bc4 = func():void {
-  $B2: {
-    %4:texture_storage_2d<rgba8snorm, read> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec2<i32>(1i)
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_078bc4(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_078bc4
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_078bc4(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_078bc4
-    ret
-  }
+kernel void compute_main(texture2d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_078bc4(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_078bc4
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/0b515a.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/0b515a.wgsl.expected.ir.msl
index 3a3ac6b..f3bf5b5 100644
--- a/test/tint/builtins/gen/literal/textureLoad/0b515a.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/0b515a.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<int, access::read_write> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba16sint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_0b515a(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(uint2(1u), 1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_0b515a = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<rgba16sint, read_write> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, vec2<u32>(1u), 1u
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_0b515a(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_0b515a
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_0b515a(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_0b515a
-    ret
-  }
+kernel void compute_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_0b515a(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_0b515a
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/0cb698.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/0cb698.wgsl.expected.ir.msl
index 0c10bb6..ad77921 100644
--- a/test/tint/builtins/gen/literal/textureLoad/0cb698.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/0cb698.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<int, access::sample> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_1d<i32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_0cb698(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_0cb698 = func():void {
-  $B2: {
-    %4:texture_1d<i32> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, 1u, 1u
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_0cb698(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_0cb698
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_0cb698(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_0cb698
-    ret
-  }
+kernel void compute_main(texture1d<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_0cb698(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_0cb698
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/10db82.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/10db82.wgsl.expected.ir.msl
index 13670e4..f6ec324 100644
--- a/test/tint/builtins/gen/literal/textureLoad/10db82.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/10db82.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba16float, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_10db82(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint2(1u), 1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_10db82 = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<rgba16float, read> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec2<u32>(1u), 1u
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_10db82(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_10db82
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_10db82(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_10db82
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_10db82(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_10db82
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/126466.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/126466.wgsl.expected.ir.msl
index bc88972..66dba4d 100644
--- a/test/tint/builtins/gen/literal/textureLoad/126466.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/126466.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<rg32float, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_126466(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint3(int3(1)));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_126466 = func():void {
-  $B2: {
-    %4:texture_storage_3d<rg32float, read_write> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec3<i32>(1i)
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_126466(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_126466
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_126466(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_126466
-    ret
-  }
+kernel void compute_main(texture3d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_126466(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_126466
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/127e12.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/127e12.wgsl.expected.ir.msl
index aab4faa..9592b10 100644
--- a/test/tint/builtins/gen/literal/textureLoad/127e12.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/127e12.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<uint, access::read> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba16uint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_127e12(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(uint2(int2(1)), 1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_127e12 = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<rgba16uint, read> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, vec2<i32>(1i), 1i
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_127e12(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_127e12
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_127e12(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_127e12
-    ret
-  }
+kernel void compute_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_127e12(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_127e12
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/1373dc.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/1373dc.wgsl.expected.ir.msl
index eaecec0..d70b565 100644
--- a/test/tint/builtins/gen/literal/textureLoad/1373dc.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/1373dc.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<float, access::sample> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_1d<f32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_1373dc(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_1373dc = func():void {
-  $B2: {
-    %4:texture_1d<f32> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, 1u, 1i
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_1373dc(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_1373dc
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_1373dc(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_1373dc
-    ret
-  }
+kernel void compute_main(texture1d<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_1373dc(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_1373dc
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/13d539.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/13d539.wgsl.expected.ir.msl
index 63b1c97..5fc3307 100644
--- a/test/tint/builtins/gen/literal/textureLoad/13d539.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/13d539.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<int, access::read> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba16sint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_13d539(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(uint2(1u), 1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_13d539 = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<rgba16sint, read> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, vec2<u32>(1u), 1i
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_13d539(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_13d539
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_13d539(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_13d539
-    ret
-  }
+kernel void compute_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_13d539(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_13d539
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/13e90c.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/13e90c.wgsl.expected.ir.msl
index 89c884a..fef28ce 100644
--- a/test/tint/builtins/gen/literal/textureLoad/13e90c.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/13e90c.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba16float, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_13e90c(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint2(int2(1)), 1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_13e90c = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<rgba16float, read> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec2<i32>(1i), 1u
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_13e90c(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_13e90c
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_13e90c(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_13e90c
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_13e90c(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_13e90c
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/143d84.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/143d84.wgsl.expected.ir.msl
index 5d90cd4..f8b6520 100644
--- a/test/tint/builtins/gen/literal/textureLoad/143d84.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/143d84.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rg32float, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_143d84(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint2(int2(1)), 1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_143d84 = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<rg32float, read> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec2<i32>(1i), 1u
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_143d84(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_143d84
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_143d84(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_143d84
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_143d84(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_143d84
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/1471b8.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/1471b8.wgsl.expected.ir.msl
index f3d1126..4c4cc23 100644
--- a/test/tint/builtins/gen/literal/textureLoad/1471b8.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/1471b8.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<int, access::read> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba32sint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_1471b8(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(uint2(1u), 1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_1471b8 = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<rgba32sint, read> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, vec2<u32>(1u), 1i
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_1471b8(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_1471b8
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_1471b8(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_1471b8
-    ret
-  }
+kernel void compute_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_1471b8(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_1471b8
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/14cc4c.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/14cc4c.wgsl.expected.ir.msl
index fd3831b..105f7a8 100644
--- a/test/tint/builtins/gen/literal/textureLoad/14cc4c.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/14cc4c.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<rgba8unorm, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_14cc4c(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint2(int2(1)));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_14cc4c = func():void {
-  $B2: {
-    %4:texture_storage_2d<rgba8unorm, read_write> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec2<i32>(1i)
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_14cc4c(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_14cc4c
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_14cc4c(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_14cc4c
-    ret
-  }
+kernel void compute_main(texture2d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_14cc4c(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_14cc4c
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/1561a7.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/1561a7.wgsl.expected.ir.msl
index 1869055..18d4604 100644
--- a/test/tint/builtins/gen/literal/textureLoad/1561a7.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/1561a7.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<uint, access::read> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<r32uint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_1561a7(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(uint(1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_1561a7 = func():void {
-  $B2: {
-    %4:texture_storage_1d<r32uint, read> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, 1i
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_1561a7(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_1561a7
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_1561a7(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_1561a7
-    ret
-  }
+kernel void compute_main(texture1d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_1561a7(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_1561a7
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/15e675.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/15e675.wgsl.expected.ir.msl
index 9160919..b83ee74b 100644
--- a/test/tint/builtins/gen/literal/textureLoad/15e675.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/15e675.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<uint, access::read> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba8uint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_15e675(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(uint2(1u), 1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_15e675 = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<rgba8uint, read> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, vec2<u32>(1u), 1i
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_15e675(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_15e675
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_15e675(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_15e675
-    ret
-  }
+kernel void compute_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_15e675(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_15e675
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/1619bf.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/1619bf.wgsl.expected.ir.msl
index 9049d66..eea1818 100644
--- a/test/tint/builtins/gen/literal/textureLoad/1619bf.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/1619bf.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<int, access::read_write> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<r32sint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_1619bf(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(uint2(1u), 1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_1619bf = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<r32sint, read_write> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, vec2<u32>(1u), 1i
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_1619bf(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_1619bf
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_1619bf(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_1619bf
-    ret
-  }
+kernel void compute_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_1619bf(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_1619bf
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/168dc8.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/168dc8.wgsl.expected.ir.msl
index 6595d81..586764b 100644
--- a/test/tint/builtins/gen/literal/textureLoad/168dc8.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/168dc8.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<int, access::sample> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_2d_array<i32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_168dc8(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(uint2(1u), 1, 1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_168dc8 = func():void {
-  $B2: {
-    %4:texture_2d_array<i32> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, vec2<u32>(1u), 1i, 1i
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_168dc8(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_168dc8
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_168dc8(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_168dc8
-    ret
-  }
+kernel void compute_main(texture2d_array<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_168dc8(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_168dc8
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/170593.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/170593.wgsl.expected.ir.msl
index 77f3d10..0b95311 100644
--- a/test/tint/builtins/gen/literal/textureLoad/170593.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/170593.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<uint, access::read_write> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<rgba32uint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_170593(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(uint2(int2(1)));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_170593 = func():void {
-  $B2: {
-    %4:texture_storage_2d<rgba32uint, read_write> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, vec2<i32>(1i)
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_170593(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_170593
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_170593(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_170593
-    ret
-  }
+kernel void compute_main(texture2d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_170593(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_170593
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/17095b.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/17095b.wgsl.expected.ir.msl
index fb4a28d..3387a37 100644
--- a/test/tint/builtins/gen/literal/textureLoad/17095b.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/17095b.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<uint, access::read_write> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<rgba32uint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_17095b(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_17095b = func():void {
-  $B2: {
-    %4:texture_storage_1d<rgba32uint, read_write> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, 1u
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_17095b(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_17095b
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_17095b(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_17095b
-    ret
-  }
+kernel void compute_main(texture1d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_17095b(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_17095b
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/18ac11.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/18ac11.wgsl.expected.ir.msl
index 3ae6e69..24c92c2 100644
--- a/test/tint/builtins/gen/literal/textureLoad/18ac11.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/18ac11.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<int, access::read> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<rg32sint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_18ac11(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_18ac11 = func():void {
-  $B2: {
-    %4:texture_storage_1d<rg32sint, read> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, 1u
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_18ac11(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_18ac11
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_18ac11(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_18ac11
-    ret
-  }
+kernel void compute_main(texture1d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_18ac11(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_18ac11
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/19cf87.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/19cf87.wgsl.expected.ir.msl
index c498cfb..68b3b85 100644
--- a/test/tint/builtins/gen/literal/textureLoad/19cf87.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/19cf87.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  depth2d<float, access::sample> arg_0;
+  device float* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_depth_2d, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, f32, read_write> = var @binding_point(2, 0)
+void textureLoad_19cf87(tint_module_vars_struct tint_module_vars) {
+  float res = tint_module_vars.arg_0.read(uint2(int2(1)), 1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_19cf87 = func():void {
-  $B2: {
-    %4:texture_depth_2d = load %arg_0
-    %5:f32 = textureLoad %4, vec2<i32>(1i), 1i
-    %res:ptr<function, f32, read_write> = var, %5
-    %7:f32 = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_19cf87(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_19cf87
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(depth2d<float, access::sample> arg_0 [[texture(0)]], device float* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_19cf87(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_19cf87
-    ret
-  }
+kernel void compute_main(depth2d<float, access::sample> arg_0 [[texture(0)]], device float* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_19cf87(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_19cf87
-    ret
-  }
+vertex vertex_main_outputs vertex_main(depth2d<float, access::sample> arg_0 [[texture(0)]], device float* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/19d6be.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/19d6be.wgsl.expected.ir.msl
index 0552217..4af4046 100644
--- a/test/tint/builtins/gen/literal/textureLoad/19d6be.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/19d6be.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<uint, access::read_write> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<r32uint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_19d6be(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(uint3(1u));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_19d6be = func():void {
-  $B2: {
-    %4:texture_storage_3d<r32uint, read_write> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, vec3<u32>(1u)
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_19d6be(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_19d6be
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_19d6be(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_19d6be
-    ret
-  }
+kernel void compute_main(texture3d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_19d6be(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_19d6be
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/19e5ca.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/19e5ca.wgsl.expected.ir.msl
index f202122..7f389f3 100644
--- a/test/tint/builtins/gen/literal/textureLoad/19e5ca.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/19e5ca.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<r8unorm, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_19e5ca(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint2(int2(1)), 1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_19e5ca = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<r8unorm, read> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec2<i32>(1i), 1u
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_19e5ca(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_19e5ca
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_19e5ca(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_19e5ca
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_19e5ca(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_19e5ca
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/1a062f.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/1a062f.wgsl.expected.ir.msl
index 481b6f9..513e624 100644
--- a/test/tint/builtins/gen/literal/textureLoad/1a062f.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/1a062f.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba16float, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_1a062f(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint2(int2(1)), 1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_1a062f = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<rgba16float, read> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec2<i32>(1i), 1i
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_1a062f(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_1a062f
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_1a062f(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_1a062f
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_1a062f(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_1a062f
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/1a8452.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/1a8452.wgsl.expected.ir.msl
index bee8d48..91d35d6 100644
--- a/test/tint/builtins/gen/literal/textureLoad/1a8452.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/1a8452.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<uint, access::read> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<rgba8uint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_1a8452(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(uint(1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_1a8452 = func():void {
-  $B2: {
-    %4:texture_storage_1d<rgba8uint, read> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, 1i
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_1a8452(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_1a8452
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_1a8452(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_1a8452
-    ret
-  }
+kernel void compute_main(texture1d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_1a8452(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_1a8452
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/1aa950.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/1aa950.wgsl.expected.ir.msl
index 49ea59d..5c7d88b 100644
--- a/test/tint/builtins/gen/literal/textureLoad/1aa950.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/1aa950.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<int, access::read> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba32sint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_1aa950(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(uint2(int2(1)), 1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_1aa950 = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<rgba32sint, read> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, vec2<i32>(1i), 1u
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_1aa950(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_1aa950
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_1aa950(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_1aa950
-    ret
-  }
+kernel void compute_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_1aa950(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_1aa950
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/1b051f.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/1b051f.wgsl.expected.ir.msl
index 35c96bd..5f56f44 100644
--- a/test/tint/builtins/gen/literal/textureLoad/1b051f.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/1b051f.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<uint, access::sample> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_2d_array<u32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_1b051f(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(uint2(int2(1)), 1u, 1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_1b051f = func():void {
-  $B2: {
-    %4:texture_2d_array<u32> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, vec2<i32>(1i), 1u, 1u
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_1b051f(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_1b051f
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_1b051f(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_1b051f
-    ret
-  }
+kernel void compute_main(texture2d_array<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_1b051f(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_1b051f
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/1b4332.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/1b4332.wgsl.expected.ir.msl
index 17d3b3f..55795e4 100644
--- a/test/tint/builtins/gen/literal/textureLoad/1b4332.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/1b4332.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<uint, access::read_write> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<r32uint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_1b4332(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(uint3(int3(1)));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_1b4332 = func():void {
-  $B2: {
-    %4:texture_storage_3d<r32uint, read_write> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, vec3<i32>(1i)
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_1b4332(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_1b4332
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_1b4332(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_1b4332
-    ret
-  }
+kernel void compute_main(texture3d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_1b4332(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_1b4332
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/1b8588.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/1b8588.wgsl.expected.ir.msl
index f85fc6c..245d1f3 100644
--- a/test/tint/builtins/gen/literal/textureLoad/1b8588.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/1b8588.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<uint, access::sample> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_1d<u32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_1b8588(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(uint(1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_1b8588 = func():void {
-  $B2: {
-    %4:texture_1d<u32> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, 1i, 1i
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_1b8588(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_1b8588
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_1b8588(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_1b8588
-    ret
-  }
+kernel void compute_main(texture1d<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_1b8588(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_1b8588
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/1bc5ab.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/1bc5ab.wgsl.expected.ir.msl
index 666c2d5..260f063 100644
--- a/test/tint/builtins/gen/literal/textureLoad/1bc5ab.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/1bc5ab.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<rgba8snorm, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_1bc5ab(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint3(1u));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_1bc5ab = func():void {
-  $B2: {
-    %4:texture_storage_3d<rgba8snorm, read_write> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec3<u32>(1u)
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_1bc5ab(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_1bc5ab
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_1bc5ab(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_1bc5ab
-    ret
-  }
+kernel void compute_main(texture3d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_1bc5ab(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_1bc5ab
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/1bfdfb.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/1bfdfb.wgsl.expected.ir.msl
index a841470..a48e115 100644
--- a/test/tint/builtins/gen/literal/textureLoad/1bfdfb.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/1bfdfb.wgsl.expected.ir.msl
@@ -1,29 +1,9 @@
 SKIP: FAILED
 
-
-@group(1) @binding(0) var arg_0 : texture_external;
-
-fn textureLoad_1bfdfb() {
-  var res : vec4<f32> = textureLoad(arg_0, vec2<u32>(1u));
-  prevent_dce = res;
-}
-
-@group(2) @binding(0) var<storage, read_write> prevent_dce : vec4<f32>;
-
-@vertex
-fn vertex_main() -> @builtin(position) vec4<f32> {
-  textureLoad_1bfdfb();
-  return vec4<f32>();
-}
-
-@fragment
-fn fragment_main() {
-  textureLoad_1bfdfb();
-}
-
-@compute @workgroup_size(1)
-fn compute_main() {
-  textureLoad_1bfdfb();
-}
-
-Failed to generate: error: ExternalTextureOptions missing binding entry for [group: 1, binding: 0]
+../../src/tint/lang/msl/writer/printer/printer.cc:1006 internal compiler error: TINT_UNREACHABLE unhandled: abs
+********************************************************************
+*  The tint shader compiler has encountered an unexpected error.   *
+*                                                                  *
+*  Please help us fix this issue by submitting a bug report at     *
+*  crbug.com/tint with the source program that triggered the bug.  *
+********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/1c562a.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/1c562a.wgsl.expected.ir.msl
index 84cd7cf..115459e 100644
--- a/test/tint/builtins/gen/literal/textureLoad/1c562a.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/1c562a.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<uint, access::sample> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_3d<u32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_1c562a(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(uint3(1u), 1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_1c562a = func():void {
-  $B2: {
-    %4:texture_3d<u32> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, vec3<u32>(1u), 1u
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_1c562a(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_1c562a
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_1c562a(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_1c562a
-    ret
-  }
+kernel void compute_main(texture3d<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_1c562a(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_1c562a
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/1d43ae.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/1d43ae.wgsl.expected.ir.msl
index 2508a9f..3da91a1 100644
--- a/test/tint/builtins/gen/literal/textureLoad/1d43ae.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/1d43ae.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<int, access::read_write> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<rgba32sint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_1d43ae(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(uint(1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_1d43ae = func():void {
-  $B2: {
-    %4:texture_storage_1d<rgba32sint, read_write> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, 1i
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_1d43ae(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_1d43ae
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_1d43ae(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_1d43ae
-    ret
-  }
+kernel void compute_main(texture1d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_1d43ae(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_1d43ae
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/1e6baa.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/1e6baa.wgsl.expected.ir.msl
index 070c77e..4640b79 100644
--- a/test/tint/builtins/gen/literal/textureLoad/1e6baa.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/1e6baa.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<rg32float, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_1e6baa(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_1e6baa = func():void {
-  $B2: {
-    %4:texture_storage_1d<rg32float, read_write> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, 1u
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_1e6baa(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_1e6baa
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_1e6baa(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_1e6baa
-    ret
-  }
+kernel void compute_main(texture1d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_1e6baa(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_1e6baa
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/1eb93f.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/1eb93f.wgsl.expected.ir.msl
index 4a0c613..c652848 100644
--- a/test/tint/builtins/gen/literal/textureLoad/1eb93f.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/1eb93f.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<rg32float, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_1eb93f(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint2(1u));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_1eb93f = func():void {
-  $B2: {
-    %4:texture_storage_2d<rg32float, read> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec2<u32>(1u)
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_1eb93f(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_1eb93f
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_1eb93f(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_1eb93f
-    ret
-  }
+kernel void compute_main(texture2d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_1eb93f(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_1eb93f
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/1f2016.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/1f2016.wgsl.expected.ir.msl
index b67950a..cf36276 100644
--- a/test/tint/builtins/gen/literal/textureLoad/1f2016.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/1f2016.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<float, access::sample> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_3d<f32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_1f2016(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint3(int3(1)), 1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_1f2016 = func():void {
-  $B2: {
-    %4:texture_3d<f32> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec3<i32>(1i), 1i
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_1f2016(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_1f2016
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_1f2016(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_1f2016
-    ret
-  }
+kernel void compute_main(texture3d<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_1f2016(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_1f2016
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/1fde63.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/1fde63.wgsl.expected.ir.msl
index 431ede4..56e11dd 100644
--- a/test/tint/builtins/gen/literal/textureLoad/1fde63.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/1fde63.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<r8unorm, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_1fde63(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint3(1u));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_1fde63 = func():void {
-  $B2: {
-    %4:texture_storage_3d<r8unorm, read_write> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec3<u32>(1u)
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_1fde63(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_1fde63
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_1fde63(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_1fde63
-    ret
-  }
+kernel void compute_main(texture3d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_1fde63(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_1fde63
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/206a08.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/206a08.wgsl.expected.ir.msl
index 32d6780..34b795f 100644
--- a/test/tint/builtins/gen/literal/textureLoad/206a08.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/206a08.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<uint, access::read> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<rgba8uint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_206a08(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_206a08 = func():void {
-  $B2: {
-    %4:texture_storage_1d<rgba8uint, read> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, 1u
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_206a08(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_206a08
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_206a08(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_206a08
-    ret
-  }
+kernel void compute_main(texture1d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_206a08(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_206a08
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/20fa2f.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/20fa2f.wgsl.expected.ir.msl
index 01b255f..b7922d4 100644
--- a/test/tint/builtins/gen/literal/textureLoad/20fa2f.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/20fa2f.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rg32float, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_20fa2f(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint2(int2(1)), 1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_20fa2f = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<rg32float, read> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec2<i32>(1i), 1i
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_20fa2f(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_20fa2f
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_20fa2f(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_20fa2f
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_20fa2f(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_20fa2f
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/216c37.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/216c37.wgsl.expected.ir.msl
index b219cde..633ce6a 100644
--- a/test/tint/builtins/gen/literal/textureLoad/216c37.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/216c37.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<uint, access::sample> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_1d<u32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_216c37(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_216c37 = func():void {
-  $B2: {
-    %4:texture_1d<u32> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, 1u, 1i
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_216c37(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_216c37
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_216c37(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_216c37
-    ret
-  }
+kernel void compute_main(texture1d<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_216c37(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_216c37
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/21d1c4.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/21d1c4.wgsl.expected.ir.msl
index 5107816..28a6ca5 100644
--- a/test/tint/builtins/gen/literal/textureLoad/21d1c4.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/21d1c4.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<float, access::sample> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_3d<f32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_21d1c4(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint3(1u), 1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_21d1c4 = func():void {
-  $B2: {
-    %4:texture_3d<f32> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec3<u32>(1u), 1u
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_21d1c4(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_21d1c4
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_21d1c4(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_21d1c4
-    ret
-  }
+kernel void compute_main(texture3d<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_21d1c4(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_21d1c4
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/223246.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/223246.wgsl.expected.ir.msl
index dd111f0..c81a2f0 100644
--- a/test/tint/builtins/gen/literal/textureLoad/223246.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/223246.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<int, access::sample> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_3d<i32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_223246(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(uint3(1u), 1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_223246 = func():void {
-  $B2: {
-    %4:texture_3d<i32> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, vec3<u32>(1u), 1i
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_223246(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_223246
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_223246(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_223246
-    ret
-  }
+kernel void compute_main(texture3d<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_223246(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_223246
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/22e963.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/22e963.wgsl.expected.ir.msl
index 84e4e09..e33c95e 100644
--- a/test/tint/builtins/gen/literal/textureLoad/22e963.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/22e963.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<uint, access::read> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<r32uint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_22e963(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(uint2(1u), 1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_22e963 = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<r32uint, read> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, vec2<u32>(1u), 1u
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_22e963(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_22e963
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_22e963(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_22e963
-    ret
-  }
+kernel void compute_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_22e963(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_22e963
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/23007a.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/23007a.wgsl.expected.ir.msl
index 9e0d063..39f30fd 100644
--- a/test/tint/builtins/gen/literal/textureLoad/23007a.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/23007a.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rg32float, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_23007a(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint2(1u), 1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_23007a = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<rg32float, read> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec2<u32>(1u), 1i
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_23007a(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_23007a
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_23007a(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_23007a
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_23007a(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_23007a
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/2363be.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/2363be.wgsl.expected.ir.msl
index 7948136..9a05594 100644
--- a/test/tint/builtins/gen/literal/textureLoad/2363be.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/2363be.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<int, access::sample> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_2d_array<i32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_2363be(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(uint2(1u), 1, 1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_2363be = func():void {
-  $B2: {
-    %4:texture_2d_array<i32> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, vec2<u32>(1u), 1i, 1u
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_2363be(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_2363be
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_2363be(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_2363be
-    ret
-  }
+kernel void compute_main(texture2d_array<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_2363be(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_2363be
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/23ff89.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/23ff89.wgsl.expected.ir.msl
index 4df3e00..30ebb92 100644
--- a/test/tint/builtins/gen/literal/textureLoad/23ff89.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/23ff89.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<uint, access::read> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba16uint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_23ff89(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(uint2(1u), 1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_23ff89 = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<rgba16uint, read> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, vec2<u32>(1u), 1u
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_23ff89(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_23ff89
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_23ff89(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_23ff89
-    ret
-  }
+kernel void compute_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_23ff89(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_23ff89
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/25b67f.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/25b67f.wgsl.expected.ir.msl
index ff7f308..c060e6e 100644
--- a/test/tint/builtins/gen/literal/textureLoad/25b67f.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/25b67f.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<uint, access::read_write> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<rgba8uint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_25b67f(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(uint2(1u));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_25b67f = func():void {
-  $B2: {
-    %4:texture_storage_2d<rgba8uint, read_write> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, vec2<u32>(1u)
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_25b67f(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_25b67f
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_25b67f(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_25b67f
-    ret
-  }
+kernel void compute_main(texture2d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_25b67f(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_25b67f
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/26b8f6.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/26b8f6.wgsl.expected.ir.msl
index 248fbd9..4d4db5e 100644
--- a/test/tint/builtins/gen/literal/textureLoad/26b8f6.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/26b8f6.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<uint, access::read_write> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<rgba8uint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_26b8f6(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(uint3(1u));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_26b8f6 = func():void {
-  $B2: {
-    %4:texture_storage_3d<rgba8uint, read_write> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, vec3<u32>(1u)
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_26b8f6(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_26b8f6
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_26b8f6(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_26b8f6
-    ret
-  }
+kernel void compute_main(texture3d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_26b8f6(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_26b8f6
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/26c4f8.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/26c4f8.wgsl.expected.ir.msl
index f1d12a2..d570eee 100644
--- a/test/tint/builtins/gen/literal/textureLoad/26c4f8.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/26c4f8.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<bgra8unorm, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_26c4f8(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint2(int2(1)));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_26c4f8 = func():void {
-  $B2: {
-    %4:texture_storage_2d<bgra8unorm, read> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec2<i32>(1i)
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_26c4f8(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_26c4f8
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_26c4f8(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_26c4f8
-    ret
-  }
+kernel void compute_main(texture2d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_26c4f8(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_26c4f8
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/26d7f1.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/26d7f1.wgsl.expected.ir.msl
index 36e390d..f1d359e 100644
--- a/test/tint/builtins/gen/literal/textureLoad/26d7f1.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/26d7f1.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<uint, access::read> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rg32uint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_26d7f1(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(uint2(1u), 1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_26d7f1 = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<rg32uint, read> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, vec2<u32>(1u), 1i
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_26d7f1(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_26d7f1
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_26d7f1(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_26d7f1
-    ret
-  }
+kernel void compute_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_26d7f1(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_26d7f1
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/272e7a.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/272e7a.wgsl.expected.ir.msl
index 07de33b..83ee0dc 100644
--- a/test/tint/builtins/gen/literal/textureLoad/272e7a.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/272e7a.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<r32float, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_272e7a(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint3(1u));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_272e7a = func():void {
-  $B2: {
-    %4:texture_storage_3d<r32float, read_write> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec3<u32>(1u)
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_272e7a(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_272e7a
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_272e7a(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_272e7a
-    ret
-  }
+kernel void compute_main(texture3d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_272e7a(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_272e7a
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/276643.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/276643.wgsl.expected.ir.msl
index 19bad9b..f61052c 100644
--- a/test/tint/builtins/gen/literal/textureLoad/276643.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/276643.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<r8unorm, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_276643(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_276643 = func():void {
-  $B2: {
-    %4:texture_storage_1d<r8unorm, read> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, 1u
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_276643(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_276643
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_276643(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_276643
-    ret
-  }
+kernel void compute_main(texture1d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_276643(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_276643
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/276a2c.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/276a2c.wgsl.expected.ir.msl
index 13613ee..05a376b 100644
--- a/test/tint/builtins/gen/literal/textureLoad/276a2c.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/276a2c.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<uint, access::read> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<rgba32uint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_276a2c(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(uint(1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_276a2c = func():void {
-  $B2: {
-    %4:texture_storage_1d<rgba32uint, read> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, 1i
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_276a2c(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_276a2c
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_276a2c(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_276a2c
-    ret
-  }
+kernel void compute_main(texture1d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_276a2c(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_276a2c
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/2887d7.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/2887d7.wgsl.expected.ir.msl
index 2dee8b4..a814230 100644
--- a/test/tint/builtins/gen/literal/textureLoad/2887d7.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/2887d7.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<rgba32float, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_2887d7(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint(1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_2887d7 = func():void {
-  $B2: {
-    %4:texture_storage_1d<rgba32float, read> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, 1i
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_2887d7(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_2887d7
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_2887d7(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_2887d7
-    ret
-  }
+kernel void compute_main(texture1d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_2887d7(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_2887d7
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/2a82d9.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/2a82d9.wgsl.expected.ir.msl
index 2d292db..e54c230 100644
--- a/test/tint/builtins/gen/literal/textureLoad/2a82d9.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/2a82d9.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<int, access::read> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba32sint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_2a82d9(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(uint2(1u), 1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_2a82d9 = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<rgba32sint, read> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, vec2<u32>(1u), 1u
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_2a82d9(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_2a82d9
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_2a82d9(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_2a82d9
-    ret
-  }
+kernel void compute_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_2a82d9(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_2a82d9
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/2ae485.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/2ae485.wgsl.expected.ir.msl
index 053cf2f..07b304b 100644
--- a/test/tint/builtins/gen/literal/textureLoad/2ae485.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/2ae485.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<int, access::read> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<rgba16sint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_2ae485(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(uint2(int2(1)));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_2ae485 = func():void {
-  $B2: {
-    %4:texture_storage_2d<rgba16sint, read> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, vec2<i32>(1i)
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_2ae485(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_2ae485
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_2ae485(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_2ae485
-    ret
-  }
+kernel void compute_main(texture2d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_2ae485(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_2ae485
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/2c72ae.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/2c72ae.wgsl.expected.ir.msl
index 4766a7d..332c86f 100644
--- a/test/tint/builtins/gen/literal/textureLoad/2c72ae.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/2c72ae.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<int, access::read> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<rgba32sint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_2c72ae(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(uint2(1u));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_2c72ae = func():void {
-  $B2: {
-    %4:texture_storage_2d<rgba32sint, read> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, vec2<u32>(1u)
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_2c72ae(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_2c72ae
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_2c72ae(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_2c72ae
-    ret
-  }
+kernel void compute_main(texture2d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_2c72ae(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_2c72ae
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/2cee30.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/2cee30.wgsl.expected.ir.msl
index a27bde7..5141627 100644
--- a/test/tint/builtins/gen/literal/textureLoad/2cee30.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/2cee30.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<int, access::read_write> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba32sint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_2cee30(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(uint2(1u), 1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_2cee30 = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<rgba32sint, read_write> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, vec2<u32>(1u), 1i
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_2cee30(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_2cee30
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_2cee30(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_2cee30
-    ret
-  }
+kernel void compute_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_2cee30(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_2cee30
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/2d479c.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/2d479c.wgsl.expected.ir.msl
index c7bfad3..b64f746 100644
--- a/test/tint/builtins/gen/literal/textureLoad/2d479c.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/2d479c.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<float, access::sample> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_2d<f32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_2d479c(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint2(int2(1)), 1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_2d479c = func():void {
-  $B2: {
-    %4:texture_2d<f32> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec2<i32>(1i), 1u
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_2d479c(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_2d479c
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_2d479c(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_2d479c
-    ret
-  }
+kernel void compute_main(texture2d<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_2d479c(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_2d479c
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/2d6cf7.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/2d6cf7.wgsl.expected.ir.msl
index c086cd6..61195b0 100644
--- a/test/tint/builtins/gen/literal/textureLoad/2d6cf7.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/2d6cf7.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<int, access::read> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<rg32sint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_2d6cf7(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(uint(1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_2d6cf7 = func():void {
-  $B2: {
-    %4:texture_storage_1d<rg32sint, read> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, 1i
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_2d6cf7(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_2d6cf7
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_2d6cf7(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_2d6cf7
-    ret
-  }
+kernel void compute_main(texture1d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_2d6cf7(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_2d6cf7
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/2dbfc2.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/2dbfc2.wgsl.expected.ir.msl
index 53cc48e..4fc944d 100644
--- a/test/tint/builtins/gen/literal/textureLoad/2dbfc2.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/2dbfc2.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<bgra8unorm, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_2dbfc2(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint2(1u), 1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_2dbfc2 = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<bgra8unorm, read_write> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec2<u32>(1u), 1i
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_2dbfc2(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_2dbfc2
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_2dbfc2(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_2dbfc2
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_2dbfc2(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_2dbfc2
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/2e09aa.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/2e09aa.wgsl.expected.ir.msl
index 14bf31e..620138b 100644
--- a/test/tint/builtins/gen/literal/textureLoad/2e09aa.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/2e09aa.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_ms<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_multisampled_2d<f32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_2e09aa(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint2(1u), 1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_2e09aa = func():void {
-  $B2: {
-    %4:texture_multisampled_2d<f32> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec2<u32>(1u), 1u
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_2e09aa(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_2e09aa
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_ms<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_2e09aa(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_2e09aa
-    ret
-  }
+kernel void compute_main(texture2d_ms<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_2e09aa(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_2e09aa
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_ms<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/2e3552.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/2e3552.wgsl.expected.ir.msl
index a0e4ba0..b620285 100644
--- a/test/tint/builtins/gen/literal/textureLoad/2e3552.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/2e3552.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<r32float, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_2e3552(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint2(1u), 1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_2e3552 = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<r32float, read> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec2<u32>(1u), 1i
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_2e3552(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_2e3552
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_2e3552(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_2e3552
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_2e3552(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_2e3552
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/2eaf31.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/2eaf31.wgsl.expected.ir.msl
index acfbd6c..11b6d5a 100644
--- a/test/tint/builtins/gen/literal/textureLoad/2eaf31.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/2eaf31.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<int, access::read_write> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<rg32sint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_2eaf31(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(uint2(1u));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_2eaf31 = func():void {
-  $B2: {
-    %4:texture_storage_2d<rg32sint, read_write> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, vec2<u32>(1u)
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_2eaf31(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_2eaf31
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_2eaf31(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_2eaf31
-    ret
-  }
+kernel void compute_main(texture2d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_2eaf31(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_2eaf31
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/313c73.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/313c73.wgsl.expected.ir.msl
index 808e09c..ae9d080 100644
--- a/test/tint/builtins/gen/literal/textureLoad/313c73.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/313c73.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<int, access::read> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba16sint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_313c73(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(uint2(1u), 1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_313c73 = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<rgba16sint, read> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, vec2<u32>(1u), 1u
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_313c73(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_313c73
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_313c73(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_313c73
-    ret
-  }
+kernel void compute_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_313c73(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_313c73
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/31db4b.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/31db4b.wgsl.expected.ir.msl
index 7c5de66..48757f1 100644
--- a/test/tint/builtins/gen/literal/textureLoad/31db4b.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/31db4b.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<uint, access::read> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<r32uint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_31db4b(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_31db4b = func():void {
-  $B2: {
-    %4:texture_storage_1d<r32uint, read> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, 1u
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_31db4b(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_31db4b
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_31db4b(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_31db4b
-    ret
-  }
+kernel void compute_main(texture1d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_31db4b(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_31db4b
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/321210.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/321210.wgsl.expected.ir.msl
index 99cdb07..717342e 100644
--- a/test/tint/builtins/gen/literal/textureLoad/321210.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/321210.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<uint, access::read> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba16uint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_321210(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(uint2(int2(1)), 1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_321210 = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<rgba16uint, read> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, vec2<i32>(1i), 1u
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_321210(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_321210
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_321210(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_321210
-    ret
-  }
+kernel void compute_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_321210(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_321210
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/32a7b8.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/32a7b8.wgsl.expected.ir.msl
index 5862e3f..db276b0 100644
--- a/test/tint/builtins/gen/literal/textureLoad/32a7b8.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/32a7b8.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<int, access::read_write> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba8sint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_32a7b8(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(uint2(1u), 1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_32a7b8 = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<rgba8sint, read_write> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, vec2<u32>(1u), 1i
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_32a7b8(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_32a7b8
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_32a7b8(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_32a7b8
-    ret
-  }
+kernel void compute_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_32a7b8(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_32a7b8
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/33d3aa.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/33d3aa.wgsl.expected.ir.msl
index bb59bec..5b7d2a0 100644
--- a/test/tint/builtins/gen/literal/textureLoad/33d3aa.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/33d3aa.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<int, access::read> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<rgba32sint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_33d3aa(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_33d3aa = func():void {
-  $B2: {
-    %4:texture_storage_1d<rgba32sint, read> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, 1u
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_33d3aa(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_33d3aa
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_33d3aa(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_33d3aa
-    ret
-  }
+kernel void compute_main(texture1d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_33d3aa(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_33d3aa
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/348827.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/348827.wgsl.expected.ir.msl
index 3c5c63b..42a15e8 100644
--- a/test/tint/builtins/gen/literal/textureLoad/348827.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/348827.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<uint, access::read> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba32uint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_348827(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(uint2(1u), 1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_348827 = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<rgba32uint, read> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, vec2<u32>(1u), 1u
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_348827(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_348827
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_348827(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_348827
-    ret
-  }
+kernel void compute_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_348827(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_348827
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/34d97c.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/34d97c.wgsl.expected.ir.msl
index 57a2154..7721b3d 100644
--- a/test/tint/builtins/gen/literal/textureLoad/34d97c.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/34d97c.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<uint, access::read_write> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rg32uint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_34d97c(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(uint2(int2(1)), 1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_34d97c = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<rg32uint, read_write> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, vec2<i32>(1i), 1i
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_34d97c(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_34d97c
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_34d97c(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_34d97c
-    ret
-  }
+kernel void compute_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_34d97c(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_34d97c
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/35a5e2.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/35a5e2.wgsl.expected.ir.msl
index 0cb056c..844dc48 100644
--- a/test/tint/builtins/gen/literal/textureLoad/35a5e2.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/35a5e2.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<r8unorm, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_35a5e2(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint(1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_35a5e2 = func():void {
-  $B2: {
-    %4:texture_storage_1d<r8unorm, read_write> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, 1i
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_35a5e2(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_35a5e2
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_35a5e2(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_35a5e2
-    ret
-  }
+kernel void compute_main(texture1d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_35a5e2(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_35a5e2
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/35d464.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/35d464.wgsl.expected.ir.msl
index 51e6d05..d496275 100644
--- a/test/tint/builtins/gen/literal/textureLoad/35d464.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/35d464.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<r8unorm, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_35d464(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint2(int2(1)), 1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_35d464 = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<r8unorm, read> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec2<i32>(1i), 1i
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_35d464(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_35d464
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_35d464(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_35d464
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_35d464(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_35d464
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/374351.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/374351.wgsl.expected.ir.msl
index 269ad4a..2982460 100644
--- a/test/tint/builtins/gen/literal/textureLoad/374351.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/374351.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<uint, access::read> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<rgba16uint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_374351(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(uint3(1u));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_374351 = func():void {
-  $B2: {
-    %4:texture_storage_3d<rgba16uint, read> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, vec3<u32>(1u)
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_374351(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_374351
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_374351(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_374351
-    ret
-  }
+kernel void compute_main(texture3d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_374351(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_374351
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/388688.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/388688.wgsl.expected.ir.msl
index 4032148..3bef4f0 100644
--- a/test/tint/builtins/gen/literal/textureLoad/388688.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/388688.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<rgba8snorm, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_388688(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_388688 = func():void {
-  $B2: {
-    %4:texture_storage_1d<rgba8snorm, read> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, 1u
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_388688(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_388688
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_388688(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_388688
-    ret
-  }
+kernel void compute_main(texture1d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_388688(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_388688
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/38f8ab.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/38f8ab.wgsl.expected.ir.msl
index 5c378ca..3c5e725 100644
--- a/test/tint/builtins/gen/literal/textureLoad/38f8ab.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/38f8ab.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_ms<int, access::read> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_multisampled_2d<i32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_38f8ab(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(uint2(int2(1)), 1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_38f8ab = func():void {
-  $B2: {
-    %4:texture_multisampled_2d<i32> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, vec2<i32>(1i), 1u
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_38f8ab(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_38f8ab
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_ms<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_38f8ab(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_38f8ab
-    ret
-  }
+kernel void compute_main(texture2d_ms<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_38f8ab(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_38f8ab
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_ms<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/39016c.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/39016c.wgsl.expected.ir.msl
index 95a5676..ec3756d 100644
--- a/test/tint/builtins/gen/literal/textureLoad/39016c.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/39016c.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<rgba8snorm, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_39016c(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint2(int2(1)));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_39016c = func():void {
-  $B2: {
-    %4:texture_storage_2d<rgba8snorm, read_write> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec2<i32>(1i)
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_39016c(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_39016c
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_39016c(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_39016c
-    ret
-  }
+kernel void compute_main(texture2d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_39016c(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_39016c
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/395447.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/395447.wgsl.expected.ir.msl
index e290aaa4..c24bb5e 100644
--- a/test/tint/builtins/gen/literal/textureLoad/395447.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/395447.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<rgba32float, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_395447(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint2(1u));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_395447 = func():void {
-  $B2: {
-    %4:texture_storage_2d<rgba32float, read_write> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec2<u32>(1u)
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_395447(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_395447
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_395447(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_395447
-    ret
-  }
+kernel void compute_main(texture2d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_395447(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_395447
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/39ef40.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/39ef40.wgsl.expected.ir.msl
index d53f2c9..93972b9 100644
--- a/test/tint/builtins/gen/literal/textureLoad/39ef40.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/39ef40.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<rgba16float, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_39ef40(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_39ef40 = func():void {
-  $B2: {
-    %4:texture_storage_1d<rgba16float, read> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, 1u
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_39ef40(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_39ef40
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_39ef40(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_39ef40
-    ret
-  }
+kernel void compute_main(texture1d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_39ef40(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_39ef40
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/3a2350.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/3a2350.wgsl.expected.ir.msl
index b768de9..e478223 100644
--- a/test/tint/builtins/gen/literal/textureLoad/3a2350.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/3a2350.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<uint, access::read_write> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba16uint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_3a2350(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(uint2(int2(1)), 1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_3a2350 = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<rgba16uint, read_write> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, vec2<i32>(1i), 1u
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_3a2350(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_3a2350
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_3a2350(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_3a2350
-    ret
-  }
+kernel void compute_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_3a2350(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_3a2350
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/3aea13.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/3aea13.wgsl.expected.ir.msl
index a7591e7..ecf541b 100644
--- a/test/tint/builtins/gen/literal/textureLoad/3aea13.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/3aea13.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<int, access::read_write> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<r32sint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_3aea13(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(uint2(int2(1)), 1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_3aea13 = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<r32sint, read_write> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, vec2<i32>(1i), 1u
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_3aea13(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_3aea13
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_3aea13(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_3aea13
-    ret
-  }
+kernel void compute_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_3aea13(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_3aea13
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/3bbc2b.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/3bbc2b.wgsl.expected.ir.msl
index 6546e9c..f8e97e8 100644
--- a/test/tint/builtins/gen/literal/textureLoad/3bbc2b.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/3bbc2b.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<r32float, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_3bbc2b(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint(1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_3bbc2b = func():void {
-  $B2: {
-    %4:texture_storage_1d<r32float, read_write> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, 1i
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_3bbc2b(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_3bbc2b
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_3bbc2b(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_3bbc2b
-    ret
-  }
+kernel void compute_main(texture1d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_3bbc2b(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_3bbc2b
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/3c0d9e.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/3c0d9e.wgsl.expected.ir.msl
index 89b2c0b..ccee028 100644
--- a/test/tint/builtins/gen/literal/textureLoad/3c0d9e.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/3c0d9e.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<uint, access::read> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<rgba8uint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_3c0d9e(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(uint2(int2(1)));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_3c0d9e = func():void {
-  $B2: {
-    %4:texture_storage_2d<rgba8uint, read> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, vec2<i32>(1i)
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_3c0d9e(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_3c0d9e
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_3c0d9e(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_3c0d9e
-    ret
-  }
+kernel void compute_main(texture2d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_3c0d9e(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_3c0d9e
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/3c9587.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/3c9587.wgsl.expected.ir.msl
index 722851c..a89609b 100644
--- a/test/tint/builtins/gen/literal/textureLoad/3c9587.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/3c9587.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<rgba8unorm, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_3c9587(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint2(int2(1)));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_3c9587 = func():void {
-  $B2: {
-    %4:texture_storage_2d<rgba8unorm, read> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec2<i32>(1i)
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_3c9587(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_3c9587
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_3c9587(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_3c9587
-    ret
-  }
+kernel void compute_main(texture2d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_3c9587(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_3c9587
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/3c96e8.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/3c96e8.wgsl.expected.ir.msl
index 622fddd..87a310c 100644
--- a/test/tint/builtins/gen/literal/textureLoad/3c96e8.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/3c96e8.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::sample> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_2d_array<f32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_3c96e8(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint2(int2(1)), 1u, 1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_3c96e8 = func():void {
-  $B2: {
-    %4:texture_2d_array<f32> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec2<i32>(1i), 1u, 1u
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_3c96e8(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_3c96e8
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_3c96e8(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_3c96e8
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_3c96e8(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_3c96e8
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/3cfb9c.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/3cfb9c.wgsl.expected.ir.msl
index ad554c6..d04af4c 100644
--- a/test/tint/builtins/gen/literal/textureLoad/3cfb9c.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/3cfb9c.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<uint, access::read_write> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<rgba8uint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_3cfb9c(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(uint3(int3(1)));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_3cfb9c = func():void {
-  $B2: {
-    %4:texture_storage_3d<rgba8uint, read_write> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, vec3<i32>(1i)
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_3cfb9c(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_3cfb9c
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_3cfb9c(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_3cfb9c
-    ret
-  }
+kernel void compute_main(texture3d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_3cfb9c(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_3cfb9c
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/3d001b.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/3d001b.wgsl.expected.ir.msl
index 66e2708..10b3d3e 100644
--- a/test/tint/builtins/gen/literal/textureLoad/3d001b.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/3d001b.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<int, access::read> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<rgba8sint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_3d001b(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(uint3(int3(1)));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_3d001b = func():void {
-  $B2: {
-    %4:texture_storage_3d<rgba8sint, read> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, vec3<i32>(1i)
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_3d001b(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_3d001b
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_3d001b(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_3d001b
-    ret
-  }
+kernel void compute_main(texture3d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_3d001b(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_3d001b
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/3d3fd1.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/3d3fd1.wgsl.expected.ir.msl
index 809bc48..c704e97 100644
--- a/test/tint/builtins/gen/literal/textureLoad/3d3fd1.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/3d3fd1.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<int, access::sample> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_2d_array<i32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_3d3fd1(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(uint2(1u), 1u, 1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_3d3fd1 = func():void {
-  $B2: {
-    %4:texture_2d_array<i32> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, vec2<u32>(1u), 1u, 1i
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_3d3fd1(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_3d3fd1
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_3d3fd1(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_3d3fd1
-    ret
-  }
+kernel void compute_main(texture2d_array<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_3d3fd1(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_3d3fd1
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/3d9c90.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/3d9c90.wgsl.expected.ir.msl
index d62f3d0..8805b44 100644
--- a/test/tint/builtins/gen/literal/textureLoad/3d9c90.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/3d9c90.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<rgba32float, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_3d9c90(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint3(int3(1)));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_3d9c90 = func():void {
-  $B2: {
-    %4:texture_storage_3d<rgba32float, read> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec3<i32>(1i)
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_3d9c90(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_3d9c90
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_3d9c90(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_3d9c90
-    ret
-  }
+kernel void compute_main(texture3d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_3d9c90(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_3d9c90
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/3da3ed.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/3da3ed.wgsl.expected.ir.msl
index e4ac3ae..34eb9a4 100644
--- a/test/tint/builtins/gen/literal/textureLoad/3da3ed.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/3da3ed.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<float, access::sample> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_1d<f32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_3da3ed(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint(1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_3da3ed = func():void {
-  $B2: {
-    %4:texture_1d<f32> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, 1i, 1u
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_3da3ed(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_3da3ed
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_3da3ed(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_3da3ed
-    ret
-  }
+kernel void compute_main(texture1d<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_3da3ed(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_3da3ed
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/3e16a8.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/3e16a8.wgsl.expected.ir.msl
index 0a9215c..e530735 100644
--- a/test/tint/builtins/gen/literal/textureLoad/3e16a8.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/3e16a8.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<r8unorm, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_3e16a8(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint2(int2(1)));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_3e16a8 = func():void {
-  $B2: {
-    %4:texture_storage_2d<r8unorm, read_write> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec2<i32>(1i)
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_3e16a8(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_3e16a8
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_3e16a8(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_3e16a8
-    ret
-  }
+kernel void compute_main(texture2d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_3e16a8(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_3e16a8
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/3e5f6a.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/3e5f6a.wgsl.expected.ir.msl
index fa4b726..1812412 100644
--- a/test/tint/builtins/gen/literal/textureLoad/3e5f6a.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/3e5f6a.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<rgba16float, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_3e5f6a(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint2(1u));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_3e5f6a = func():void {
-  $B2: {
-    %4:texture_storage_2d<rgba16float, read> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec2<u32>(1u)
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_3e5f6a(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_3e5f6a
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_3e5f6a(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_3e5f6a
-    ret
-  }
+kernel void compute_main(texture2d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_3e5f6a(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_3e5f6a
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/40ee8b.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/40ee8b.wgsl.expected.ir.msl
index 88f39bc..1ce80e9 100644
--- a/test/tint/builtins/gen/literal/textureLoad/40ee8b.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/40ee8b.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<int, access::read_write> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba32sint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_40ee8b(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(uint2(int2(1)), 1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_40ee8b = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<rgba32sint, read_write> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, vec2<i32>(1i), 1u
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_40ee8b(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_40ee8b
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_40ee8b(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_40ee8b
-    ret
-  }
+kernel void compute_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_40ee8b(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_40ee8b
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/4212a1.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/4212a1.wgsl.expected.ir.msl
index 337caa4..4a1b70c 100644
--- a/test/tint/builtins/gen/literal/textureLoad/4212a1.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/4212a1.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<int, access::read_write> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<rgba32sint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_4212a1(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(uint2(int2(1)));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_4212a1 = func():void {
-  $B2: {
-    %4:texture_storage_2d<rgba32sint, read_write> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, vec2<i32>(1i)
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_4212a1(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_4212a1
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_4212a1(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_4212a1
-    ret
-  }
+kernel void compute_main(texture2d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_4212a1(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_4212a1
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/424afd.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/424afd.wgsl.expected.ir.msl
index 79a8d0f..2b722c4 100644
--- a/test/tint/builtins/gen/literal/textureLoad/424afd.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/424afd.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<int, access::read_write> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rg32sint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_424afd(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(uint2(int2(1)), 1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_424afd = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<rg32sint, read_write> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, vec2<i32>(1i), 1i
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_424afd(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_424afd
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_424afd(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_424afd
-    ret
-  }
+kernel void compute_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_424afd(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_424afd
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/42a631.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/42a631.wgsl.expected.ir.msl
index 2cb44a0..a4e2005 100644
--- a/test/tint/builtins/gen/literal/textureLoad/42a631.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/42a631.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<rgba16float, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_42a631(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint(1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_42a631 = func():void {
-  $B2: {
-    %4:texture_storage_1d<rgba16float, read_write> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, 1i
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_42a631(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_42a631
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_42a631(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_42a631
-    ret
-  }
+kernel void compute_main(texture1d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_42a631(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_42a631
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/43484a.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/43484a.wgsl.expected.ir.msl
index 686c9d0..2ad4f4b 100644
--- a/test/tint/builtins/gen/literal/textureLoad/43484a.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/43484a.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<r32float, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_43484a(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint2(1u), 1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_43484a = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<r32float, read_write> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec2<u32>(1u), 1u
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_43484a(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_43484a
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_43484a(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_43484a
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_43484a(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_43484a
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/439e2a.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/439e2a.wgsl.expected.ir.msl
index 5666880..cc70037 100644
--- a/test/tint/builtins/gen/literal/textureLoad/439e2a.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/439e2a.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<float, access::sample> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_2d<f32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_439e2a(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint2(1u), 1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_439e2a = func():void {
-  $B2: {
-    %4:texture_2d<f32> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec2<u32>(1u), 1i
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_439e2a(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_439e2a
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_439e2a(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_439e2a
-    ret
-  }
+kernel void compute_main(texture2d<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_439e2a(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_439e2a
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/43cd86.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/43cd86.wgsl.expected.ir.msl
index 4e1eee8..7493377 100644
--- a/test/tint/builtins/gen/literal/textureLoad/43cd86.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/43cd86.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<rgba8snorm, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_43cd86(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint2(1u));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_43cd86 = func():void {
-  $B2: {
-    %4:texture_storage_2d<rgba8snorm, read_write> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec2<u32>(1u)
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_43cd86(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_43cd86
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_43cd86(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_43cd86
-    ret
-  }
+kernel void compute_main(texture2d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_43cd86(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_43cd86
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/44c826.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/44c826.wgsl.expected.ir.msl
index 40b8325..4d0f5e8 100644
--- a/test/tint/builtins/gen/literal/textureLoad/44c826.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/44c826.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<uint, access::read> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<rg32uint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_44c826(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_44c826 = func():void {
-  $B2: {
-    %4:texture_storage_1d<rg32uint, read> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, 1u
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_44c826(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_44c826
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_44c826(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_44c826
-    ret
-  }
+kernel void compute_main(texture1d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_44c826(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_44c826
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/4542ae.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/4542ae.wgsl.expected.ir.msl
index c2dbf78..c0da47c 100644
--- a/test/tint/builtins/gen/literal/textureLoad/4542ae.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/4542ae.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba8unorm, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_4542ae(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint2(int2(1)), 1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_4542ae = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<rgba8unorm, read_write> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec2<i32>(1i), 1i
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_4542ae(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_4542ae
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_4542ae(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_4542ae
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_4542ae(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_4542ae
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/454347.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/454347.wgsl.expected.ir.msl
index 068ebf9..8af37f7 100644
--- a/test/tint/builtins/gen/literal/textureLoad/454347.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/454347.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<uint, access::read> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<rgba32uint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_454347(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_454347 = func():void {
-  $B2: {
-    %4:texture_storage_1d<rgba32uint, read> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, 1u
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_454347(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_454347
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_454347(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_454347
-    ret
-  }
+kernel void compute_main(texture1d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_454347(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_454347
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/4638a0.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/4638a0.wgsl.expected.ir.msl
index 167dfda..5fb8200 100644
--- a/test/tint/builtins/gen/literal/textureLoad/4638a0.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/4638a0.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<int, access::read> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba16sint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_4638a0(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(uint2(int2(1)), 1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_4638a0 = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<rgba16sint, read> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, vec2<i32>(1i), 1u
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_4638a0(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_4638a0
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_4638a0(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_4638a0
-    ret
-  }
+kernel void compute_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_4638a0(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_4638a0
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/469912.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/469912.wgsl.expected.ir.msl
index d257383..b834ed4 100644
--- a/test/tint/builtins/gen/literal/textureLoad/469912.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/469912.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<int, access::read_write> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<rg32sint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_469912(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(uint(1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_469912 = func():void {
-  $B2: {
-    %4:texture_storage_1d<rg32sint, read_write> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, 1i
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_469912(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_469912
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_469912(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_469912
-    ret
-  }
+kernel void compute_main(texture1d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_469912(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_469912
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/46a93f.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/46a93f.wgsl.expected.ir.msl
index 9cbc5cd..6566eb2 100644
--- a/test/tint/builtins/gen/literal/textureLoad/46a93f.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/46a93f.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::sample> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_2d_array<f32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_46a93f(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint2(1u), 1, 1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_46a93f = func():void {
-  $B2: {
-    %4:texture_2d_array<f32> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec2<u32>(1u), 1i, 1u
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_46a93f(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_46a93f
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_46a93f(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_46a93f
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_46a93f(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_46a93f
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/46dbf5.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/46dbf5.wgsl.expected.ir.msl
index 264ed48..8a65fca 100644
--- a/test/tint/builtins/gen/literal/textureLoad/46dbf5.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/46dbf5.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<rgba8unorm, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_46dbf5(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint3(1u));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_46dbf5 = func():void {
-  $B2: {
-    %4:texture_storage_3d<rgba8unorm, read> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec3<u32>(1u)
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_46dbf5(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_46dbf5
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_46dbf5(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_46dbf5
-    ret
-  }
+kernel void compute_main(texture3d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_46dbf5(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_46dbf5
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/473d3e.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/473d3e.wgsl.expected.ir.msl
index a719930..8b5e81e 100644
--- a/test/tint/builtins/gen/literal/textureLoad/473d3e.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/473d3e.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<rgba32float, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_473d3e(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint3(1u));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_473d3e = func():void {
-  $B2: {
-    %4:texture_storage_3d<rgba32float, read_write> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec3<u32>(1u)
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_473d3e(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_473d3e
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_473d3e(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_473d3e
-    ret
-  }
+kernel void compute_main(texture3d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_473d3e(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_473d3e
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/47e818.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/47e818.wgsl.expected.ir.msl
index 7228c4b..7cf4ac1 100644
--- a/test/tint/builtins/gen/literal/textureLoad/47e818.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/47e818.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<int, access::sample> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_3d<i32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_47e818(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(uint3(1u), 1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_47e818 = func():void {
-  $B2: {
-    %4:texture_3d<i32> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, vec3<u32>(1u), 1u
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_47e818(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_47e818
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_47e818(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_47e818
-    ret
-  }
+kernel void compute_main(texture3d<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_47e818(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_47e818
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/482627.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/482627.wgsl.expected.ir.msl
index 87b0bc3..4986982 100644
--- a/test/tint/builtins/gen/literal/textureLoad/482627.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/482627.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rg32float, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_482627(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint2(1u), 1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_482627 = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<rg32float, read_write> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec2<u32>(1u), 1u
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_482627(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_482627
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_482627(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_482627
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_482627(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_482627
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/484344.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/484344.wgsl.expected.ir.msl
index df4aedd..c94e7e2 100644
--- a/test/tint/builtins/gen/literal/textureLoad/484344.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/484344.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<float, access::sample> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_2d<f32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_484344(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint2(int2(1)), 1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_484344 = func():void {
-  $B2: {
-    %4:texture_2d<f32> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec2<i32>(1i), 1i
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_484344(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_484344
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_484344(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_484344
-    ret
-  }
+kernel void compute_main(texture2d<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_484344(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_484344
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/4951bb.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/4951bb.wgsl.expected.ir.msl
index 34d23a1..d865652 100644
--- a/test/tint/builtins/gen/literal/textureLoad/4951bb.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/4951bb.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<r8unorm, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_4951bb(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint2(1u), 1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_4951bb = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<r8unorm, read> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec2<u32>(1u), 1i
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_4951bb(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_4951bb
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_4951bb(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_4951bb
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_4951bb(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_4951bb
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/49f76f.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/49f76f.wgsl.expected.ir.msl
index c22805d..a57a0f1 100644
--- a/test/tint/builtins/gen/literal/textureLoad/49f76f.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/49f76f.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_ms<uint, access::read> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_multisampled_2d<u32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_49f76f(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(uint2(1u), 1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_49f76f = func():void {
-  $B2: {
-    %4:texture_multisampled_2d<u32> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, vec2<u32>(1u), 1u
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_49f76f(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_49f76f
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_ms<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_49f76f(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_49f76f
-    ret
-  }
+kernel void compute_main(texture2d_ms<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_49f76f(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_49f76f
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_ms<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/4a5c55.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/4a5c55.wgsl.expected.ir.msl
index 78f317f..3734437 100644
--- a/test/tint/builtins/gen/literal/textureLoad/4a5c55.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/4a5c55.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<int, access::read_write> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<rgba8sint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_4a5c55(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(uint3(1u));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_4a5c55 = func():void {
-  $B2: {
-    %4:texture_storage_3d<rgba8sint, read_write> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, vec3<u32>(1u)
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_4a5c55(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_4a5c55
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_4a5c55(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_4a5c55
-    ret
-  }
+kernel void compute_main(texture3d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_4a5c55(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_4a5c55
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/4acb64.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/4acb64.wgsl.expected.ir.msl
index 55b2f42..6fc43ce 100644
--- a/test/tint/builtins/gen/literal/textureLoad/4acb64.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/4acb64.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::sample> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_2d_array<f32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_4acb64(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint2(int2(1)), 1u, 1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_4acb64 = func():void {
-  $B2: {
-    %4:texture_2d_array<f32> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec2<i32>(1i), 1u, 1i
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_4acb64(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_4acb64
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_4acb64(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_4acb64
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_4acb64(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_4acb64
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/4c15b2.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/4c15b2.wgsl.expected.ir.msl
index affca29..9fdd77b 100644
--- a/test/tint/builtins/gen/literal/textureLoad/4c15b2.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/4c15b2.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba32float, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_4c15b2(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint2(int2(1)), 1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_4c15b2 = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<rgba32float, read_write> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec2<i32>(1i), 1i
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_4c15b2(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_4c15b2
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_4c15b2(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_4c15b2
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_4c15b2(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_4c15b2
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/4c1a1e.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/4c1a1e.wgsl.expected.ir.msl
index 04f2f00..7b77642 100644
--- a/test/tint/builtins/gen/literal/textureLoad/4c1a1e.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/4c1a1e.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<uint, access::read_write> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<rg32uint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_4c1a1e(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(uint3(int3(1)));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_4c1a1e = func():void {
-  $B2: {
-    %4:texture_storage_3d<rg32uint, read_write> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, vec3<i32>(1i)
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_4c1a1e(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_4c1a1e
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_4c1a1e(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_4c1a1e
-    ret
-  }
+kernel void compute_main(texture3d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_4c1a1e(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_4c1a1e
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/4c423f.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/4c423f.wgsl.expected.ir.msl
index 828593d..a362f27 100644
--- a/test/tint/builtins/gen/literal/textureLoad/4c423f.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/4c423f.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<int, access::sample> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_1d<i32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_4c423f(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_4c423f = func():void {
-  $B2: {
-    %4:texture_1d<i32> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, 1u, 1i
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_4c423f(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_4c423f
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_4c423f(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_4c423f
-    ret
-  }
+kernel void compute_main(texture1d<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_4c423f(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_4c423f
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/4c67be.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/4c67be.wgsl.expected.ir.msl
index 405a5b3..09a390b 100644
--- a/test/tint/builtins/gen/literal/textureLoad/4c67be.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/4c67be.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<r32float, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_4c67be(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint2(1u));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_4c67be = func():void {
-  $B2: {
-    %4:texture_storage_2d<r32float, read> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec2<u32>(1u)
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_4c67be(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_4c67be
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_4c67be(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_4c67be
-    ret
-  }
+kernel void compute_main(texture2d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_4c67be(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_4c67be
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/4ccf9a.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/4ccf9a.wgsl.expected.ir.msl
index 7e0d8b3..c47cff1 100644
--- a/test/tint/builtins/gen/literal/textureLoad/4ccf9a.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/4ccf9a.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<uint, access::read_write> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<rg32uint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_4ccf9a(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(uint3(1u));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_4ccf9a = func():void {
-  $B2: {
-    %4:texture_storage_3d<rg32uint, read_write> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, vec3<u32>(1u)
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_4ccf9a(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_4ccf9a
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_4ccf9a(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_4ccf9a
-    ret
-  }
+kernel void compute_main(texture3d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_4ccf9a(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_4ccf9a
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/4cdca5.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/4cdca5.wgsl.expected.ir.msl
index 9d564ae..f32227b 100644
--- a/test/tint/builtins/gen/literal/textureLoad/4cdca5.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/4cdca5.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<int, access::read> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba8sint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_4cdca5(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(uint2(int2(1)), 1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_4cdca5 = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<rgba8sint, read> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, vec2<i32>(1i), 1u
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_4cdca5(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_4cdca5
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_4cdca5(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_4cdca5
-    ret
-  }
+kernel void compute_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_4cdca5(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_4cdca5
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/4db25c.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/4db25c.wgsl.expected.ir.msl
index 483bc80..a3eea35 100644
--- a/test/tint/builtins/gen/literal/textureLoad/4db25c.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/4db25c.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  depth2d_ms<float, access::read> arg_0;
+  device float* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_depth_multisampled_2d, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, f32, read_write> = var @binding_point(2, 0)
+void textureLoad_4db25c(tint_module_vars_struct tint_module_vars) {
+  float res = tint_module_vars.arg_0.read(uint2(1u), 1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_4db25c = func():void {
-  $B2: {
-    %4:texture_depth_multisampled_2d = load %arg_0
-    %5:f32 = textureLoad %4, vec2<u32>(1u), 1u
-    %res:ptr<function, f32, read_write> = var, %5
-    %7:f32 = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_4db25c(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_4db25c
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(depth2d_ms<float, access::read> arg_0 [[texture(0)]], device float* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_4db25c(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_4db25c
-    ret
-  }
+kernel void compute_main(depth2d_ms<float, access::read> arg_0 [[texture(0)]], device float* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_4db25c(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_4db25c
-    ret
-  }
+vertex vertex_main_outputs vertex_main(depth2d_ms<float, access::read> arg_0 [[texture(0)]], device float* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/4e2c5c.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/4e2c5c.wgsl.expected.ir.msl
index 2da6a58..ecaf279 100644
--- a/test/tint/builtins/gen/literal/textureLoad/4e2c5c.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/4e2c5c.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba16float, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_4e2c5c(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint2(int2(1)), 1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_4e2c5c = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<rgba16float, read_write> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec2<i32>(1i), 1u
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_4e2c5c(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_4e2c5c
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_4e2c5c(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_4e2c5c
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_4e2c5c(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_4e2c5c
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/4f5496.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/4f5496.wgsl.expected.ir.msl
index 68f8866..83fa97b 100644
--- a/test/tint/builtins/gen/literal/textureLoad/4f5496.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/4f5496.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<uint, access::read_write> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<r32uint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_4f5496(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(uint2(int2(1)), 1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_4f5496 = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<r32uint, read_write> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, vec2<i32>(1i), 1i
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_4f5496(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_4f5496
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_4f5496(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_4f5496
-    ret
-  }
+kernel void compute_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_4f5496(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_4f5496
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/4f90bb.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/4f90bb.wgsl.expected.ir.msl
index edede64..acd8051 100644
--- a/test/tint/builtins/gen/literal/textureLoad/4f90bb.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/4f90bb.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<bgra8unorm, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_4f90bb(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint2(int2(1)));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_4f90bb = func():void {
-  $B2: {
-    %4:texture_storage_2d<bgra8unorm, read_write> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec2<i32>(1i)
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_4f90bb(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_4f90bb
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_4f90bb(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_4f90bb
-    ret
-  }
+kernel void compute_main(texture2d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_4f90bb(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_4f90bb
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/4fa6ae.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/4fa6ae.wgsl.expected.ir.msl
index 35779be..3bb374d 100644
--- a/test/tint/builtins/gen/literal/textureLoad/4fa6ae.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/4fa6ae.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<bgra8unorm, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_4fa6ae(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint3(1u));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_4fa6ae = func():void {
-  $B2: {
-    %4:texture_storage_3d<bgra8unorm, read> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec3<u32>(1u)
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_4fa6ae(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_4fa6ae
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_4fa6ae(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_4fa6ae
-    ret
-  }
+kernel void compute_main(texture3d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_4fa6ae(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_4fa6ae
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/4fd803.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/4fd803.wgsl.expected.ir.msl
index f25271d..b0c42ac 100644
--- a/test/tint/builtins/gen/literal/textureLoad/4fd803.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/4fd803.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<int, access::sample> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_3d<i32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_4fd803(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(uint3(int3(1)), 1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_4fd803 = func():void {
-  $B2: {
-    %4:texture_3d<i32> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, vec3<i32>(1i), 1i
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_4fd803(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_4fd803
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_4fd803(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_4fd803
-    ret
-  }
+kernel void compute_main(texture3d<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_4fd803(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_4fd803
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/505aa2.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/505aa2.wgsl.expected.ir.msl
index 6342e69..9789d22 100644
--- a/test/tint/builtins/gen/literal/textureLoad/505aa2.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/505aa2.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<int, access::read> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<r32sint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_505aa2(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(uint3(int3(1)));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_505aa2 = func():void {
-  $B2: {
-    %4:texture_storage_3d<r32sint, read> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, vec3<i32>(1i)
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_505aa2(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_505aa2
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_505aa2(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_505aa2
-    ret
-  }
+kernel void compute_main(texture3d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_505aa2(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_505aa2
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/50915c.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/50915c.wgsl.expected.ir.msl
index 5540f51..cf28535 100644
--- a/test/tint/builtins/gen/literal/textureLoad/50915c.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/50915c.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<uint, access::read> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<rgba8uint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_50915c(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(uint3(1u));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_50915c = func():void {
-  $B2: {
-    %4:texture_storage_3d<rgba8uint, read> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, vec3<u32>(1u)
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_50915c(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_50915c
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_50915c(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_50915c
-    ret
-  }
+kernel void compute_main(texture3d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_50915c(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_50915c
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/5154e1.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/5154e1.wgsl.expected.ir.msl
index 5878178..4984ae3 100644
--- a/test/tint/builtins/gen/literal/textureLoad/5154e1.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/5154e1.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<rgba32float, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_5154e1(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint2(int2(1)));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_5154e1 = func():void {
-  $B2: {
-    %4:texture_storage_2d<rgba32float, read_write> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec2<i32>(1i)
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_5154e1(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_5154e1
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_5154e1(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_5154e1
-    ret
-  }
+kernel void compute_main(texture2d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_5154e1(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_5154e1
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/519ab5.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/519ab5.wgsl.expected.ir.msl
index 380c0dc..200b806 100644
--- a/test/tint/builtins/gen/literal/textureLoad/519ab5.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/519ab5.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<rgba8unorm, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_519ab5(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint(1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_519ab5 = func():void {
-  $B2: {
-    %4:texture_storage_1d<rgba8unorm, read> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, 1i
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_519ab5(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_519ab5
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_519ab5(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_519ab5
-    ret
-  }
+kernel void compute_main(texture1d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_519ab5(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_519ab5
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/53378a.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/53378a.wgsl.expected.ir.msl
index 6d87cb6..613637d 100644
--- a/test/tint/builtins/gen/literal/textureLoad/53378a.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/53378a.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<int, access::read> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<rg32sint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_53378a(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(uint2(int2(1)));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_53378a = func():void {
-  $B2: {
-    %4:texture_storage_2d<rg32sint, read> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, vec2<i32>(1i)
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_53378a(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_53378a
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_53378a(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_53378a
-    ret
-  }
+kernel void compute_main(texture2d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_53378a(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_53378a
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/53941c.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/53941c.wgsl.expected.ir.msl
index b621f87..22bd3a4 100644
--- a/test/tint/builtins/gen/literal/textureLoad/53941c.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/53941c.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<int, access::read_write> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba32sint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_53941c(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(uint2(1u), 1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_53941c = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<rgba32sint, read_write> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, vec2<u32>(1u), 1u
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_53941c(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_53941c
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_53941c(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_53941c
-    ret
-  }
+kernel void compute_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_53941c(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_53941c
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/53e142.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/53e142.wgsl.expected.ir.msl
index 3895c337..4e4a1ba 100644
--- a/test/tint/builtins/gen/literal/textureLoad/53e142.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/53e142.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<uint, access::sample> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_2d_array<u32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_53e142(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(uint2(1u), 1, 1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_53e142 = func():void {
-  $B2: {
-    %4:texture_2d_array<u32> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, vec2<u32>(1u), 1i, 1i
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_53e142(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_53e142
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_53e142(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_53e142
-    ret
-  }
+kernel void compute_main(texture2d_array<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_53e142(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_53e142
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/54a59b.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/54a59b.wgsl.expected.ir.msl
index beb958a..e76a7e6 100644
--- a/test/tint/builtins/gen/literal/textureLoad/54a59b.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/54a59b.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::sample> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_2d_array<f32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_54a59b(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint2(1u), 1, 1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_54a59b = func():void {
-  $B2: {
-    %4:texture_2d_array<f32> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec2<u32>(1u), 1i, 1i
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_54a59b(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_54a59b
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_54a59b(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_54a59b
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_54a59b(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_54a59b
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/54e0ce.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/54e0ce.wgsl.expected.ir.msl
index c1c2618..30984d3 100644
--- a/test/tint/builtins/gen/literal/textureLoad/54e0ce.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/54e0ce.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<bgra8unorm, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_54e0ce(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint2(1u));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_54e0ce = func():void {
-  $B2: {
-    %4:texture_storage_2d<bgra8unorm, read> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec2<u32>(1u)
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_54e0ce(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_54e0ce
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_54e0ce(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_54e0ce
-    ret
-  }
+kernel void compute_main(texture2d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_54e0ce(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_54e0ce
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/54fb38.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/54fb38.wgsl.expected.ir.msl
index c5edd80..41d510e 100644
--- a/test/tint/builtins/gen/literal/textureLoad/54fb38.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/54fb38.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<uint, access::read_write> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rg32uint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_54fb38(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(uint2(1u), 1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_54fb38 = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<rg32uint, read_write> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, vec2<u32>(1u), 1u
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_54fb38(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_54fb38
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_54fb38(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_54fb38
-    ret
-  }
+kernel void compute_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_54fb38(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_54fb38
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/55e745.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/55e745.wgsl.expected.ir.msl
index 2030c91..ff01d2e 100644
--- a/test/tint/builtins/gen/literal/textureLoad/55e745.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/55e745.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<int, access::read> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<r32sint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_55e745(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(uint2(1u), 1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_55e745 = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<r32sint, read> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, vec2<u32>(1u), 1i
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_55e745(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_55e745
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_55e745(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_55e745
-    ret
-  }
+kernel void compute_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_55e745(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_55e745
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/560573.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/560573.wgsl.expected.ir.msl
index e9b19e0..c92ccfd 100644
--- a/test/tint/builtins/gen/literal/textureLoad/560573.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/560573.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<int, access::read> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<r32sint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_560573(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(uint2(int2(1)), 1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_560573 = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<r32sint, read> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, vec2<i32>(1i), 1i
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_560573(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_560573
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_560573(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_560573
-    ret
-  }
+kernel void compute_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_560573(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_560573
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/56a000.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/56a000.wgsl.expected.ir.msl
index deb7dc4..6c32da2 100644
--- a/test/tint/builtins/gen/literal/textureLoad/56a000.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/56a000.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<rg32float, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_56a000(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint(1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_56a000 = func():void {
-  $B2: {
-    %4:texture_storage_1d<rg32float, read_write> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, 1i
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_56a000(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_56a000
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_56a000(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_56a000
-    ret
-  }
+kernel void compute_main(texture1d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_56a000(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_56a000
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/582015.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/582015.wgsl.expected.ir.msl
index 332c9bc..30bab04 100644
--- a/test/tint/builtins/gen/literal/textureLoad/582015.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/582015.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<int, access::read> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba8sint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_582015(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(uint2(int2(1)), 1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_582015 = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<rgba8sint, read> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, vec2<i32>(1i), 1i
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_582015(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_582015
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_582015(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_582015
-    ret
-  }
+kernel void compute_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_582015(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_582015
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/589eaa.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/589eaa.wgsl.expected.ir.msl
index 5a51603..bf60bb7 100644
--- a/test/tint/builtins/gen/literal/textureLoad/589eaa.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/589eaa.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<rgba16float, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_589eaa(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint3(1u));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_589eaa = func():void {
-  $B2: {
-    %4:texture_storage_3d<rgba16float, read> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec3<u32>(1u)
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_589eaa(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_589eaa
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_589eaa(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_589eaa
-    ret
-  }
+kernel void compute_main(texture3d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_589eaa(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_589eaa
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/5a2f9d.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/5a2f9d.wgsl.expected.ir.msl
index d8265ea..193cdef 100644
--- a/test/tint/builtins/gen/literal/textureLoad/5a2f9d.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/5a2f9d.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<int, access::sample> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_1d<i32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_5a2f9d(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(uint(1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_5a2f9d = func():void {
-  $B2: {
-    %4:texture_1d<i32> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, 1i, 1i
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_5a2f9d(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_5a2f9d
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_5a2f9d(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_5a2f9d
-    ret
-  }
+kernel void compute_main(texture1d<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_5a2f9d(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_5a2f9d
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/5abbf2.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/5abbf2.wgsl.expected.ir.msl
index eb42d17..09433fd 100644
--- a/test/tint/builtins/gen/literal/textureLoad/5abbf2.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/5abbf2.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<rg32float, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_5abbf2(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_5abbf2 = func():void {
-  $B2: {
-    %4:texture_storage_1d<rg32float, read> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, 1u
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_5abbf2(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_5abbf2
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_5abbf2(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_5abbf2
-    ret
-  }
+kernel void compute_main(texture1d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_5abbf2(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_5abbf2
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/5b0f5b.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/5b0f5b.wgsl.expected.ir.msl
index 40c3fcf..5e6052e 100644
--- a/test/tint/builtins/gen/literal/textureLoad/5b0f5b.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/5b0f5b.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<uint, access::read_write> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<rgba16uint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_5b0f5b(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(uint3(int3(1)));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_5b0f5b = func():void {
-  $B2: {
-    %4:texture_storage_3d<rgba16uint, read_write> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, vec3<i32>(1i)
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_5b0f5b(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_5b0f5b
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_5b0f5b(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_5b0f5b
-    ret
-  }
+kernel void compute_main(texture3d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_5b0f5b(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_5b0f5b
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/5b4947.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/5b4947.wgsl.expected.ir.msl
index 660229d..6b44477 100644
--- a/test/tint/builtins/gen/literal/textureLoad/5b4947.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/5b4947.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<bgra8unorm, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_5b4947(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint3(int3(1)));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_5b4947 = func():void {
-  $B2: {
-    %4:texture_storage_3d<bgra8unorm, read_write> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec3<i32>(1i)
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_5b4947(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_5b4947
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_5b4947(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_5b4947
-    ret
-  }
+kernel void compute_main(texture3d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_5b4947(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_5b4947
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/5bb7fb.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/5bb7fb.wgsl.expected.ir.msl
index ad4b629..10a05b0 100644
--- a/test/tint/builtins/gen/literal/textureLoad/5bb7fb.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/5bb7fb.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<uint, access::read> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<rg32uint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_5bb7fb(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(uint(1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_5bb7fb = func():void {
-  $B2: {
-    %4:texture_storage_1d<rg32uint, read> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, 1i
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_5bb7fb(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_5bb7fb
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_5bb7fb(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_5bb7fb
-    ret
-  }
+kernel void compute_main(texture1d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_5bb7fb(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_5bb7fb
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/5c69f8.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/5c69f8.wgsl.expected.ir.msl
index f3b127a..0a0f6c8 100644
--- a/test/tint/builtins/gen/literal/textureLoad/5c69f8.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/5c69f8.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<bgra8unorm, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_5c69f8(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint3(1u));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_5c69f8 = func():void {
-  $B2: {
-    %4:texture_storage_3d<bgra8unorm, read_write> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec3<u32>(1u)
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_5c69f8(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_5c69f8
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_5c69f8(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_5c69f8
-    ret
-  }
+kernel void compute_main(texture3d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_5c69f8(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_5c69f8
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/5cd3fc.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/5cd3fc.wgsl.expected.ir.msl
index f99e355..316ba04 100644
--- a/test/tint/builtins/gen/literal/textureLoad/5cd3fc.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/5cd3fc.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<int, access::read_write> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<r32sint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_5cd3fc(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(uint2(int2(1)));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_5cd3fc = func():void {
-  $B2: {
-    %4:texture_storage_2d<r32sint, read_write> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, vec2<i32>(1i)
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_5cd3fc(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_5cd3fc
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_5cd3fc(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_5cd3fc
-    ret
-  }
+kernel void compute_main(texture2d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_5cd3fc(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_5cd3fc
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/5cee3b.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/5cee3b.wgsl.expected.ir.msl
index 0b34c99..8ffbc63 100644
--- a/test/tint/builtins/gen/literal/textureLoad/5cee3b.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/5cee3b.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<uint, access::read> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<r32uint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_5cee3b(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(uint3(1u));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_5cee3b = func():void {
-  $B2: {
-    %4:texture_storage_3d<r32uint, read> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, vec3<u32>(1u)
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_5cee3b(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_5cee3b
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_5cee3b(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_5cee3b
-    ret
-  }
+kernel void compute_main(texture3d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_5cee3b(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_5cee3b
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/5d0a2f.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/5d0a2f.wgsl.expected.ir.msl
index 12dfe1a..7509213 100644
--- a/test/tint/builtins/gen/literal/textureLoad/5d0a2f.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/5d0a2f.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<uint, access::read> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<r32uint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_5d0a2f(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(uint2(int2(1)), 1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_5d0a2f = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<r32uint, read> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, vec2<i32>(1i), 1i
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_5d0a2f(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_5d0a2f
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_5d0a2f(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_5d0a2f
-    ret
-  }
+kernel void compute_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_5d0a2f(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_5d0a2f
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/5d4042.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/5d4042.wgsl.expected.ir.msl
index 802bf66..0154d65 100644
--- a/test/tint/builtins/gen/literal/textureLoad/5d4042.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/5d4042.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba32float, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_5d4042(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint2(1u), 1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_5d4042 = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<rgba32float, read> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec2<u32>(1u), 1i
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_5d4042(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_5d4042
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_5d4042(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_5d4042
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_5d4042(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_5d4042
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/5dd4c7.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/5dd4c7.wgsl.expected.ir.msl
index 7beae48..92400d3 100644
--- a/test/tint/builtins/gen/literal/textureLoad/5dd4c7.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/5dd4c7.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<r8unorm, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_5dd4c7(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint2(int2(1)));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_5dd4c7 = func():void {
-  $B2: {
-    %4:texture_storage_2d<r8unorm, read> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec2<i32>(1i)
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_5dd4c7(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_5dd4c7
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_5dd4c7(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_5dd4c7
-    ret
-  }
+kernel void compute_main(texture2d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_5dd4c7(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_5dd4c7
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/5e17a7.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/5e17a7.wgsl.expected.ir.msl
index 07196d6..9fa49b5 100644
--- a/test/tint/builtins/gen/literal/textureLoad/5e17a7.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/5e17a7.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<int, access::read_write> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<rgba8sint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_5e17a7(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(uint(1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_5e17a7 = func():void {
-  $B2: {
-    %4:texture_storage_1d<rgba8sint, read_write> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, 1i
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_5e17a7(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_5e17a7
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_5e17a7(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_5e17a7
-    ret
-  }
+kernel void compute_main(texture1d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_5e17a7(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_5e17a7
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/5e1843.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/5e1843.wgsl.expected.ir.msl
index a7cb53e..60139b6 100644
--- a/test/tint/builtins/gen/literal/textureLoad/5e1843.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/5e1843.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<uint, access::read_write> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba16uint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_5e1843(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(uint2(1u), 1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_5e1843 = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<rgba16uint, read_write> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, vec2<u32>(1u), 1u
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_5e1843(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_5e1843
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_5e1843(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_5e1843
-    ret
-  }
+kernel void compute_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_5e1843(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_5e1843
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/5e8d3f.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/5e8d3f.wgsl.expected.ir.msl
index 26dd53e..419d7ce 100644
--- a/test/tint/builtins/gen/literal/textureLoad/5e8d3f.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/5e8d3f.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<int, access::read> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<r32sint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_5e8d3f(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(uint3(1u));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_5e8d3f = func():void {
-  $B2: {
-    %4:texture_storage_3d<r32sint, read> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, vec3<u32>(1u)
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_5e8d3f(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_5e8d3f
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_5e8d3f(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_5e8d3f
-    ret
-  }
+kernel void compute_main(texture3d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_5e8d3f(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_5e8d3f
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/5ed6ad.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/5ed6ad.wgsl.expected.ir.msl
index c7837c2..16a0584 100644
--- a/test/tint/builtins/gen/literal/textureLoad/5ed6ad.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/5ed6ad.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<r8unorm, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_5ed6ad(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint2(1u), 1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_5ed6ad = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<r8unorm, read> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec2<u32>(1u), 1u
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_5ed6ad(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_5ed6ad
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_5ed6ad(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_5ed6ad
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_5ed6ad(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_5ed6ad
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/5f4473.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/5f4473.wgsl.expected.ir.msl
index a60d3d6..2aae674 100644
--- a/test/tint/builtins/gen/literal/textureLoad/5f4473.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/5f4473.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<uint, access::read> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<rgba32uint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_5f4473(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(uint3(1u));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_5f4473 = func():void {
-  $B2: {
-    %4:texture_storage_3d<rgba32uint, read> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, vec3<u32>(1u)
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_5f4473(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_5f4473
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_5f4473(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_5f4473
-    ret
-  }
+kernel void compute_main(texture3d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_5f4473(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_5f4473
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/5feb4d.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/5feb4d.wgsl.expected.ir.msl
index 3c073dcc..e12f478 100644
--- a/test/tint/builtins/gen/literal/textureLoad/5feb4d.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/5feb4d.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<r32float, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_5feb4d(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_5feb4d = func():void {
-  $B2: {
-    %4:texture_storage_1d<r32float, read> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, 1u
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_5feb4d(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_5feb4d
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_5feb4d(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_5feb4d
-    ret
-  }
+kernel void compute_main(texture1d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_5feb4d(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_5feb4d
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/6154d4.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/6154d4.wgsl.expected.ir.msl
index aad49a3..e616203 100644
--- a/test/tint/builtins/gen/literal/textureLoad/6154d4.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/6154d4.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<uint, access::sample> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_2d<u32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_6154d4(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(uint2(int2(1)), 1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_6154d4 = func():void {
-  $B2: {
-    %4:texture_2d<u32> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, vec2<i32>(1i), 1i
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_6154d4(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_6154d4
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_6154d4(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_6154d4
-    ret
-  }
+kernel void compute_main(texture2d<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_6154d4(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_6154d4
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/61e2e8.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/61e2e8.wgsl.expected.ir.msl
index e537c69..81b4279 100644
--- a/test/tint/builtins/gen/literal/textureLoad/61e2e8.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/61e2e8.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<int, access::read_write> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<rg32sint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_61e2e8(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(uint3(1u));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_61e2e8 = func():void {
-  $B2: {
-    %4:texture_storage_3d<rg32sint, read_write> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, vec3<u32>(1u)
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_61e2e8(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_61e2e8
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_61e2e8(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_61e2e8
-    ret
-  }
+kernel void compute_main(texture3d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_61e2e8(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_61e2e8
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/620caa.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/620caa.wgsl.expected.ir.msl
index 4066e62..2a298e6 100644
--- a/test/tint/builtins/gen/literal/textureLoad/620caa.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/620caa.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<int, access::read> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<rg32sint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_620caa(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(uint2(1u));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_620caa = func():void {
-  $B2: {
-    %4:texture_storage_2d<rg32sint, read> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, vec2<u32>(1u)
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_620caa(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_620caa
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_620caa(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_620caa
-    ret
-  }
+kernel void compute_main(texture2d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_620caa(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_620caa
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/622278.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/622278.wgsl.expected.ir.msl
index 63b010e..0dfd90d 100644
--- a/test/tint/builtins/gen/literal/textureLoad/622278.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/622278.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<uint, access::read_write> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<rgba32uint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_622278(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(uint3(int3(1)));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_622278 = func():void {
-  $B2: {
-    %4:texture_storage_3d<rgba32uint, read_write> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, vec3<i32>(1i)
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_622278(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_622278
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_622278(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_622278
-    ret
-  }
+kernel void compute_main(texture3d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_622278(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_622278
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/6273b1.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/6273b1.wgsl.expected.ir.msl
index 1b025a5..08e6b1b 100644
--- a/test/tint/builtins/gen/literal/textureLoad/6273b1.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/6273b1.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  depth2d_ms<float, access::read> arg_0;
+  device float* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_depth_multisampled_2d, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, f32, read_write> = var @binding_point(2, 0)
+void textureLoad_6273b1(tint_module_vars_struct tint_module_vars) {
+  float res = tint_module_vars.arg_0.read(uint2(int2(1)), 1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_6273b1 = func():void {
-  $B2: {
-    %4:texture_depth_multisampled_2d = load %arg_0
-    %5:f32 = textureLoad %4, vec2<i32>(1i), 1i
-    %res:ptr<function, f32, read_write> = var, %5
-    %7:f32 = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_6273b1(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_6273b1
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(depth2d_ms<float, access::read> arg_0 [[texture(0)]], device float* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_6273b1(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_6273b1
-    ret
-  }
+kernel void compute_main(depth2d_ms<float, access::read> arg_0 [[texture(0)]], device float* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_6273b1(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_6273b1
-    ret
-  }
+vertex vertex_main_outputs vertex_main(depth2d_ms<float, access::read> arg_0 [[texture(0)]], device float* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/62d125.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/62d125.wgsl.expected.ir.msl
index 329824a..c1c9707 100644
--- a/test/tint/builtins/gen/literal/textureLoad/62d125.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/62d125.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<rgba8snorm, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_62d125(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint3(int3(1)));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_62d125 = func():void {
-  $B2: {
-    %4:texture_storage_3d<rgba8snorm, read> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec3<i32>(1i)
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_62d125(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_62d125
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_62d125(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_62d125
-    ret
-  }
+kernel void compute_main(texture3d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_62d125(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_62d125
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/62d1de.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/62d1de.wgsl.expected.ir.msl
index 1361258..7cbb7a1 100644
--- a/test/tint/builtins/gen/literal/textureLoad/62d1de.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/62d1de.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<int, access::sample> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_1d<i32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_62d1de(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(uint(1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_62d1de = func():void {
-  $B2: {
-    %4:texture_1d<i32> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, 1i, 1u
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_62d1de(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_62d1de
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_62d1de(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_62d1de
-    ret
-  }
+kernel void compute_main(texture1d<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_62d1de(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_62d1de
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/639962.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/639962.wgsl.expected.ir.msl
index b8f31f4..1cb87b7 100644
--- a/test/tint/builtins/gen/literal/textureLoad/639962.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/639962.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_ms<int, access::read> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_multisampled_2d<i32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_639962(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(uint2(1u), 1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_639962 = func():void {
-  $B2: {
-    %4:texture_multisampled_2d<i32> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, vec2<u32>(1u), 1u
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_639962(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_639962
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_ms<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_639962(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_639962
-    ret
-  }
+kernel void compute_main(texture2d_ms<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_639962(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_639962
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_ms<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/63be18.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/63be18.wgsl.expected.ir.msl
index 1a84876..6bb0eeb 100644
--- a/test/tint/builtins/gen/literal/textureLoad/63be18.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/63be18.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<int, access::read> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rg32sint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_63be18(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(uint2(1u), 1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_63be18 = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<rg32sint, read> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, vec2<u32>(1u), 1u
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_63be18(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_63be18
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_63be18(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_63be18
-    ret
-  }
+kernel void compute_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_63be18(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_63be18
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/64c372.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/64c372.wgsl.expected.ir.msl
index 5fcc2b13..603215d 100644
--- a/test/tint/builtins/gen/literal/textureLoad/64c372.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/64c372.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<uint, access::read_write> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba16uint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_64c372(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(uint2(int2(1)), 1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_64c372 = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<rgba16uint, read_write> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, vec2<i32>(1i), 1i
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_64c372(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_64c372
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_64c372(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_64c372
-    ret
-  }
+kernel void compute_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_64c372(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_64c372
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/656d76.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/656d76.wgsl.expected.ir.msl
index d48aa3f..d31757a 100644
--- a/test/tint/builtins/gen/literal/textureLoad/656d76.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/656d76.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<uint, access::sample> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_2d_array<u32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_656d76(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(uint2(int2(1)), 1, 1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_656d76 = func():void {
-  $B2: {
-    %4:texture_2d_array<u32> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, vec2<i32>(1i), 1i, 1u
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_656d76(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_656d76
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_656d76(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_656d76
-    ret
-  }
+kernel void compute_main(texture2d_array<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_656d76(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_656d76
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/65a4d0.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/65a4d0.wgsl.expected.ir.msl
index 3870e28..721c119 100644
--- a/test/tint/builtins/gen/literal/textureLoad/65a4d0.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/65a4d0.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba8unorm, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_65a4d0(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint2(1u), 1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_65a4d0 = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<rgba8unorm, read> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec2<u32>(1u), 1i
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_65a4d0(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_65a4d0
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_65a4d0(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_65a4d0
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_65a4d0(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_65a4d0
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/666010.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/666010.wgsl.expected.ir.msl
index 9b1ca6c..597a36a 100644
--- a/test/tint/builtins/gen/literal/textureLoad/666010.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/666010.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<rgba8unorm, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_666010(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_666010 = func():void {
-  $B2: {
-    %4:texture_storage_1d<rgba8unorm, read_write> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, 1u
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_666010(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_666010
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_666010(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_666010
-    ret
-  }
+kernel void compute_main(texture1d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_666010(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_666010
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/6678b6.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/6678b6.wgsl.expected.ir.msl
index 97f1ec6..7314323 100644
--- a/test/tint/builtins/gen/literal/textureLoad/6678b6.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/6678b6.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<int, access::read> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<rgba16sint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_6678b6(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(uint(1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_6678b6 = func():void {
-  $B2: {
-    %4:texture_storage_1d<rgba16sint, read> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, 1i
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_6678b6(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_6678b6
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_6678b6(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_6678b6
-    ret
-  }
+kernel void compute_main(texture1d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_6678b6(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_6678b6
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/66be47.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/66be47.wgsl.expected.ir.msl
index ebca3b3..f490a5a 100644
--- a/test/tint/builtins/gen/literal/textureLoad/66be47.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/66be47.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  depth2d_array<float, access::sample> arg_0;
+  device float* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_depth_2d_array, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, f32, read_write> = var @binding_point(2, 0)
+void textureLoad_66be47(tint_module_vars_struct tint_module_vars) {
+  float res = tint_module_vars.arg_0.read(uint2(int2(1)), 1u, 1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_66be47 = func():void {
-  $B2: {
-    %4:texture_depth_2d_array = load %arg_0
-    %5:f32 = textureLoad %4, vec2<i32>(1i), 1u, 1u
-    %res:ptr<function, f32, read_write> = var, %5
-    %7:f32 = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_66be47(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_66be47
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(depth2d_array<float, access::sample> arg_0 [[texture(0)]], device float* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_66be47(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_66be47
-    ret
-  }
+kernel void compute_main(depth2d_array<float, access::sample> arg_0 [[texture(0)]], device float* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_66be47(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_66be47
-    ret
-  }
+vertex vertex_main_outputs vertex_main(depth2d_array<float, access::sample> arg_0 [[texture(0)]], device float* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/67d826.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/67d826.wgsl.expected.ir.msl
index 7510956..8d98b83 100644
--- a/test/tint/builtins/gen/literal/textureLoad/67d826.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/67d826.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<r32float, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_67d826(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint2(int2(1)), 1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_67d826 = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<r32float, read_write> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec2<i32>(1i), 1u
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_67d826(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_67d826
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_67d826(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_67d826
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_67d826(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_67d826
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/67edca.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/67edca.wgsl.expected.ir.msl
index 3c31810..b930875 100644
--- a/test/tint/builtins/gen/literal/textureLoad/67edca.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/67edca.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<uint, access::read> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<rgba32uint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_67edca(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(uint3(int3(1)));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_67edca = func():void {
-  $B2: {
-    %4:texture_storage_3d<rgba32uint, read> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, vec3<i32>(1i)
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_67edca(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_67edca
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_67edca(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_67edca
-    ret
-  }
+kernel void compute_main(texture3d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_67edca(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_67edca
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/68d273.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/68d273.wgsl.expected.ir.msl
index f780015..d88cb41 100644
--- a/test/tint/builtins/gen/literal/textureLoad/68d273.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/68d273.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<int, access::read_write> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<rgba16sint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_68d273(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(uint3(1u));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_68d273 = func():void {
-  $B2: {
-    %4:texture_storage_3d<rgba16sint, read_write> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, vec3<u32>(1u)
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_68d273(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_68d273
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_68d273(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_68d273
-    ret
-  }
+kernel void compute_main(texture3d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_68d273(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_68d273
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/6925bc.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/6925bc.wgsl.expected.ir.msl
index 88e55e4..238c9fa 100644
--- a/test/tint/builtins/gen/literal/textureLoad/6925bc.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/6925bc.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  depth2d_ms<float, access::read> arg_0;
+  device float* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_depth_multisampled_2d, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, f32, read_write> = var @binding_point(2, 0)
+void textureLoad_6925bc(tint_module_vars_struct tint_module_vars) {
+  float res = tint_module_vars.arg_0.read(uint2(int2(1)), 1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_6925bc = func():void {
-  $B2: {
-    %4:texture_depth_multisampled_2d = load %arg_0
-    %5:f32 = textureLoad %4, vec2<i32>(1i), 1u
-    %res:ptr<function, f32, read_write> = var, %5
-    %7:f32 = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_6925bc(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_6925bc
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(depth2d_ms<float, access::read> arg_0 [[texture(0)]], device float* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_6925bc(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_6925bc
-    ret
-  }
+kernel void compute_main(depth2d_ms<float, access::read> arg_0 [[texture(0)]], device float* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_6925bc(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_6925bc
-    ret
-  }
+vertex vertex_main_outputs vertex_main(depth2d_ms<float, access::read> arg_0 [[texture(0)]], device float* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/69fee5.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/69fee5.wgsl.expected.ir.msl
index b534d2f..e317dd4 100644
--- a/test/tint/builtins/gen/literal/textureLoad/69fee5.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/69fee5.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<r32float, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_69fee5(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint2(1u), 1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_69fee5 = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<r32float, read_write> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec2<u32>(1u), 1i
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_69fee5(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_69fee5
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_69fee5(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_69fee5
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_69fee5(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_69fee5
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/6a6871.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/6a6871.wgsl.expected.ir.msl
index c279818..3f9a9b9 100644
--- a/test/tint/builtins/gen/literal/textureLoad/6a6871.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/6a6871.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<rgba32float, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_6a6871(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint3(int3(1)));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_6a6871 = func():void {
-  $B2: {
-    %4:texture_storage_3d<rgba32float, read_write> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec3<i32>(1i)
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_6a6871(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_6a6871
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_6a6871(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_6a6871
-    ret
-  }
+kernel void compute_main(texture3d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_6a6871(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_6a6871
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/6b77d4.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/6b77d4.wgsl.expected.ir.msl
index 0e781b7..ce57e7e 100644
--- a/test/tint/builtins/gen/literal/textureLoad/6b77d4.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/6b77d4.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<uint, access::sample> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_1d<u32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_6b77d4(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(uint(1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_6b77d4 = func():void {
-  $B2: {
-    %4:texture_1d<u32> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, 1i, 1u
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_6b77d4(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_6b77d4
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_6b77d4(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_6b77d4
-    ret
-  }
+kernel void compute_main(texture1d<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_6b77d4(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_6b77d4
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/6b8ba6.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/6b8ba6.wgsl.expected.ir.msl
index 9c44ee2..a3b0be0 100644
--- a/test/tint/builtins/gen/literal/textureLoad/6b8ba6.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/6b8ba6.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba16float, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_6b8ba6(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint2(1u), 1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_6b8ba6 = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<rgba16float, read_write> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec2<u32>(1u), 1u
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_6b8ba6(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_6b8ba6
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_6b8ba6(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_6b8ba6
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_6b8ba6(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_6b8ba6
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/6ba9ab.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/6ba9ab.wgsl.expected.ir.msl
index 523b21b..e2600c6 100644
--- a/test/tint/builtins/gen/literal/textureLoad/6ba9ab.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/6ba9ab.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba8unorm, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_6ba9ab(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint2(1u), 1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_6ba9ab = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<rgba8unorm, read_write> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec2<u32>(1u), 1u
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_6ba9ab(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_6ba9ab
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_6ba9ab(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_6ba9ab
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_6ba9ab(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_6ba9ab
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/6bf3e2.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/6bf3e2.wgsl.expected.ir.msl
index 2824e8a..27fd704 100644
--- a/test/tint/builtins/gen/literal/textureLoad/6bf3e2.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/6bf3e2.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<bgra8unorm, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_6bf3e2(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint2(int2(1)), 1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_6bf3e2 = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<bgra8unorm, read_write> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec2<i32>(1i), 1u
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_6bf3e2(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_6bf3e2
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_6bf3e2(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_6bf3e2
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_6bf3e2(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_6bf3e2
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/6bf4b7.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/6bf4b7.wgsl.expected.ir.msl
index 8faaca7..33d2c36 100644
--- a/test/tint/builtins/gen/literal/textureLoad/6bf4b7.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/6bf4b7.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<uint, access::sample> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_3d<u32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_6bf4b7(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(uint3(int3(1)), 1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_6bf4b7 = func():void {
-  $B2: {
-    %4:texture_3d<u32> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, vec3<i32>(1i), 1u
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_6bf4b7(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_6bf4b7
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_6bf4b7(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_6bf4b7
-    ret
-  }
+kernel void compute_main(texture3d<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_6bf4b7(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_6bf4b7
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/6d1fb4.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/6d1fb4.wgsl.expected.ir.msl
index f61bed4..3f3cfe1 100644
--- a/test/tint/builtins/gen/literal/textureLoad/6d1fb4.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/6d1fb4.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<uint, access::read_write> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<r32uint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_6d1fb4(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(uint2(1u), 1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_6d1fb4 = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<r32uint, read_write> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, vec2<u32>(1u), 1u
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_6d1fb4(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_6d1fb4
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_6d1fb4(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_6d1fb4
-    ret
-  }
+kernel void compute_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_6d1fb4(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_6d1fb4
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/6d376a.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/6d376a.wgsl.expected.ir.msl
index aac0511..37b924a 100644
--- a/test/tint/builtins/gen/literal/textureLoad/6d376a.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/6d376a.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<float, access::sample> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_1d<f32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_6d376a(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_6d376a = func():void {
-  $B2: {
-    %4:texture_1d<f32> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, 1u, 1u
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_6d376a(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_6d376a
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_6d376a(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_6d376a
-    ret
-  }
+kernel void compute_main(texture1d<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_6d376a(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_6d376a
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/6d7bb5.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/6d7bb5.wgsl.expected.ir.msl
index a608662..5e9083a 100644
--- a/test/tint/builtins/gen/literal/textureLoad/6d7bb5.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/6d7bb5.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba8unorm, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_6d7bb5(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint2(1u), 1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_6d7bb5 = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<rgba8unorm, read_write> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec2<u32>(1u), 1i
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_6d7bb5(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_6d7bb5
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_6d7bb5(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_6d7bb5
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_6d7bb5(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_6d7bb5
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/6e903f.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/6e903f.wgsl.expected.ir.msl
index 21c12b7..df997f0 100644
--- a/test/tint/builtins/gen/literal/textureLoad/6e903f.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/6e903f.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<int, access::read_write> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<rgba8sint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_6e903f(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(uint3(int3(1)));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_6e903f = func():void {
-  $B2: {
-    %4:texture_storage_3d<rgba8sint, read_write> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, vec3<i32>(1i)
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_6e903f(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_6e903f
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_6e903f(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_6e903f
-    ret
-  }
+kernel void compute_main(texture3d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_6e903f(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_6e903f
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/6f0370.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/6f0370.wgsl.expected.ir.msl
index cf44be0..7a89b0e 100644
--- a/test/tint/builtins/gen/literal/textureLoad/6f0370.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/6f0370.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<r8unorm, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_6f0370(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint3(1u));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_6f0370 = func():void {
-  $B2: {
-    %4:texture_storage_3d<r8unorm, read> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec3<u32>(1u)
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_6f0370(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_6f0370
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_6f0370(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_6f0370
-    ret
-  }
+kernel void compute_main(texture3d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_6f0370(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_6f0370
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/6f0ea8.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/6f0ea8.wgsl.expected.ir.msl
index 8e534af..852eae9 100644
--- a/test/tint/builtins/gen/literal/textureLoad/6f0ea8.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/6f0ea8.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<rgba16float, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_6f0ea8(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint3(int3(1)));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_6f0ea8 = func():void {
-  $B2: {
-    %4:texture_storage_3d<rgba16float, read_write> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec3<i32>(1i)
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_6f0ea8(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_6f0ea8
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_6f0ea8(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_6f0ea8
-    ret
-  }
+kernel void compute_main(texture3d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_6f0ea8(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_6f0ea8
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/6f1750.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/6f1750.wgsl.expected.ir.msl
index 220391c..5b0d6cd 100644
--- a/test/tint/builtins/gen/literal/textureLoad/6f1750.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/6f1750.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<r32float, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_6f1750(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint2(1u), 1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_6f1750 = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<r32float, read> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec2<u32>(1u), 1u
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_6f1750(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_6f1750
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_6f1750(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_6f1750
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_6f1750(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_6f1750
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/6f8927.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/6f8927.wgsl.expected.ir.msl
index 55c08e8..1d76187 100644
--- a/test/tint/builtins/gen/literal/textureLoad/6f8927.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/6f8927.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba32float, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_6f8927(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint2(int2(1)), 1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_6f8927 = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<rgba32float, read_write> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec2<i32>(1i), 1u
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_6f8927(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_6f8927
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_6f8927(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_6f8927
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_6f8927(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_6f8927
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/714471.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/714471.wgsl.expected.ir.msl
index bc6ca20..1d7c431 100644
--- a/test/tint/builtins/gen/literal/textureLoad/714471.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/714471.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<int, access::sample> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_2d<i32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_714471(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(uint2(1u), 1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_714471 = func():void {
-  $B2: {
-    %4:texture_2d<i32> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, vec2<u32>(1u), 1u
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_714471(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_714471
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_714471(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_714471
-    ret
-  }
+kernel void compute_main(texture2d<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_714471(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_714471
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/72bb3c.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/72bb3c.wgsl.expected.ir.msl
index a6a770f..adc1073 100644
--- a/test/tint/builtins/gen/literal/textureLoad/72bb3c.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/72bb3c.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba8snorm, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_72bb3c(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint2(1u), 1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_72bb3c = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<rgba8snorm, read> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec2<u32>(1u), 1i
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_72bb3c(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_72bb3c
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_72bb3c(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_72bb3c
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_72bb3c(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_72bb3c
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/72c9c3.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/72c9c3.wgsl.expected.ir.msl
index 50edd72..686c337 100644
--- a/test/tint/builtins/gen/literal/textureLoad/72c9c3.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/72c9c3.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<r8unorm, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_72c9c3(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint2(int2(1)), 1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_72c9c3 = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<r8unorm, read_write> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec2<i32>(1i), 1u
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_72c9c3(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_72c9c3
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_72c9c3(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_72c9c3
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_72c9c3(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_72c9c3
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/742f1b.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/742f1b.wgsl.expected.ir.msl
index 3c3360b..02f490a 100644
--- a/test/tint/builtins/gen/literal/textureLoad/742f1b.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/742f1b.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<rgba16float, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_742f1b(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint3(1u));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_742f1b = func():void {
-  $B2: {
-    %4:texture_storage_3d<rgba16float, read_write> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec3<u32>(1u)
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_742f1b(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_742f1b
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_742f1b(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_742f1b
-    ret
-  }
+kernel void compute_main(texture3d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_742f1b(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_742f1b
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/749704.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/749704.wgsl.expected.ir.msl
index fd9e305..280a007 100644
--- a/test/tint/builtins/gen/literal/textureLoad/749704.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/749704.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<uint, access::read> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<r32uint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_749704(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(uint2(int2(1)));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_749704 = func():void {
-  $B2: {
-    %4:texture_storage_2d<r32uint, read> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, vec2<i32>(1i)
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_749704(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_749704
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_749704(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_749704
-    ret
-  }
+kernel void compute_main(texture2d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_749704(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_749704
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/74a387.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/74a387.wgsl.expected.ir.msl
index 38ab8bf..93db362 100644
--- a/test/tint/builtins/gen/literal/textureLoad/74a387.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/74a387.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<int, access::read_write> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<rgba8sint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_74a387(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_74a387 = func():void {
-  $B2: {
-    %4:texture_storage_1d<rgba8sint, read_write> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, 1u
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_74a387(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_74a387
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_74a387(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_74a387
-    ret
-  }
+kernel void compute_main(texture1d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_74a387(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_74a387
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/773c46.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/773c46.wgsl.expected.ir.msl
index 9d839ec..e2d6b7f 100644
--- a/test/tint/builtins/gen/literal/textureLoad/773c46.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/773c46.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<uint, access::read> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<rg32uint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_773c46(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(uint2(1u));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_773c46 = func():void {
-  $B2: {
-    %4:texture_storage_2d<rg32uint, read> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, vec2<u32>(1u)
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_773c46(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_773c46
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_773c46(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_773c46
-    ret
-  }
+kernel void compute_main(texture2d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_773c46(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_773c46
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/789045.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/789045.wgsl.expected.ir.msl
index 0ee1502..22432a9 100644
--- a/test/tint/builtins/gen/literal/textureLoad/789045.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/789045.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::sample> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_2d_array<f32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_789045(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint2(int2(1)), 1, 1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_789045 = func():void {
-  $B2: {
-    %4:texture_2d_array<f32> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec2<i32>(1i), 1i, 1u
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_789045(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_789045
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_789045(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_789045
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_789045(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_789045
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/79e697.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/79e697.wgsl.expected.ir.msl
index b79d9be..b1b7252 100644
--- a/test/tint/builtins/gen/literal/textureLoad/79e697.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/79e697.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<int, access::sample> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_2d_array<i32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_79e697(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(uint2(int2(1)), 1, 1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_79e697 = func():void {
-  $B2: {
-    %4:texture_2d_array<i32> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, vec2<i32>(1i), 1i, 1i
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_79e697(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_79e697
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_79e697(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_79e697
-    ret
-  }
+kernel void compute_main(texture2d_array<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_79e697(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_79e697
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/7ab4df.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/7ab4df.wgsl.expected.ir.msl
index f8937af..54391a1 100644
--- a/test/tint/builtins/gen/literal/textureLoad/7ab4df.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/7ab4df.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<uint, access::sample> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_2d_array<u32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_7ab4df(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(uint2(int2(1)), 1u, 1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_7ab4df = func():void {
-  $B2: {
-    %4:texture_2d_array<u32> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, vec2<i32>(1i), 1u, 1i
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_7ab4df(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_7ab4df
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_7ab4df(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_7ab4df
-    ret
-  }
+kernel void compute_main(texture2d_array<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_7ab4df(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_7ab4df
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/7b63e0.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/7b63e0.wgsl.expected.ir.msl
index 24d1510..8634c7a 100644
--- a/test/tint/builtins/gen/literal/textureLoad/7b63e0.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/7b63e0.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  depth2d_array<float, access::sample> arg_0;
+  device float* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_depth_2d_array, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, f32, read_write> = var @binding_point(2, 0)
+void textureLoad_7b63e0(tint_module_vars_struct tint_module_vars) {
+  float res = tint_module_vars.arg_0.read(uint2(1u), 1u, 1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_7b63e0 = func():void {
-  $B2: {
-    %4:texture_depth_2d_array = load %arg_0
-    %5:f32 = textureLoad %4, vec2<u32>(1u), 1u, 1u
-    %res:ptr<function, f32, read_write> = var, %5
-    %7:f32 = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_7b63e0(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_7b63e0
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(depth2d_array<float, access::sample> arg_0 [[texture(0)]], device float* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_7b63e0(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_7b63e0
-    ret
-  }
+kernel void compute_main(depth2d_array<float, access::sample> arg_0 [[texture(0)]], device float* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_7b63e0(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_7b63e0
-    ret
-  }
+vertex vertex_main_outputs vertex_main(depth2d_array<float, access::sample> arg_0 [[texture(0)]], device float* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/7bee94.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/7bee94.wgsl.expected.ir.msl
index ce5659f..01c1dc6 100644
--- a/test/tint/builtins/gen/literal/textureLoad/7bee94.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/7bee94.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_ms<int, access::read> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_multisampled_2d<i32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_7bee94(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(uint2(1u), 1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_7bee94 = func():void {
-  $B2: {
-    %4:texture_multisampled_2d<i32> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, vec2<u32>(1u), 1i
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_7bee94(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_7bee94
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_ms<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_7bee94(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_7bee94
-    ret
-  }
+kernel void compute_main(texture2d_ms<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_7bee94(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_7bee94
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_ms<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/7c90e5.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/7c90e5.wgsl.expected.ir.msl
index 593dcd7..caef1c5 100644
--- a/test/tint/builtins/gen/literal/textureLoad/7c90e5.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/7c90e5.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<uint, access::sample> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_2d_array<u32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_7c90e5(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(uint2(int2(1)), 1, 1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_7c90e5 = func():void {
-  $B2: {
-    %4:texture_2d_array<u32> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, vec2<i32>(1i), 1i, 1i
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_7c90e5(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_7c90e5
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_7c90e5(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_7c90e5
-    ret
-  }
+kernel void compute_main(texture2d_array<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_7c90e5(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_7c90e5
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/7dab57.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/7dab57.wgsl.expected.ir.msl
index c5f9219..8d8a948 100644
--- a/test/tint/builtins/gen/literal/textureLoad/7dab57.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/7dab57.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<int, access::read> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rg32sint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_7dab57(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(uint2(1u), 1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_7dab57 = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<rg32sint, read> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, vec2<u32>(1u), 1i
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_7dab57(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_7dab57
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_7dab57(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_7dab57
-    ret
-  }
+kernel void compute_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_7dab57(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_7dab57
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/7dd3d5.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/7dd3d5.wgsl.expected.ir.msl
index 5c5568f..6c0e2d3 100644
--- a/test/tint/builtins/gen/literal/textureLoad/7dd3d5.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/7dd3d5.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<r8unorm, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_7dd3d5(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint2(int2(1)), 1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_7dd3d5 = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<r8unorm, read_write> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec2<i32>(1i), 1i
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_7dd3d5(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_7dd3d5
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_7dd3d5(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_7dd3d5
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_7dd3d5(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_7dd3d5
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/7e5cbc.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/7e5cbc.wgsl.expected.ir.msl
index 541d482..f110aa4 100644
--- a/test/tint/builtins/gen/literal/textureLoad/7e5cbc.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/7e5cbc.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<bgra8unorm, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_7e5cbc(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_7e5cbc = func():void {
-  $B2: {
-    %4:texture_storage_1d<bgra8unorm, read_write> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, 1u
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_7e5cbc(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_7e5cbc
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_7e5cbc(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_7e5cbc
-    ret
-  }
+kernel void compute_main(texture1d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_7e5cbc(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_7e5cbc
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/7fd822.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/7fd822.wgsl.expected.ir.msl
index 876fe08..8e3ace3 100644
--- a/test/tint/builtins/gen/literal/textureLoad/7fd822.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/7fd822.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  depth2d<float, access::sample> arg_0;
+  device float* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_depth_2d, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, f32, read_write> = var @binding_point(2, 0)
+void textureLoad_7fd822(tint_module_vars_struct tint_module_vars) {
+  float res = tint_module_vars.arg_0.read(uint2(1u), 1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_7fd822 = func():void {
-  $B2: {
-    %4:texture_depth_2d = load %arg_0
-    %5:f32 = textureLoad %4, vec2<u32>(1u), 1i
-    %res:ptr<function, f32, read_write> = var, %5
-    %7:f32 = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_7fd822(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_7fd822
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(depth2d<float, access::sample> arg_0 [[texture(0)]], device float* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_7fd822(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_7fd822
-    ret
-  }
+kernel void compute_main(depth2d<float, access::sample> arg_0 [[texture(0)]], device float* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_7fd822(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_7fd822
-    ret
-  }
+vertex vertex_main_outputs vertex_main(depth2d<float, access::sample> arg_0 [[texture(0)]], device float* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/80dae1.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/80dae1.wgsl.expected.ir.msl
index 67877ff..69d6b7d 100644
--- a/test/tint/builtins/gen/literal/textureLoad/80dae1.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/80dae1.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<int, access::read_write> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<rgba16sint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_80dae1(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_80dae1 = func():void {
-  $B2: {
-    %4:texture_storage_1d<rgba16sint, read_write> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, 1u
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_80dae1(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_80dae1
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_80dae1(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_80dae1
-    ret
-  }
+kernel void compute_main(texture1d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_80dae1(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_80dae1
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/81c381.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/81c381.wgsl.expected.ir.msl
index a87e262..72260d1 100644
--- a/test/tint/builtins/gen/literal/textureLoad/81c381.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/81c381.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<float, access::sample> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_1d<f32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_81c381(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint(1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_81c381 = func():void {
-  $B2: {
-    %4:texture_1d<f32> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, 1i, 1i
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_81c381(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_81c381
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_81c381(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_81c381
-    ret
-  }
+kernel void compute_main(texture1d<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_81c381(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_81c381
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/83162f.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/83162f.wgsl.expected.ir.msl
index e127d71..2cf0eb4 100644
--- a/test/tint/builtins/gen/literal/textureLoad/83162f.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/83162f.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<rg32float, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_83162f(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint3(1u));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_83162f = func():void {
-  $B2: {
-    %4:texture_storage_3d<rg32float, read> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec3<u32>(1u)
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_83162f(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_83162f
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_83162f(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_83162f
-    ret
-  }
+kernel void compute_main(texture3d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_83162f(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_83162f
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/83cea4.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/83cea4.wgsl.expected.ir.msl
index 36201f9..ff099fe 100644
--- a/test/tint/builtins/gen/literal/textureLoad/83cea4.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/83cea4.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<uint, access::read> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<rgba16uint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_83cea4(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(uint(1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_83cea4 = func():void {
-  $B2: {
-    %4:texture_storage_1d<rgba16uint, read> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, 1i
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_83cea4(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_83cea4
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_83cea4(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_83cea4
-    ret
-  }
+kernel void compute_main(texture1d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_83cea4(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_83cea4
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/83d6e3.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/83d6e3.wgsl.expected.ir.msl
index 8b7e0e7..744f565 100644
--- a/test/tint/builtins/gen/literal/textureLoad/83d6e3.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/83d6e3.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<uint, access::read_write> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<r32uint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_83d6e3(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(uint(1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_83d6e3 = func():void {
-  $B2: {
-    %4:texture_storage_1d<r32uint, read_write> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, 1i
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_83d6e3(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_83d6e3
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_83d6e3(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_83d6e3
-    ret
-  }
+kernel void compute_main(texture1d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_83d6e3(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_83d6e3
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/848d85.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/848d85.wgsl.expected.ir.msl
index 086dc08..ae3af3a 100644
--- a/test/tint/builtins/gen/literal/textureLoad/848d85.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/848d85.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<rgba16float, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_848d85(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint2(1u));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_848d85 = func():void {
-  $B2: {
-    %4:texture_storage_2d<rgba16float, read_write> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec2<u32>(1u)
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_848d85(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_848d85
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_848d85(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_848d85
-    ret
-  }
+kernel void compute_main(texture2d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_848d85(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_848d85
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/84a438.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/84a438.wgsl.expected.ir.msl
index 93fe4ee..d9cdd2f 100644
--- a/test/tint/builtins/gen/literal/textureLoad/84a438.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/84a438.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<uint, access::read_write> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<rgba8uint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_84a438(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(uint2(int2(1)));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_84a438 = func():void {
-  $B2: {
-    %4:texture_storage_2d<rgba8uint, read_write> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, vec2<i32>(1i)
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_84a438(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_84a438
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_84a438(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_84a438
-    ret
-  }
+kernel void compute_main(texture2d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_84a438(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_84a438
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/84c728.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/84c728.wgsl.expected.ir.msl
index 8d30b75..fd9c14e 100644
--- a/test/tint/builtins/gen/literal/textureLoad/84c728.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/84c728.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<rgba32float, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_84c728(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_84c728 = func():void {
-  $B2: {
-    %4:texture_storage_1d<rgba32float, read> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, 1u
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_84c728(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_84c728
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_84c728(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_84c728
-    ret
-  }
+kernel void compute_main(texture1d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_84c728(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_84c728
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/84dee1.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/84dee1.wgsl.expected.ir.msl
index 86adac7..3175ce9 100644
--- a/test/tint/builtins/gen/literal/textureLoad/84dee1.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/84dee1.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<float, access::sample> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_2d<f32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_84dee1(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint2(1u), 1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_84dee1 = func():void {
-  $B2: {
-    %4:texture_2d<f32> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec2<u32>(1u), 1u
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_84dee1(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_84dee1
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_84dee1(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_84dee1
-    ret
-  }
+kernel void compute_main(texture2d<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_84dee1(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_84dee1
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/8527b1.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/8527b1.wgsl.expected.ir.msl
index d130d1d..834dbcb 100644
--- a/test/tint/builtins/gen/literal/textureLoad/8527b1.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/8527b1.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<uint, access::sample> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_2d_array<u32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_8527b1(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(uint2(1u), 1u, 1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_8527b1 = func():void {
-  $B2: {
-    %4:texture_2d_array<u32> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, vec2<u32>(1u), 1u, 1u
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_8527b1(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_8527b1
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_8527b1(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_8527b1
-    ret
-  }
+kernel void compute_main(texture2d_array<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_8527b1(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_8527b1
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/862833.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/862833.wgsl.expected.ir.msl
index d6b1eaa..3588057 100644
--- a/test/tint/builtins/gen/literal/textureLoad/862833.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/862833.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba32float, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_862833(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint2(int2(1)), 1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_862833 = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<rgba32float, read> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec2<i32>(1i), 1u
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_862833(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_862833
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_862833(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_862833
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_862833(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_862833
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/878e24.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/878e24.wgsl.expected.ir.msl
index a158444..bc6672b 100644
--- a/test/tint/builtins/gen/literal/textureLoad/878e24.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/878e24.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba32float, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_878e24(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint2(1u), 1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_878e24 = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<rgba32float, read_write> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec2<u32>(1u), 1u
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_878e24(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_878e24
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_878e24(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_878e24
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_878e24(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_878e24
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/87be85.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/87be85.wgsl.expected.ir.msl
index a798143..ca8c7a4 100644
--- a/test/tint/builtins/gen/literal/textureLoad/87be85.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/87be85.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::sample> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_2d_array<f32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_87be85(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint2(int2(1)), 1, 1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_87be85 = func():void {
-  $B2: {
-    %4:texture_2d_array<f32> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec2<i32>(1i), 1i, 1i
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_87be85(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_87be85
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_87be85(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_87be85
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_87be85(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_87be85
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/87f0a6.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/87f0a6.wgsl.expected.ir.msl
index 5316b0c..d5fc2d5 100644
--- a/test/tint/builtins/gen/literal/textureLoad/87f0a6.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/87f0a6.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<uint, access::read_write> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba8uint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_87f0a6(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(uint2(int2(1)), 1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_87f0a6 = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<rgba8uint, read_write> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, vec2<i32>(1i), 1i
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_87f0a6(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_87f0a6
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_87f0a6(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_87f0a6
-    ret
-  }
+kernel void compute_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_87f0a6(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_87f0a6
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/881349.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/881349.wgsl.expected.ir.msl
index 6cd5b21..f92e8d8 100644
--- a/test/tint/builtins/gen/literal/textureLoad/881349.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/881349.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rg32float, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_881349(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint2(int2(1)), 1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_881349 = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<rg32float, read_write> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec2<i32>(1i), 1i
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_881349(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_881349
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_881349(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_881349
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_881349(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_881349
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/89620b.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/89620b.wgsl.expected.ir.msl
index b1d0924..1eb6402 100644
--- a/test/tint/builtins/gen/literal/textureLoad/89620b.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/89620b.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<bgra8unorm, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_89620b(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint2(int2(1)), 1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_89620b = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<bgra8unorm, read> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec2<i32>(1i), 1i
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_89620b(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_89620b
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_89620b(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_89620b
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_89620b(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_89620b
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/897cf3.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/897cf3.wgsl.expected.ir.msl
index ec0358a..9e9f3d6 100644
--- a/test/tint/builtins/gen/literal/textureLoad/897cf3.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/897cf3.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<uint, access::sample> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_2d<u32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_897cf3(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(uint2(1u), 1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_897cf3 = func():void {
-  $B2: {
-    %4:texture_2d<u32> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, vec2<u32>(1u), 1u
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_897cf3(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_897cf3
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_897cf3(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_897cf3
-    ret
-  }
+kernel void compute_main(texture2d<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_897cf3(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_897cf3
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/8a291b.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/8a291b.wgsl.expected.ir.msl
index f38e79a..7b41da1 100644
--- a/test/tint/builtins/gen/literal/textureLoad/8a291b.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/8a291b.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<bgra8unorm, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_8a291b(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint2(int2(1)), 1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_8a291b = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<bgra8unorm, read> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec2<i32>(1i), 1u
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_8a291b(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_8a291b
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_8a291b(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_8a291b
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_8a291b(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_8a291b
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/8a9988.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/8a9988.wgsl.expected.ir.msl
index f9d5e8d..ea40eee 100644
--- a/test/tint/builtins/gen/literal/textureLoad/8a9988.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/8a9988.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<int, access::read> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<rg32sint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_8a9988(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(uint3(1u));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_8a9988 = func():void {
-  $B2: {
-    %4:texture_storage_3d<rg32sint, read> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, vec3<u32>(1u)
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_8a9988(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_8a9988
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_8a9988(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_8a9988
-    ret
-  }
+kernel void compute_main(texture3d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_8a9988(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_8a9988
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/8acf41.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/8acf41.wgsl.expected.ir.msl
index 56a26d3..a48e115 100644
--- a/test/tint/builtins/gen/literal/textureLoad/8acf41.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/8acf41.wgsl.expected.ir.msl
@@ -1,29 +1,9 @@
 SKIP: FAILED
 
-
-@group(1) @binding(0) var arg_0 : texture_external;
-
-fn textureLoad_8acf41() {
-  var res : vec4<f32> = textureLoad(arg_0, vec2<i32>(1i));
-  prevent_dce = res;
-}
-
-@group(2) @binding(0) var<storage, read_write> prevent_dce : vec4<f32>;
-
-@vertex
-fn vertex_main() -> @builtin(position) vec4<f32> {
-  textureLoad_8acf41();
-  return vec4<f32>();
-}
-
-@fragment
-fn fragment_main() {
-  textureLoad_8acf41();
-}
-
-@compute @workgroup_size(1)
-fn compute_main() {
-  textureLoad_8acf41();
-}
-
-Failed to generate: error: ExternalTextureOptions missing binding entry for [group: 1, binding: 0]
+../../src/tint/lang/msl/writer/printer/printer.cc:1006 internal compiler error: TINT_UNREACHABLE unhandled: abs
+********************************************************************
+*  The tint shader compiler has encountered an unexpected error.   *
+*                                                                  *
+*  Please help us fix this issue by submitting a bug report at     *
+*  crbug.com/tint with the source program that triggered the bug.  *
+********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/8b62fb.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/8b62fb.wgsl.expected.ir.msl
index 339de64..aad790f 100644
--- a/test/tint/builtins/gen/literal/textureLoad/8b62fb.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/8b62fb.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<bgra8unorm, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_8b62fb(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint2(1u));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_8b62fb = func():void {
-  $B2: {
-    %4:texture_storage_2d<bgra8unorm, read_write> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec2<u32>(1u)
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_8b62fb(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_8b62fb
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_8b62fb(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_8b62fb
-    ret
-  }
+kernel void compute_main(texture2d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_8b62fb(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_8b62fb
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/8bf8c2.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/8bf8c2.wgsl.expected.ir.msl
index 24acecf..c55f022 100644
--- a/test/tint/builtins/gen/literal/textureLoad/8bf8c2.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/8bf8c2.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<r32float, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_8bf8c2(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_8bf8c2 = func():void {
-  $B2: {
-    %4:texture_storage_1d<r32float, read_write> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, 1u
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_8bf8c2(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_8bf8c2
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_8bf8c2(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_8bf8c2
-    ret
-  }
+kernel void compute_main(texture1d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_8bf8c2(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_8bf8c2
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/8c6176.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/8c6176.wgsl.expected.ir.msl
index f807ae2c..068700d 100644
--- a/test/tint/builtins/gen/literal/textureLoad/8c6176.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/8c6176.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<uint, access::read_write> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<rg32uint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_8c6176(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(uint2(1u));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_8c6176 = func():void {
-  $B2: {
-    %4:texture_storage_2d<rg32uint, read_write> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, vec2<u32>(1u)
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_8c6176(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_8c6176
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_8c6176(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_8c6176
-    ret
-  }
+kernel void compute_main(texture2d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_8c6176(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_8c6176
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/8ccbe3.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/8ccbe3.wgsl.expected.ir.msl
index dacc21b..1a7d672 100644
--- a/test/tint/builtins/gen/literal/textureLoad/8ccbe3.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/8ccbe3.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  depth2d<float, access::sample> arg_0;
+  device float* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_depth_2d, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, f32, read_write> = var @binding_point(2, 0)
+void textureLoad_8ccbe3(tint_module_vars_struct tint_module_vars) {
+  float res = tint_module_vars.arg_0.read(uint2(int2(1)), 1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_8ccbe3 = func():void {
-  $B2: {
-    %4:texture_depth_2d = load %arg_0
-    %5:f32 = textureLoad %4, vec2<i32>(1i), 1u
-    %res:ptr<function, f32, read_write> = var, %5
-    %7:f32 = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_8ccbe3(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_8ccbe3
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(depth2d<float, access::sample> arg_0 [[texture(0)]], device float* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_8ccbe3(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_8ccbe3
-    ret
-  }
+kernel void compute_main(depth2d<float, access::sample> arg_0 [[texture(0)]], device float* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_8ccbe3(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_8ccbe3
-    ret
-  }
+vertex vertex_main_outputs vertex_main(depth2d<float, access::sample> arg_0 [[texture(0)]], device float* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/8d64c3.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/8d64c3.wgsl.expected.ir.msl
index 36150fa..145c23b 100644
--- a/test/tint/builtins/gen/literal/textureLoad/8d64c3.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/8d64c3.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<uint, access::read_write> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<rg32uint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_8d64c3(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(uint2(int2(1)));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_8d64c3 = func():void {
-  $B2: {
-    %4:texture_storage_2d<rg32uint, read_write> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, vec2<i32>(1i)
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_8d64c3(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_8d64c3
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_8d64c3(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_8d64c3
-    ret
-  }
+kernel void compute_main(texture2d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_8d64c3(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_8d64c3
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/8db0ce.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/8db0ce.wgsl.expected.ir.msl
index d0f057b..9c84dfd 100644
--- a/test/tint/builtins/gen/literal/textureLoad/8db0ce.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/8db0ce.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<int, access::read> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<r32sint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_8db0ce(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(uint2(1u), 1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_8db0ce = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<r32sint, read> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, vec2<u32>(1u), 1u
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_8db0ce(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_8db0ce
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_8db0ce(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_8db0ce
-    ret
-  }
+kernel void compute_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_8db0ce(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_8db0ce
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/8e5032.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/8e5032.wgsl.expected.ir.msl
index 7efd290..5a587d9 100644
--- a/test/tint/builtins/gen/literal/textureLoad/8e5032.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/8e5032.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<uint, access::read> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rg32uint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_8e5032(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(uint2(int2(1)), 1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_8e5032 = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<rg32uint, read> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, vec2<i32>(1i), 1i
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_8e5032(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_8e5032
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_8e5032(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_8e5032
-    ret
-  }
+kernel void compute_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_8e5032(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_8e5032
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/8e68c9.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/8e68c9.wgsl.expected.ir.msl
index e217833..8576064 100644
--- a/test/tint/builtins/gen/literal/textureLoad/8e68c9.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/8e68c9.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<int, access::read_write> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<rgba32sint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_8e68c9(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(uint3(1u));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_8e68c9 = func():void {
-  $B2: {
-    %4:texture_storage_3d<rgba32sint, read_write> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, vec3<u32>(1u)
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_8e68c9(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_8e68c9
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_8e68c9(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_8e68c9
-    ret
-  }
+kernel void compute_main(texture3d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_8e68c9(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_8e68c9
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/8fc29b.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/8fc29b.wgsl.expected.ir.msl
index 93197bb..71c47b2 100644
--- a/test/tint/builtins/gen/literal/textureLoad/8fc29b.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/8fc29b.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<rgba8unorm, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_8fc29b(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint(1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_8fc29b = func():void {
-  $B2: {
-    %4:texture_storage_1d<rgba8unorm, read_write> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, 1i
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_8fc29b(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_8fc29b
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_8fc29b(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_8fc29b
-    ret
-  }
+kernel void compute_main(texture1d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_8fc29b(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_8fc29b
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/8ff033.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/8ff033.wgsl.expected.ir.msl
index c3131d7..38b71f0 100644
--- a/test/tint/builtins/gen/literal/textureLoad/8ff033.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/8ff033.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<rgba8snorm, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_8ff033(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint2(1u));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_8ff033 = func():void {
-  $B2: {
-    %4:texture_storage_2d<rgba8snorm, read> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec2<u32>(1u)
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_8ff033(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_8ff033
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_8ff033(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_8ff033
-    ret
-  }
+kernel void compute_main(texture2d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_8ff033(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_8ff033
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/91ede5.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/91ede5.wgsl.expected.ir.msl
index 8da8dfa..8fb4a39 100644
--- a/test/tint/builtins/gen/literal/textureLoad/91ede5.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/91ede5.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<rg32float, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_91ede5(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint3(1u));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_91ede5 = func():void {
-  $B2: {
-    %4:texture_storage_3d<rg32float, read_write> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec3<u32>(1u)
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_91ede5(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_91ede5
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_91ede5(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_91ede5
-    ret
-  }
+kernel void compute_main(texture3d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_91ede5(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_91ede5
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/9242e7.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/9242e7.wgsl.expected.ir.msl
index 22fe693..b75bf88 100644
--- a/test/tint/builtins/gen/literal/textureLoad/9242e7.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/9242e7.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<uint, access::read_write> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<rgba16uint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_9242e7(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(uint2(1u));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_9242e7 = func():void {
-  $B2: {
-    %4:texture_storage_2d<rgba16uint, read_write> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, vec2<u32>(1u)
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_9242e7(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_9242e7
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_9242e7(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_9242e7
-    ret
-  }
+kernel void compute_main(texture2d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_9242e7(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_9242e7
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/92dd61.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/92dd61.wgsl.expected.ir.msl
index fbfd174..b389bc8 100644
--- a/test/tint/builtins/gen/literal/textureLoad/92dd61.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/92dd61.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<r8unorm, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_92dd61(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_92dd61 = func():void {
-  $B2: {
-    %4:texture_storage_1d<r8unorm, read_write> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, 1u
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_92dd61(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_92dd61
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_92dd61(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_92dd61
-    ret
-  }
+kernel void compute_main(texture1d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_92dd61(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_92dd61
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/92eb1f.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/92eb1f.wgsl.expected.ir.msl
index ff44fb9..4fe13a8 100644
--- a/test/tint/builtins/gen/literal/textureLoad/92eb1f.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/92eb1f.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<uint, access::sample> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_3d<u32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_92eb1f(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(uint3(1u), 1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_92eb1f = func():void {
-  $B2: {
-    %4:texture_3d<u32> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, vec3<u32>(1u), 1i
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_92eb1f(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_92eb1f
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_92eb1f(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_92eb1f
-    ret
-  }
+kernel void compute_main(texture3d<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_92eb1f(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_92eb1f
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/936952.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/936952.wgsl.expected.ir.msl
index 786e875..11551e3 100644
--- a/test/tint/builtins/gen/literal/textureLoad/936952.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/936952.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba32float, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_936952(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint2(int2(1)), 1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_936952 = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<rgba32float, read> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec2<i32>(1i), 1i
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_936952(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_936952
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_936952(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_936952
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_936952(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_936952
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/93f23e.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/93f23e.wgsl.expected.ir.msl
index 35abf55..6d1245e 100644
--- a/test/tint/builtins/gen/literal/textureLoad/93f23e.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/93f23e.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<uint, access::read_write> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<r32uint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_93f23e(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(uint2(1u));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_93f23e = func():void {
-  $B2: {
-    %4:texture_storage_2d<r32uint, read_write> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, vec2<u32>(1u)
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_93f23e(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_93f23e
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_93f23e(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_93f23e
-    ret
-  }
+kernel void compute_main(texture2d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_93f23e(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_93f23e
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/947107.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/947107.wgsl.expected.ir.msl
index 27ac0dd..7a0dcac 100644
--- a/test/tint/builtins/gen/literal/textureLoad/947107.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/947107.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<r8unorm, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_947107(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint(1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_947107 = func():void {
-  $B2: {
-    %4:texture_storage_1d<r8unorm, read> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, 1i
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_947107(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_947107
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_947107(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_947107
-    ret
-  }
+kernel void compute_main(texture1d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_947107(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_947107
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/96efd5.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/96efd5.wgsl.expected.ir.msl
index aa022c6..5c0c0fc 100644
--- a/test/tint/builtins/gen/literal/textureLoad/96efd5.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/96efd5.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::sample> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_2d_array<f32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_96efd5(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint2(1u), 1u, 1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_96efd5 = func():void {
-  $B2: {
-    %4:texture_2d_array<f32> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec2<u32>(1u), 1u, 1u
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_96efd5(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_96efd5
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_96efd5(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_96efd5
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_96efd5(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_96efd5
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/970308.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/970308.wgsl.expected.ir.msl
index 2f78a21..9959c6a 100644
--- a/test/tint/builtins/gen/literal/textureLoad/970308.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/970308.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<uint, access::read> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<r32uint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_970308(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(uint2(int2(1)), 1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_970308 = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<r32uint, read> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, vec2<i32>(1i), 1u
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_970308(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_970308
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_970308(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_970308
-    ret
-  }
+kernel void compute_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_970308(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_970308
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/9885b0.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/9885b0.wgsl.expected.ir.msl
index bc2b583..183be02 100644
--- a/test/tint/builtins/gen/literal/textureLoad/9885b0.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/9885b0.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<int, access::sample> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_2d_array<i32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_9885b0(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(uint2(1u), 1u, 1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_9885b0 = func():void {
-  $B2: {
-    %4:texture_2d_array<i32> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, vec2<u32>(1u), 1u, 1u
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_9885b0(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_9885b0
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_9885b0(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_9885b0
-    ret
-  }
+kernel void compute_main(texture2d_array<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_9885b0(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_9885b0
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/99d8fa.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/99d8fa.wgsl.expected.ir.msl
index 5951782..69bf93f 100644
--- a/test/tint/builtins/gen/literal/textureLoad/99d8fa.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/99d8fa.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<r8unorm, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_99d8fa(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint3(int3(1)));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_99d8fa = func():void {
-  $B2: {
-    %4:texture_storage_3d<r8unorm, read_write> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec3<i32>(1i)
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_99d8fa(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_99d8fa
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_99d8fa(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_99d8fa
-    ret
-  }
+kernel void compute_main(texture3d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_99d8fa(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_99d8fa
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/9a7c90.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/9a7c90.wgsl.expected.ir.msl
index 9264fe3..f228e2b 100644
--- a/test/tint/builtins/gen/literal/textureLoad/9a7c90.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/9a7c90.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<uint, access::read> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<rgba8uint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_9a7c90(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(uint3(int3(1)));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_9a7c90 = func():void {
-  $B2: {
-    %4:texture_storage_3d<rgba8uint, read> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, vec3<i32>(1i)
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_9a7c90(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_9a7c90
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_9a7c90(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_9a7c90
-    ret
-  }
+kernel void compute_main(texture3d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_9a7c90(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_9a7c90
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/9a8c1e.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/9a8c1e.wgsl.expected.ir.msl
index d3c972e..c684ec9 100644
--- a/test/tint/builtins/gen/literal/textureLoad/9a8c1e.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/9a8c1e.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<int, access::read> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba8sint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_9a8c1e(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(uint2(1u), 1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_9a8c1e = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<rgba8sint, read> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, vec2<u32>(1u), 1i
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_9a8c1e(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_9a8c1e
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_9a8c1e(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_9a8c1e
-    ret
-  }
+kernel void compute_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_9a8c1e(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_9a8c1e
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/9aa733.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/9aa733.wgsl.expected.ir.msl
index b685bdc..be0c54f 100644
--- a/test/tint/builtins/gen/literal/textureLoad/9aa733.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/9aa733.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<int, access::sample> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_2d<i32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_9aa733(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(uint2(1u), 1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_9aa733 = func():void {
-  $B2: {
-    %4:texture_2d<i32> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, vec2<u32>(1u), 1i
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_9aa733(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_9aa733
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_9aa733(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_9aa733
-    ret
-  }
+kernel void compute_main(texture2d<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_9aa733(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_9aa733
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/9b2667.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/9b2667.wgsl.expected.ir.msl
index 657f962..cf713c2 100644
--- a/test/tint/builtins/gen/literal/textureLoad/9b2667.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/9b2667.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  depth2d_array<float, access::sample> arg_0;
+  device float* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_depth_2d_array, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, f32, read_write> = var @binding_point(2, 0)
+void textureLoad_9b2667(tint_module_vars_struct tint_module_vars) {
+  float res = tint_module_vars.arg_0.read(uint2(int2(1)), 1, 1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_9b2667 = func():void {
-  $B2: {
-    %4:texture_depth_2d_array = load %arg_0
-    %5:f32 = textureLoad %4, vec2<i32>(1i), 1i, 1i
-    %res:ptr<function, f32, read_write> = var, %5
-    %7:f32 = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_9b2667(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_9b2667
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(depth2d_array<float, access::sample> arg_0 [[texture(0)]], device float* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_9b2667(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_9b2667
-    ret
-  }
+kernel void compute_main(depth2d_array<float, access::sample> arg_0 [[texture(0)]], device float* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_9b2667(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_9b2667
-    ret
-  }
+vertex vertex_main_outputs vertex_main(depth2d_array<float, access::sample> arg_0 [[texture(0)]], device float* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/9b5343.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/9b5343.wgsl.expected.ir.msl
index a958fdc..b3eea83 100644
--- a/test/tint/builtins/gen/literal/textureLoad/9b5343.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/9b5343.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<uint, access::read> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba16uint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_9b5343(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(uint2(1u), 1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_9b5343 = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<rgba16uint, read> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, vec2<u32>(1u), 1i
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_9b5343(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_9b5343
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_9b5343(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_9b5343
-    ret
-  }
+kernel void compute_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_9b5343(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_9b5343
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/9c2376.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/9c2376.wgsl.expected.ir.msl
index 8923e9d..7dcf700 100644
--- a/test/tint/builtins/gen/literal/textureLoad/9c2376.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/9c2376.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<r32float, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_9c2376(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint2(int2(1)), 1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_9c2376 = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<r32float, read> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec2<i32>(1i), 1u
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_9c2376(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_9c2376
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_9c2376(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_9c2376
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_9c2376(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_9c2376
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/9c2a14.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/9c2a14.wgsl.expected.ir.msl
index dbc0a91..252d5c3 100644
--- a/test/tint/builtins/gen/literal/textureLoad/9c2a14.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/9c2a14.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<rg32float, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_9c2a14(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint2(int2(1)));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_9c2a14 = func():void {
-  $B2: {
-    %4:texture_storage_2d<rg32float, read> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec2<i32>(1i)
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_9c2a14(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_9c2a14
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_9c2a14(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_9c2a14
-    ret
-  }
+kernel void compute_main(texture2d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_9c2a14(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_9c2a14
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/9cf7df.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/9cf7df.wgsl.expected.ir.msl
index 7a3f1e9..d1d0377 100644
--- a/test/tint/builtins/gen/literal/textureLoad/9cf7df.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/9cf7df.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<int, access::read> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rg32sint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_9cf7df(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(uint2(int2(1)), 1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_9cf7df = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<rg32sint, read> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, vec2<i32>(1i), 1u
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_9cf7df(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_9cf7df
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_9cf7df(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_9cf7df
-    ret
-  }
+kernel void compute_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_9cf7df(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_9cf7df
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/9d70e9.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/9d70e9.wgsl.expected.ir.msl
index d651c3a..092f18b 100644
--- a/test/tint/builtins/gen/literal/textureLoad/9d70e9.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/9d70e9.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<int, access::sample> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_2d_array<i32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_9d70e9(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(uint2(int2(1)), 1, 1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_9d70e9 = func():void {
-  $B2: {
-    %4:texture_2d_array<i32> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, vec2<i32>(1i), 1i, 1u
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_9d70e9(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_9d70e9
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_9d70e9(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_9d70e9
-    ret
-  }
+kernel void compute_main(texture2d_array<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_9d70e9(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_9d70e9
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/9de6f5.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/9de6f5.wgsl.expected.ir.msl
index 7e8b8dc..ee4ee68 100644
--- a/test/tint/builtins/gen/literal/textureLoad/9de6f5.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/9de6f5.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba8snorm, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_9de6f5(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint2(int2(1)), 1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_9de6f5 = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<rgba8snorm, read> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec2<i32>(1i), 1u
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_9de6f5(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_9de6f5
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_9de6f5(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_9de6f5
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_9de6f5(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_9de6f5
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/9ed19e.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/9ed19e.wgsl.expected.ir.msl
index e49047c..057bdfe 100644
--- a/test/tint/builtins/gen/literal/textureLoad/9ed19e.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/9ed19e.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  depth2d<float, access::sample> arg_0;
+  device float* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_depth_2d, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, f32, read_write> = var @binding_point(2, 0)
+void textureLoad_9ed19e(tint_module_vars_struct tint_module_vars) {
+  float res = tint_module_vars.arg_0.read(uint2(1u), 1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_9ed19e = func():void {
-  $B2: {
-    %4:texture_depth_2d = load %arg_0
-    %5:f32 = textureLoad %4, vec2<u32>(1u), 1u
-    %res:ptr<function, f32, read_write> = var, %5
-    %7:f32 = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_9ed19e(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_9ed19e
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(depth2d<float, access::sample> arg_0 [[texture(0)]], device float* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_9ed19e(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_9ed19e
-    ret
-  }
+kernel void compute_main(depth2d<float, access::sample> arg_0 [[texture(0)]], device float* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_9ed19e(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_9ed19e
-    ret
-  }
+vertex vertex_main_outputs vertex_main(depth2d<float, access::sample> arg_0 [[texture(0)]], device float* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/9fa9fd.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/9fa9fd.wgsl.expected.ir.msl
index 66712a6..e36374d 100644
--- a/test/tint/builtins/gen/literal/textureLoad/9fa9fd.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/9fa9fd.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<uint, access::read_write> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<rgba32uint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_9fa9fd(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(uint3(1u));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_9fa9fd = func():void {
-  $B2: {
-    %4:texture_storage_3d<rgba32uint, read_write> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, vec3<u32>(1u)
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_9fa9fd(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_9fa9fd
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_9fa9fd(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_9fa9fd
-    ret
-  }
+kernel void compute_main(texture3d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_9fa9fd(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_9fa9fd
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/9fbfd9.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/9fbfd9.wgsl.expected.ir.msl
index 7656b0e..7e292c9 100644
--- a/test/tint/builtins/gen/literal/textureLoad/9fbfd9.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/9fbfd9.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<int, access::sample> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_2d_array<i32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_9fbfd9(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(uint2(int2(1)), 1u, 1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_9fbfd9 = func():void {
-  $B2: {
-    %4:texture_2d_array<i32> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, vec2<i32>(1i), 1u, 1u
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_9fbfd9(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_9fbfd9
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_9fbfd9(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_9fbfd9
-    ret
-  }
+kernel void compute_main(texture2d_array<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_9fbfd9(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_9fbfd9
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/9fd7be.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/9fd7be.wgsl.expected.ir.msl
index d26ea73..2b4f610 100644
--- a/test/tint/builtins/gen/literal/textureLoad/9fd7be.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/9fd7be.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<uint, access::read_write> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba32uint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_9fd7be(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(uint2(int2(1)), 1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_9fd7be = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<rgba32uint, read_write> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, vec2<i32>(1i), 1i
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_9fd7be(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_9fd7be
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_9fd7be(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_9fd7be
-    ret
-  }
+kernel void compute_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_9fd7be(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_9fd7be
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/a03af1.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/a03af1.wgsl.expected.ir.msl
index 06b4078..d51c006 100644
--- a/test/tint/builtins/gen/literal/textureLoad/a03af1.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/a03af1.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba8unorm, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_a03af1(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint2(int2(1)), 1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_a03af1 = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<rgba8unorm, read> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec2<i32>(1i), 1u
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_a03af1(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_a03af1
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_a03af1(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_a03af1
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_a03af1(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_a03af1
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/a24be1.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/a24be1.wgsl.expected.ir.msl
index a9abec1..2b9d405 100644
--- a/test/tint/builtins/gen/literal/textureLoad/a24be1.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/a24be1.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<uint, access::sample> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_2d_array<u32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_a24be1(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(uint2(1u), 1, 1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_a24be1 = func():void {
-  $B2: {
-    %4:texture_2d_array<u32> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, vec2<u32>(1u), 1i, 1u
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_a24be1(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_a24be1
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_a24be1(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_a24be1
-    ret
-  }
+kernel void compute_main(texture2d_array<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_a24be1(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_a24be1
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/a2b3f4.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/a2b3f4.wgsl.expected.ir.msl
index e9e3672..0f61e40 100644
--- a/test/tint/builtins/gen/literal/textureLoad/a2b3f4.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/a2b3f4.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<uint, access::read_write> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba8uint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_a2b3f4(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(uint2(1u), 1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_a2b3f4 = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<rgba8uint, read_write> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, vec2<u32>(1u), 1u
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_a2b3f4(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_a2b3f4
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_a2b3f4(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_a2b3f4
-    ret
-  }
+kernel void compute_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_a2b3f4(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_a2b3f4
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/a3733f.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/a3733f.wgsl.expected.ir.msl
index f35cbc8..e84d477 100644
--- a/test/tint/builtins/gen/literal/textureLoad/a3733f.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/a3733f.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<uint, access::read_write> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<rgba16uint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_a3733f(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(uint2(int2(1)));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_a3733f = func():void {
-  $B2: {
-    %4:texture_storage_2d<rgba16uint, read_write> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, vec2<i32>(1i)
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_a3733f(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_a3733f
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_a3733f(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_a3733f
-    ret
-  }
+kernel void compute_main(texture2d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_a3733f(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_a3733f
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/a3f122.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/a3f122.wgsl.expected.ir.msl
index 99edb67..936fe71 100644
--- a/test/tint/builtins/gen/literal/textureLoad/a3f122.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/a3f122.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<uint, access::read_write> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba32uint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_a3f122(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(uint2(1u), 1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_a3f122 = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<rgba32uint, read_write> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, vec2<u32>(1u), 1u
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_a3f122(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_a3f122
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_a3f122(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_a3f122
-    ret
-  }
+kernel void compute_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_a3f122(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_a3f122
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/a548a8.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/a548a8.wgsl.expected.ir.msl
index 1c28420..4b1ad01 100644
--- a/test/tint/builtins/gen/literal/textureLoad/a548a8.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/a548a8.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<uint, access::read_write> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<rgba8uint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_a548a8(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(uint(1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_a548a8 = func():void {
-  $B2: {
-    %4:texture_storage_1d<rgba8uint, read_write> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, 1i
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_a548a8(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_a548a8
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_a548a8(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_a548a8
-    ret
-  }
+kernel void compute_main(texture1d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_a548a8(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_a548a8
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/a54e11.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/a54e11.wgsl.expected.ir.msl
index 1f6a241..2a41d52 100644
--- a/test/tint/builtins/gen/literal/textureLoad/a54e11.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/a54e11.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<int, access::read_write> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba8sint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_a54e11(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(uint2(int2(1)), 1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_a54e11 = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<rgba8sint, read_write> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, vec2<i32>(1i), 1u
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_a54e11(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_a54e11
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_a54e11(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_a54e11
-    ret
-  }
+kernel void compute_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_a54e11(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_a54e11
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/a583c9.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/a583c9.wgsl.expected.ir.msl
index c4a1a40..e07796a 100644
--- a/test/tint/builtins/gen/literal/textureLoad/a583c9.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/a583c9.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_ms<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_multisampled_2d<f32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_a583c9(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint2(int2(1)), 1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_a583c9 = func():void {
-  $B2: {
-    %4:texture_multisampled_2d<f32> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec2<i32>(1i), 1i
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_a583c9(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_a583c9
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_ms<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_a583c9(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_a583c9
-    ret
-  }
+kernel void compute_main(texture2d_ms<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_a583c9(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_a583c9
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_ms<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/a5c4e2.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/a5c4e2.wgsl.expected.ir.msl
index 6f5519e..ae20ca9 100644
--- a/test/tint/builtins/gen/literal/textureLoad/a5c4e2.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/a5c4e2.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<uint, access::read_write> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<rg32uint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_a5c4e2(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(uint(1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_a5c4e2 = func():void {
-  $B2: {
-    %4:texture_storage_1d<rg32uint, read_write> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, 1i
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_a5c4e2(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_a5c4e2
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_a5c4e2(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_a5c4e2
-    ret
-  }
+kernel void compute_main(texture1d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_a5c4e2(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_a5c4e2
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/a5e0a5.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/a5e0a5.wgsl.expected.ir.msl
index b563f06..c8a470f 100644
--- a/test/tint/builtins/gen/literal/textureLoad/a5e0a5.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/a5e0a5.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<r32float, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_a5e0a5(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint2(1u));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_a5e0a5 = func():void {
-  $B2: {
-    %4:texture_storage_2d<r32float, read_write> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec2<u32>(1u)
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_a5e0a5(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_a5e0a5
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_a5e0a5(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_a5e0a5
-    ret
-  }
+kernel void compute_main(texture2d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_a5e0a5(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_a5e0a5
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/a64b1d.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/a64b1d.wgsl.expected.ir.msl
index 5a6a2c3..c7eb668 100644
--- a/test/tint/builtins/gen/literal/textureLoad/a64b1d.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/a64b1d.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<rgba8unorm, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_a64b1d(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint3(1u));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_a64b1d = func():void {
-  $B2: {
-    %4:texture_storage_3d<rgba8unorm, read_write> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec3<u32>(1u)
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_a64b1d(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_a64b1d
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_a64b1d(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_a64b1d
-    ret
-  }
+kernel void compute_main(texture3d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_a64b1d(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_a64b1d
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/a6a85a.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/a6a85a.wgsl.expected.ir.msl
index d3bde8f..caf0fd4 100644
--- a/test/tint/builtins/gen/literal/textureLoad/a6a85a.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/a6a85a.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<rgba8unorm, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_a6a85a(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint3(int3(1)));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_a6a85a = func():void {
-  $B2: {
-    %4:texture_storage_3d<rgba8unorm, read> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec3<i32>(1i)
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_a6a85a(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_a6a85a
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_a6a85a(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_a6a85a
-    ret
-  }
+kernel void compute_main(texture3d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_a6a85a(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_a6a85a
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/a6b61d.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/a6b61d.wgsl.expected.ir.msl
index 39cdf2e..5ca3360 100644
--- a/test/tint/builtins/gen/literal/textureLoad/a6b61d.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/a6b61d.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<int, access::read> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba32sint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_a6b61d(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(uint2(int2(1)), 1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_a6b61d = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<rgba32sint, read> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, vec2<i32>(1i), 1i
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_a6b61d(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_a6b61d
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_a6b61d(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_a6b61d
-    ret
-  }
+kernel void compute_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_a6b61d(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_a6b61d
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/a7444c.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/a7444c.wgsl.expected.ir.msl
index aa24f88..d34f209 100644
--- a/test/tint/builtins/gen/literal/textureLoad/a7444c.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/a7444c.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<uint, access::read> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba8uint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_a7444c(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(uint2(1u), 1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_a7444c = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<rgba8uint, read> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, vec2<u32>(1u), 1u
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_a7444c(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_a7444c
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_a7444c(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_a7444c
-    ret
-  }
+kernel void compute_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_a7444c(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_a7444c
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/a7a3c3.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/a7a3c3.wgsl.expected.ir.msl
index 3631495..fcc7ed7 100644
--- a/test/tint/builtins/gen/literal/textureLoad/a7a3c3.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/a7a3c3.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<int, access::read> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<rgba16sint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_a7a3c3(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(uint3(int3(1)));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_a7a3c3 = func():void {
-  $B2: {
-    %4:texture_storage_3d<rgba16sint, read> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, vec3<i32>(1i)
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_a7a3c3(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_a7a3c3
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_a7a3c3(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_a7a3c3
-    ret
-  }
+kernel void compute_main(texture3d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_a7a3c3(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_a7a3c3
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/a7bcb4.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/a7bcb4.wgsl.expected.ir.msl
index 83bffa6..affb76d 100644
--- a/test/tint/builtins/gen/literal/textureLoad/a7bcb4.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/a7bcb4.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<rgba8snorm, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_a7bcb4(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_a7bcb4 = func():void {
-  $B2: {
-    %4:texture_storage_1d<rgba8snorm, read_write> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, 1u
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_a7bcb4(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_a7bcb4
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_a7bcb4(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_a7bcb4
-    ret
-  }
+kernel void compute_main(texture1d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_a7bcb4(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_a7bcb4
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/a7c171.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/a7c171.wgsl.expected.ir.msl
index dfa6eb7..454ab45 100644
--- a/test/tint/builtins/gen/literal/textureLoad/a7c171.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/a7c171.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<int, access::read_write> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<rgba16sint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_a7c171(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(uint2(1u));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_a7c171 = func():void {
-  $B2: {
-    %4:texture_storage_2d<rgba16sint, read_write> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, vec2<u32>(1u)
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_a7c171(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_a7c171
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_a7c171(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_a7c171
-    ret
-  }
+kernel void compute_main(texture2d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_a7c171(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_a7c171
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/a8549b.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/a8549b.wgsl.expected.ir.msl
index 75d08d1..7202270 100644
--- a/test/tint/builtins/gen/literal/textureLoad/a8549b.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/a8549b.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<rgba32float, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_a8549b(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint3(1u));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_a8549b = func():void {
-  $B2: {
-    %4:texture_storage_3d<rgba32float, read> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec3<u32>(1u)
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_a8549b(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_a8549b
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_a8549b(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_a8549b
-    ret
-  }
+kernel void compute_main(texture3d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_a8549b(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_a8549b
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/a92b18.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/a92b18.wgsl.expected.ir.msl
index 2ac9a5a..9ca2364 100644
--- a/test/tint/builtins/gen/literal/textureLoad/a92b18.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/a92b18.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba32float, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_a92b18(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint2(1u), 1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_a92b18 = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<rgba32float, read_write> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec2<u32>(1u), 1i
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_a92b18(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_a92b18
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_a92b18(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_a92b18
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_a92b18(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_a92b18
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/a9a9f5.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/a9a9f5.wgsl.expected.ir.msl
index 766cb3f..ba81e67 100644
--- a/test/tint/builtins/gen/literal/textureLoad/a9a9f5.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/a9a9f5.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<uint, access::sample> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_3d<u32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_a9a9f5(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(uint3(int3(1)), 1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_a9a9f5 = func():void {
-  $B2: {
-    %4:texture_3d<u32> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, vec3<i32>(1i), 1i
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_a9a9f5(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_a9a9f5
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_a9a9f5(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_a9a9f5
-    ret
-  }
+kernel void compute_main(texture3d<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_a9a9f5(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_a9a9f5
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/aa2579.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/aa2579.wgsl.expected.ir.msl
index 94fc625..44e31ce 100644
--- a/test/tint/builtins/gen/literal/textureLoad/aa2579.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/aa2579.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<uint, access::read_write> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba32uint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_aa2579(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(uint2(1u), 1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_aa2579 = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<rgba32uint, read_write> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, vec2<u32>(1u), 1i
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_aa2579(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_aa2579
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_aa2579(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_aa2579
-    ret
-  }
+kernel void compute_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_aa2579(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_aa2579
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/aa6130.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/aa6130.wgsl.expected.ir.msl
index 8e4ea28..3f0f316 100644
--- a/test/tint/builtins/gen/literal/textureLoad/aa6130.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/aa6130.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<int, access::read_write> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<rg32sint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_aa6130(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(uint2(int2(1)));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_aa6130 = func():void {
-  $B2: {
-    %4:texture_storage_2d<rg32sint, read_write> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, vec2<i32>(1i)
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_aa6130(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_aa6130
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_aa6130(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_aa6130
-    ret
-  }
+kernel void compute_main(texture2d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_aa6130(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_aa6130
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/aa8a0d.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/aa8a0d.wgsl.expected.ir.msl
index 32ac8c7..29a2ef6 100644
--- a/test/tint/builtins/gen/literal/textureLoad/aa8a0d.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/aa8a0d.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<uint, access::read> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<rgba16uint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_aa8a0d(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(uint2(1u));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_aa8a0d = func():void {
-  $B2: {
-    %4:texture_storage_2d<rgba16uint, read> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, vec2<u32>(1u)
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_aa8a0d(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_aa8a0d
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_aa8a0d(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_aa8a0d
-    ret
-  }
+kernel void compute_main(texture2d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_aa8a0d(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_aa8a0d
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/aae7f6.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/aae7f6.wgsl.expected.ir.msl
index af86248..1bf555d 100644
--- a/test/tint/builtins/gen/literal/textureLoad/aae7f6.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/aae7f6.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<int, access::read> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<r32sint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_aae7f6(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(uint2(int2(1)), 1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_aae7f6 = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<r32sint, read> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, vec2<i32>(1i), 1u
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_aae7f6(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_aae7f6
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_aae7f6(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_aae7f6
-    ret
-  }
+kernel void compute_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_aae7f6(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_aae7f6
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/aae9c3.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/aae9c3.wgsl.expected.ir.msl
index 9cf8d46..cbf1b95 100644
--- a/test/tint/builtins/gen/literal/textureLoad/aae9c3.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/aae9c3.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba8snorm, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_aae9c3(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint2(int2(1)), 1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_aae9c3 = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<rgba8snorm, read_write> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec2<i32>(1i), 1u
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_aae9c3(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_aae9c3
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_aae9c3(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_aae9c3
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_aae9c3(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_aae9c3
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/ac64f7.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/ac64f7.wgsl.expected.ir.msl
index 919dbfa..401a068 100644
--- a/test/tint/builtins/gen/literal/textureLoad/ac64f7.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/ac64f7.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<bgra8unorm, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_ac64f7(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint2(1u), 1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_ac64f7 = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<bgra8unorm, read> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec2<u32>(1u), 1u
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_ac64f7(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_ac64f7
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_ac64f7(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_ac64f7
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_ac64f7(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_ac64f7
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/acf22f.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/acf22f.wgsl.expected.ir.msl
index ac0613e..ac11372 100644
--- a/test/tint/builtins/gen/literal/textureLoad/acf22f.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/acf22f.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<rgba16float, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_acf22f(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_acf22f = func():void {
-  $B2: {
-    %4:texture_storage_1d<rgba16float, read_write> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, 1u
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_acf22f(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_acf22f
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_acf22f(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_acf22f
-    ret
-  }
+kernel void compute_main(texture1d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_acf22f(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_acf22f
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/ad551e.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/ad551e.wgsl.expected.ir.msl
index 5a66c2f..f5ac5d7 100644
--- a/test/tint/builtins/gen/literal/textureLoad/ad551e.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/ad551e.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<uint, access::read_write> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<r32uint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_ad551e(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_ad551e = func():void {
-  $B2: {
-    %4:texture_storage_1d<r32uint, read_write> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, 1u
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_ad551e(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_ad551e
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_ad551e(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_ad551e
-    ret
-  }
+kernel void compute_main(texture1d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_ad551e(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_ad551e
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/aeae73.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/aeae73.wgsl.expected.ir.msl
index 3b74ba0..784f4b5 100644
--- a/test/tint/builtins/gen/literal/textureLoad/aeae73.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/aeae73.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<uint, access::read> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<r32uint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_aeae73(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(uint2(1u), 1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_aeae73 = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<r32uint, read> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, vec2<u32>(1u), 1i
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_aeae73(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_aeae73
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_aeae73(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_aeae73
-    ret
-  }
+kernel void compute_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_aeae73(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_aeae73
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/aebc09.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/aebc09.wgsl.expected.ir.msl
index 93d9359..83d1821 100644
--- a/test/tint/builtins/gen/literal/textureLoad/aebc09.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/aebc09.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<uint, access::read> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<rgba16uint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_aebc09(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_aebc09 = func():void {
-  $B2: {
-    %4:texture_storage_1d<rgba16uint, read> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, 1u
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_aebc09(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_aebc09
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_aebc09(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_aebc09
-    ret
-  }
+kernel void compute_main(texture1d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_aebc09(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_aebc09
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/af0507.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/af0507.wgsl.expected.ir.msl
index f36566f..99ef7a7 100644
--- a/test/tint/builtins/gen/literal/textureLoad/af0507.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/af0507.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rg32float, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_af0507(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint2(int2(1)), 1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_af0507 = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<rg32float, read_write> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec2<i32>(1i), 1u
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_af0507(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_af0507
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_af0507(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_af0507
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_af0507(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_af0507
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/b1bf79.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/b1bf79.wgsl.expected.ir.msl
index f6788af..152eb3e 100644
--- a/test/tint/builtins/gen/literal/textureLoad/b1bf79.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/b1bf79.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<int, access::read> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<rgba32sint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_b1bf79(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(uint3(int3(1)));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_b1bf79 = func():void {
-  $B2: {
-    %4:texture_storage_3d<rgba32sint, read> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, vec3<i32>(1i)
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_b1bf79(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_b1bf79
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_b1bf79(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_b1bf79
-    ret
-  }
+kernel void compute_main(texture3d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_b1bf79(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_b1bf79
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/b1ca35.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/b1ca35.wgsl.expected.ir.msl
index ce65533..5851291 100644
--- a/test/tint/builtins/gen/literal/textureLoad/b1ca35.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/b1ca35.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<int, access::read_write> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rg32sint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_b1ca35(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(uint2(1u), 1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_b1ca35 = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<rg32sint, read_write> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, vec2<u32>(1u), 1u
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_b1ca35(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_b1ca35
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_b1ca35(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_b1ca35
-    ret
-  }
+kernel void compute_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_b1ca35(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_b1ca35
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/b24d27.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/b24d27.wgsl.expected.ir.msl
index d522e90..9cb92bd 100644
--- a/test/tint/builtins/gen/literal/textureLoad/b24d27.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/b24d27.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<int, access::read> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<rgba8sint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_b24d27(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(uint2(1u));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_b24d27 = func():void {
-  $B2: {
-    %4:texture_storage_2d<rgba8sint, read> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, vec2<u32>(1u)
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_b24d27(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_b24d27
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_b24d27(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_b24d27
-    ret
-  }
+kernel void compute_main(texture2d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_b24d27(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_b24d27
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/b25644.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/b25644.wgsl.expected.ir.msl
index 8901c34..407dce0 100644
--- a/test/tint/builtins/gen/literal/textureLoad/b25644.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/b25644.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<uint, access::read_write> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<r32uint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_b25644(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(uint2(int2(1)), 1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_b25644 = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<r32uint, read_write> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, vec2<i32>(1i), 1u
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_b25644(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_b25644
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_b25644(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_b25644
-    ret
-  }
+kernel void compute_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_b25644(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_b25644
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/b27c33.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/b27c33.wgsl.expected.ir.msl
index 1a4af67..5cd4919 100644
--- a/test/tint/builtins/gen/literal/textureLoad/b27c33.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/b27c33.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<int, access::read_write> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<r32sint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_b27c33(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(uint3(int3(1)));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_b27c33 = func():void {
-  $B2: {
-    %4:texture_storage_3d<r32sint, read_write> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, vec3<i32>(1i)
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_b27c33(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_b27c33
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_b27c33(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_b27c33
-    ret
-  }
+kernel void compute_main(texture3d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_b27c33(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_b27c33
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/b29f71.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/b29f71.wgsl.expected.ir.msl
index b37a726..770fe4e 100644
--- a/test/tint/builtins/gen/literal/textureLoad/b29f71.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/b29f71.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<int, access::sample> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_2d_array<i32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_b29f71(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(uint2(int2(1)), 1u, 1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_b29f71 = func():void {
-  $B2: {
-    %4:texture_2d_array<i32> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, vec2<i32>(1i), 1u, 1i
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_b29f71(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_b29f71
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_b29f71(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_b29f71
-    ret
-  }
+kernel void compute_main(texture2d_array<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_b29f71(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_b29f71
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/b4d6c4.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/b4d6c4.wgsl.expected.ir.msl
index f2cf4e9..60a8925 100644
--- a/test/tint/builtins/gen/literal/textureLoad/b4d6c4.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/b4d6c4.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<rg32float, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_b4d6c4(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint2(1u));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_b4d6c4 = func():void {
-  $B2: {
-    %4:texture_storage_2d<rg32float, read_write> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec2<u32>(1u)
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_b4d6c4(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_b4d6c4
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_b4d6c4(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_b4d6c4
-    ret
-  }
+kernel void compute_main(texture2d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_b4d6c4(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_b4d6c4
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/b58c6d.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/b58c6d.wgsl.expected.ir.msl
index 21a0f23..dc24188 100644
--- a/test/tint/builtins/gen/literal/textureLoad/b58c6d.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/b58c6d.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<r32float, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_b58c6d(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint2(int2(1)), 1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_b58c6d = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<r32float, read> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec2<i32>(1i), 1i
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_b58c6d(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_b58c6d
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_b58c6d(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_b58c6d
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_b58c6d(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_b58c6d
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/b60a86.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/b60a86.wgsl.expected.ir.msl
index 2cb0a28..cbabba2 100644
--- a/test/tint/builtins/gen/literal/textureLoad/b60a86.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/b60a86.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<uint, access::read_write> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<rgba32uint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_b60a86(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(uint(1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_b60a86 = func():void {
-  $B2: {
-    %4:texture_storage_1d<rgba32uint, read_write> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, 1i
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_b60a86(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_b60a86
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_b60a86(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_b60a86
-    ret
-  }
+kernel void compute_main(texture1d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_b60a86(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_b60a86
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/b60db7.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/b60db7.wgsl.expected.ir.msl
index 0ca1b7e..2275a4c 100644
--- a/test/tint/builtins/gen/literal/textureLoad/b60db7.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/b60db7.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<bgra8unorm, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_b60db7(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint2(1u), 1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_b60db7 = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<bgra8unorm, read_write> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec2<u32>(1u), 1u
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_b60db7(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_b60db7
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_b60db7(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_b60db7
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_b60db7(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_b60db7
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/b6ba5d.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/b6ba5d.wgsl.expected.ir.msl
index 9c59788..5235c4e 100644
--- a/test/tint/builtins/gen/literal/textureLoad/b6ba5d.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/b6ba5d.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  depth2d_array<float, access::sample> arg_0;
+  device float* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_depth_2d_array, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, f32, read_write> = var @binding_point(2, 0)
+void textureLoad_b6ba5d(tint_module_vars_struct tint_module_vars) {
+  float res = tint_module_vars.arg_0.read(uint2(1u), 1, 1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_b6ba5d = func():void {
-  $B2: {
-    %4:texture_depth_2d_array = load %arg_0
-    %5:f32 = textureLoad %4, vec2<u32>(1u), 1i, 1i
-    %res:ptr<function, f32, read_write> = var, %5
-    %7:f32 = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_b6ba5d(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_b6ba5d
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(depth2d_array<float, access::sample> arg_0 [[texture(0)]], device float* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_b6ba5d(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_b6ba5d
-    ret
-  }
+kernel void compute_main(depth2d_array<float, access::sample> arg_0 [[texture(0)]], device float* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_b6ba5d(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_b6ba5d
-    ret
-  }
+vertex vertex_main_outputs vertex_main(depth2d_array<float, access::sample> arg_0 [[texture(0)]], device float* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/b6c458.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/b6c458.wgsl.expected.ir.msl
index b32f44f..44686caa 100644
--- a/test/tint/builtins/gen/literal/textureLoad/b6c458.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/b6c458.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<uint, access::read> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<rgba32uint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_b6c458(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(uint2(int2(1)));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_b6c458 = func():void {
-  $B2: {
-    %4:texture_storage_2d<rgba32uint, read> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, vec2<i32>(1i)
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_b6c458(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_b6c458
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_b6c458(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_b6c458
-    ret
-  }
+kernel void compute_main(texture2d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_b6c458(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_b6c458
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/b73f6b.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/b73f6b.wgsl.expected.ir.msl
index b076e89..70d6738 100644
--- a/test/tint/builtins/gen/literal/textureLoad/b73f6b.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/b73f6b.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<uint, access::sample> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_2d<u32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_b73f6b(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(uint2(1u), 1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_b73f6b = func():void {
-  $B2: {
-    %4:texture_2d<u32> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, vec2<u32>(1u), 1i
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_b73f6b(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_b73f6b
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_b73f6b(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_b73f6b
-    ret
-  }
+kernel void compute_main(texture2d<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_b73f6b(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_b73f6b
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/b75c8f.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/b75c8f.wgsl.expected.ir.msl
index 5bc056f..9620c23 100644
--- a/test/tint/builtins/gen/literal/textureLoad/b75c8f.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/b75c8f.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<int, access::read_write> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<r32sint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_b75c8f(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(uint2(1u));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_b75c8f = func():void {
-  $B2: {
-    %4:texture_storage_2d<r32sint, read_write> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, vec2<u32>(1u)
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_b75c8f(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_b75c8f
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_b75c8f(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_b75c8f
-    ret
-  }
+kernel void compute_main(texture2d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_b75c8f(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_b75c8f
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/b75d4a.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/b75d4a.wgsl.expected.ir.msl
index c584e6c..e4b8351 100644
--- a/test/tint/builtins/gen/literal/textureLoad/b75d4a.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/b75d4a.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_ms<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_multisampled_2d<f32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_b75d4a(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint2(int2(1)), 1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_b75d4a = func():void {
-  $B2: {
-    %4:texture_multisampled_2d<f32> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec2<i32>(1i), 1u
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_b75d4a(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_b75d4a
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_ms<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_b75d4a(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_b75d4a
-    ret
-  }
+kernel void compute_main(texture2d_ms<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_b75d4a(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_b75d4a
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_ms<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/b7f74f.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/b7f74f.wgsl.expected.ir.msl
index 19d4723..76296c0 100644
--- a/test/tint/builtins/gen/literal/textureLoad/b7f74f.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/b7f74f.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<bgra8unorm, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_b7f74f(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_b7f74f = func():void {
-  $B2: {
-    %4:texture_storage_1d<bgra8unorm, read> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, 1u
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_b7f74f(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_b7f74f
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_b7f74f(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_b7f74f
-    ret
-  }
+kernel void compute_main(texture1d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_b7f74f(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_b7f74f
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/b80e7e.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/b80e7e.wgsl.expected.ir.msl
index 4a8333f..c01f7d6 100644
--- a/test/tint/builtins/gen/literal/textureLoad/b80e7e.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/b80e7e.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba16float, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_b80e7e(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint2(1u), 1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_b80e7e = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<rgba16float, read> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec2<u32>(1u), 1i
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_b80e7e(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_b80e7e
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_b80e7e(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_b80e7e
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_b80e7e(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_b80e7e
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/b94d15.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/b94d15.wgsl.expected.ir.msl
index bc22772..39d3087 100644
--- a/test/tint/builtins/gen/literal/textureLoad/b94d15.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/b94d15.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<uint, access::read> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba8uint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_b94d15(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(uint2(int2(1)), 1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_b94d15 = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<rgba8uint, read> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, vec2<i32>(1i), 1u
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_b94d15(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_b94d15
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_b94d15(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_b94d15
-    ret
-  }
+kernel void compute_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_b94d15(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_b94d15
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/ba023a.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/ba023a.wgsl.expected.ir.msl
index 5950a6a..8162362 100644
--- a/test/tint/builtins/gen/literal/textureLoad/ba023a.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/ba023a.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<int, access::read_write> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<r32sint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_ba023a(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(uint2(int2(1)), 1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_ba023a = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<r32sint, read_write> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, vec2<i32>(1i), 1i
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_ba023a(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_ba023a
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_ba023a(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_ba023a
-    ret
-  }
+kernel void compute_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_ba023a(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_ba023a
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/ba74b2.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/ba74b2.wgsl.expected.ir.msl
index e7ce55e..a0bb79c 100644
--- a/test/tint/builtins/gen/literal/textureLoad/ba74b2.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/ba74b2.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<int, access::read_write> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba32sint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_ba74b2(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(uint2(int2(1)), 1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_ba74b2 = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<rgba32sint, read_write> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, vec2<i32>(1i), 1i
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_ba74b2(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_ba74b2
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_ba74b2(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_ba74b2
-    ret
-  }
+kernel void compute_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_ba74b2(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_ba74b2
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/babdf3.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/babdf3.wgsl.expected.ir.msl
index 156a9d2..4492cd0 100644
--- a/test/tint/builtins/gen/literal/textureLoad/babdf3.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/babdf3.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<uint, access::read_write> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<rgba16uint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_babdf3(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_babdf3 = func():void {
-  $B2: {
-    %4:texture_storage_1d<rgba16uint, read_write> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, 1u
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_babdf3(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_babdf3
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_babdf3(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_babdf3
-    ret
-  }
+kernel void compute_main(texture1d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_babdf3(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_babdf3
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/bba04a.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/bba04a.wgsl.expected.ir.msl
index 8b29a93..65464e2 100644
--- a/test/tint/builtins/gen/literal/textureLoad/bba04a.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/bba04a.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<uint, access::read_write> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<rg32uint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_bba04a(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_bba04a = func():void {
-  $B2: {
-    %4:texture_storage_1d<rg32uint, read_write> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, 1u
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_bba04a(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_bba04a
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_bba04a(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_bba04a
-    ret
-  }
+kernel void compute_main(texture1d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_bba04a(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_bba04a
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/bbb762.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/bbb762.wgsl.expected.ir.msl
index baccd6a..6a82e47 100644
--- a/test/tint/builtins/gen/literal/textureLoad/bbb762.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/bbb762.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<int, access::read_write> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<rgba32sint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_bbb762(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(uint2(1u));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_bbb762 = func():void {
-  $B2: {
-    %4:texture_storage_2d<rgba32sint, read_write> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, vec2<u32>(1u)
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_bbb762(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_bbb762
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_bbb762(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_bbb762
-    ret
-  }
+kernel void compute_main(texture2d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_bbb762(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_bbb762
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/bc3201.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/bc3201.wgsl.expected.ir.msl
index 7ef0b47..1ff5807 100644
--- a/test/tint/builtins/gen/literal/textureLoad/bc3201.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/bc3201.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<uint, access::sample> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_1d<u32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_bc3201(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_bc3201 = func():void {
-  $B2: {
-    %4:texture_1d<u32> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, 1u, 1u
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_bc3201(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_bc3201
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_bc3201(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_bc3201
-    ret
-  }
+kernel void compute_main(texture1d<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_bc3201(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_bc3201
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/bc882d.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/bc882d.wgsl.expected.ir.msl
index cd77fce..8373eaf 100644
--- a/test/tint/builtins/gen/literal/textureLoad/bc882d.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/bc882d.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<r8unorm, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_bc882d(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint2(1u), 1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_bc882d = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<r8unorm, read_write> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec2<u32>(1u), 1i
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_bc882d(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_bc882d
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_bc882d(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_bc882d
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_bc882d(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_bc882d
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/bcbb3c.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/bcbb3c.wgsl.expected.ir.msl
index 1722046..cd1d1b5 100644
--- a/test/tint/builtins/gen/literal/textureLoad/bcbb3c.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/bcbb3c.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<float, access::sample> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_3d<f32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_bcbb3c(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint3(1u), 1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_bcbb3c = func():void {
-  $B2: {
-    %4:texture_3d<f32> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec3<u32>(1u), 1i
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_bcbb3c(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_bcbb3c
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_bcbb3c(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_bcbb3c
-    ret
-  }
+kernel void compute_main(texture3d<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_bcbb3c(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_bcbb3c
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/bd990a.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/bd990a.wgsl.expected.ir.msl
index d6b8e19..e86fdb9 100644
--- a/test/tint/builtins/gen/literal/textureLoad/bd990a.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/bd990a.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<uint, access::read_write> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba8uint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_bd990a(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(uint2(1u), 1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_bd990a = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<rgba8uint, read_write> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, vec2<u32>(1u), 1i
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_bd990a(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_bd990a
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_bd990a(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_bd990a
-    ret
-  }
+kernel void compute_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_bd990a(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_bd990a
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/bdc67a.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/bdc67a.wgsl.expected.ir.msl
index 5d78ff3..30046d7 100644
--- a/test/tint/builtins/gen/literal/textureLoad/bdc67a.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/bdc67a.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rg32float, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_bdc67a(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint2(1u), 1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_bdc67a = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<rg32float, read_write> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec2<u32>(1u), 1i
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_bdc67a(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_bdc67a
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_bdc67a(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_bdc67a
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_bdc67a(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_bdc67a
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/bfd154.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/bfd154.wgsl.expected.ir.msl
index a70e5f0..8be009f 100644
--- a/test/tint/builtins/gen/literal/textureLoad/bfd154.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/bfd154.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<uint, access::read> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<r32uint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_bfd154(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(uint3(int3(1)));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_bfd154 = func():void {
-  $B2: {
-    %4:texture_storage_3d<r32uint, read> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, vec3<i32>(1i)
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_bfd154(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_bfd154
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_bfd154(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_bfd154
-    ret
-  }
+kernel void compute_main(texture3d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_bfd154(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_bfd154
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/c02b74.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/c02b74.wgsl.expected.ir.msl
index 9af0807..6f30e6b 100644
--- a/test/tint/builtins/gen/literal/textureLoad/c02b74.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/c02b74.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<rgba16float, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_c02b74(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint(1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_c02b74 = func():void {
-  $B2: {
-    %4:texture_storage_1d<rgba16float, read> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, 1i
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_c02b74(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_c02b74
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_c02b74(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_c02b74
-    ret
-  }
+kernel void compute_main(texture1d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_c02b74(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_c02b74
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/c07013.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/c07013.wgsl.expected.ir.msl
index 2c98c0f..f7d6ab2 100644
--- a/test/tint/builtins/gen/literal/textureLoad/c07013.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/c07013.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<r32float, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_c07013(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint2(int2(1)));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_c07013 = func():void {
-  $B2: {
-    %4:texture_storage_2d<r32float, read> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec2<i32>(1i)
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_c07013(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_c07013
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_c07013(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_c07013
-    ret
-  }
+kernel void compute_main(texture2d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_c07013(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_c07013
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/c16e00.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/c16e00.wgsl.expected.ir.msl
index a74b48f..0cdcb92 100644
--- a/test/tint/builtins/gen/literal/textureLoad/c16e00.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/c16e00.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  depth2d_array<float, access::sample> arg_0;
+  device float* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_depth_2d_array, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, f32, read_write> = var @binding_point(2, 0)
+void textureLoad_c16e00(tint_module_vars_struct tint_module_vars) {
+  float res = tint_module_vars.arg_0.read(uint2(int2(1)), 1u, 1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_c16e00 = func():void {
-  $B2: {
-    %4:texture_depth_2d_array = load %arg_0
-    %5:f32 = textureLoad %4, vec2<i32>(1i), 1u, 1i
-    %res:ptr<function, f32, read_write> = var, %5
-    %7:f32 = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_c16e00(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_c16e00
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(depth2d_array<float, access::sample> arg_0 [[texture(0)]], device float* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_c16e00(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_c16e00
-    ret
-  }
+kernel void compute_main(depth2d_array<float, access::sample> arg_0 [[texture(0)]], device float* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_c16e00(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_c16e00
-    ret
-  }
+vertex vertex_main_outputs vertex_main(depth2d_array<float, access::sample> arg_0 [[texture(0)]], device float* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/c21b33.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/c21b33.wgsl.expected.ir.msl
index 7d9bc5d..070ed25 100644
--- a/test/tint/builtins/gen/literal/textureLoad/c21b33.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/c21b33.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<uint, access::read> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba32uint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_c21b33(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(uint2(1u), 1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_c21b33 = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<rgba32uint, read> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, vec2<u32>(1u), 1i
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_c21b33(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_c21b33
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_c21b33(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_c21b33
-    ret
-  }
+kernel void compute_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_c21b33(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_c21b33
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/c2a480.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/c2a480.wgsl.expected.ir.msl
index ec2db07..5bedccb 100644
--- a/test/tint/builtins/gen/literal/textureLoad/c2a480.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/c2a480.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<int, access::sample> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_2d<i32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_c2a480(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(uint2(int2(1)), 1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_c2a480 = func():void {
-  $B2: {
-    %4:texture_2d<i32> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, vec2<i32>(1i), 1i
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_c2a480(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_c2a480
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_c2a480(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_c2a480
-    ret
-  }
+kernel void compute_main(texture2d<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_c2a480(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_c2a480
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/c2d09a.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/c2d09a.wgsl.expected.ir.msl
index fac51c5..471b31d 100644
--- a/test/tint/builtins/gen/literal/textureLoad/c2d09a.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/c2d09a.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<uint, access::read_write> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<r32uint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_c2d09a(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(uint2(1u), 1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_c2d09a = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<r32uint, read_write> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, vec2<u32>(1u), 1i
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_c2d09a(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_c2d09a
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_c2d09a(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_c2d09a
-    ret
-  }
+kernel void compute_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_c2d09a(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_c2d09a
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/c378ee.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/c378ee.wgsl.expected.ir.msl
index 64b7702..b4eba65 100644
--- a/test/tint/builtins/gen/literal/textureLoad/c378ee.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/c378ee.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_ms<uint, access::read> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_multisampled_2d<u32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_c378ee(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(uint2(int2(1)), 1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_c378ee = func():void {
-  $B2: {
-    %4:texture_multisampled_2d<u32> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, vec2<i32>(1i), 1i
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_c378ee(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_c378ee
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_ms<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_c378ee(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_c378ee
-    ret
-  }
+kernel void compute_main(texture2d_ms<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_c378ee(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_c378ee
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_ms<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/c40dcb.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/c40dcb.wgsl.expected.ir.msl
index 925d054..962863d 100644
--- a/test/tint/builtins/gen/literal/textureLoad/c40dcb.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/c40dcb.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<uint, access::read> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba32uint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_c40dcb(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(uint2(int2(1)), 1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_c40dcb = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<rgba32uint, read> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, vec2<i32>(1i), 1i
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_c40dcb(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_c40dcb
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_c40dcb(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_c40dcb
-    ret
-  }
+kernel void compute_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_c40dcb(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_c40dcb
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/c456bc.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/c456bc.wgsl.expected.ir.msl
index 8f1a849..f398ca1 100644
--- a/test/tint/builtins/gen/literal/textureLoad/c456bc.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/c456bc.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<r32float, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_c456bc(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint3(int3(1)));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_c456bc = func():void {
-  $B2: {
-    %4:texture_storage_3d<r32float, read> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec3<i32>(1i)
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_c456bc(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_c456bc
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_c456bc(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_c456bc
-    ret
-  }
+kernel void compute_main(texture3d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_c456bc(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_c456bc
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/c5791b.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/c5791b.wgsl.expected.ir.msl
index b6008ca..4f8a111 100644
--- a/test/tint/builtins/gen/literal/textureLoad/c5791b.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/c5791b.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<int, access::read> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<rgba16sint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_c5791b(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(uint2(1u));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_c5791b = func():void {
-  $B2: {
-    %4:texture_storage_2d<rgba16sint, read> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, vec2<u32>(1u)
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_c5791b(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_c5791b
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_c5791b(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_c5791b
-    ret
-  }
+kernel void compute_main(texture2d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_c5791b(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_c5791b
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/c5c86d.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/c5c86d.wgsl.expected.ir.msl
index 8dd64a1..39dfa90 100644
--- a/test/tint/builtins/gen/literal/textureLoad/c5c86d.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/c5c86d.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<int, access::read_write> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba16sint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_c5c86d(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(uint2(int2(1)), 1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_c5c86d = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<rgba16sint, read_write> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, vec2<i32>(1i), 1i
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_c5c86d(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_c5c86d
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_c5c86d(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_c5c86d
-    ret
-  }
+kernel void compute_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_c5c86d(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_c5c86d
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/c66b20.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/c66b20.wgsl.expected.ir.msl
index 36aed4b..bb22d29 100644
--- a/test/tint/builtins/gen/literal/textureLoad/c66b20.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/c66b20.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<int, access::read> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<r32sint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_c66b20(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(uint2(1u));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_c66b20 = func():void {
-  $B2: {
-    %4:texture_storage_2d<r32sint, read> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, vec2<u32>(1u)
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_c66b20(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_c66b20
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_c66b20(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_c66b20
-    ret
-  }
+kernel void compute_main(texture2d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_c66b20(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_c66b20
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/c7cbed.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/c7cbed.wgsl.expected.ir.msl
index 80ae590..9627c87 100644
--- a/test/tint/builtins/gen/literal/textureLoad/c7cbed.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/c7cbed.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<r32float, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_c7cbed(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint(1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_c7cbed = func():void {
-  $B2: {
-    %4:texture_storage_1d<r32float, read> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, 1i
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_c7cbed(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_c7cbed
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_c7cbed(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_c7cbed
-    ret
-  }
+kernel void compute_main(texture1d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_c7cbed(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_c7cbed
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/c7e313.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/c7e313.wgsl.expected.ir.msl
index d3bace1..33fc6f7 100644
--- a/test/tint/builtins/gen/literal/textureLoad/c7e313.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/c7e313.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<uint, access::read_write> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<rgba32uint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_c7e313(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(uint2(1u));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_c7e313 = func():void {
-  $B2: {
-    %4:texture_storage_2d<rgba32uint, read_write> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, vec2<u32>(1u)
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_c7e313(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_c7e313
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_c7e313(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_c7e313
-    ret
-  }
+kernel void compute_main(texture2d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_c7e313(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_c7e313
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/c80691.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/c80691.wgsl.expected.ir.msl
index 78b79c3..fdea9a7 100644
--- a/test/tint/builtins/gen/literal/textureLoad/c80691.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/c80691.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<int, access::read_write> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<r32sint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_c80691(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_c80691 = func():void {
-  $B2: {
-    %4:texture_storage_1d<r32sint, read_write> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, 1u
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_c80691(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_c80691
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_c80691(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_c80691
-    ret
-  }
+kernel void compute_main(texture1d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_c80691(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_c80691
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/c8ed19.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/c8ed19.wgsl.expected.ir.msl
index 812efdd..9fdb702 100644
--- a/test/tint/builtins/gen/literal/textureLoad/c8ed19.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/c8ed19.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<uint, access::read> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rg32uint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_c8ed19(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(uint2(1u), 1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_c8ed19 = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<rg32uint, read> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, vec2<u32>(1u), 1u
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_c8ed19(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_c8ed19
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_c8ed19(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_c8ed19
-    ret
-  }
+kernel void compute_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_c8ed19(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_c8ed19
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/c98bf4.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/c98bf4.wgsl.expected.ir.msl
index 883e014..01b6bcf 100644
--- a/test/tint/builtins/gen/literal/textureLoad/c98bf4.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/c98bf4.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<rgba8snorm, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_c98bf4(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint3(int3(1)));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_c98bf4 = func():void {
-  $B2: {
-    %4:texture_storage_3d<rgba8snorm, read_write> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec3<i32>(1i)
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_c98bf4(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_c98bf4
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_c98bf4(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_c98bf4
-    ret
-  }
+kernel void compute_main(texture3d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_c98bf4(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_c98bf4
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/c9b083.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/c9b083.wgsl.expected.ir.msl
index e65dae8..8c81ead 100644
--- a/test/tint/builtins/gen/literal/textureLoad/c9b083.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/c9b083.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<int, access::read_write> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba16sint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_c9b083(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(uint2(int2(1)), 1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_c9b083 = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<rgba16sint, read_write> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, vec2<i32>(1i), 1u
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_c9b083(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_c9b083
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_c9b083(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_c9b083
-    ret
-  }
+kernel void compute_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_c9b083(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_c9b083
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/c9cc40.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/c9cc40.wgsl.expected.ir.msl
index 5d85f55..3519354 100644
--- a/test/tint/builtins/gen/literal/textureLoad/c9cc40.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/c9cc40.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<int, access::read> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<rgba8sint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_c9cc40(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(uint(1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_c9cc40 = func():void {
-  $B2: {
-    %4:texture_storage_1d<rgba8sint, read> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, 1i
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_c9cc40(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_c9cc40
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_c9cc40(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_c9cc40
-    ret
-  }
+kernel void compute_main(texture1d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_c9cc40(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_c9cc40
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/c9f310.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/c9f310.wgsl.expected.ir.msl
index 856150f..8663ad7 100644
--- a/test/tint/builtins/gen/literal/textureLoad/c9f310.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/c9f310.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<int, access::read_write> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<r32sint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_c9f310(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(uint(1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_c9f310 = func():void {
-  $B2: {
-    %4:texture_storage_1d<r32sint, read_write> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, 1i
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_c9f310(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_c9f310
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_c9f310(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_c9f310
-    ret
-  }
+kernel void compute_main(texture1d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_c9f310(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_c9f310
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/cac876.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/cac876.wgsl.expected.ir.msl
index 188b447..49e9dab 100644
--- a/test/tint/builtins/gen/literal/textureLoad/cac876.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/cac876.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<int, access::read_write> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<rgba32sint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_cac876(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_cac876 = func():void {
-  $B2: {
-    %4:texture_storage_1d<rgba32sint, read_write> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, 1u
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_cac876(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_cac876
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_cac876(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_cac876
-    ret
-  }
+kernel void compute_main(texture1d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_cac876(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_cac876
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/cad5f2.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/cad5f2.wgsl.expected.ir.msl
index 8d8e06b..f1227e5 100644
--- a/test/tint/builtins/gen/literal/textureLoad/cad5f2.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/cad5f2.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_ms<uint, access::read> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_multisampled_2d<u32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_cad5f2(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(uint2(int2(1)), 1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_cad5f2 = func():void {
-  $B2: {
-    %4:texture_multisampled_2d<u32> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, vec2<i32>(1i), 1u
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_cad5f2(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_cad5f2
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_ms<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_cad5f2(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_cad5f2
-    ret
-  }
+kernel void compute_main(texture2d_ms<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_cad5f2(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_cad5f2
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_ms<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/cb57c2.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/cb57c2.wgsl.expected.ir.msl
index b1193d3..bb94de3 100644
--- a/test/tint/builtins/gen/literal/textureLoad/cb57c2.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/cb57c2.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  depth2d_array<float, access::sample> arg_0;
+  device float* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_depth_2d_array, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, f32, read_write> = var @binding_point(2, 0)
+void textureLoad_cb57c2(tint_module_vars_struct tint_module_vars) {
+  float res = tint_module_vars.arg_0.read(uint2(1u), 1u, 1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_cb57c2 = func():void {
-  $B2: {
-    %4:texture_depth_2d_array = load %arg_0
-    %5:f32 = textureLoad %4, vec2<u32>(1u), 1u, 1i
-    %res:ptr<function, f32, read_write> = var, %5
-    %7:f32 = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_cb57c2(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_cb57c2
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(depth2d_array<float, access::sample> arg_0 [[texture(0)]], device float* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_cb57c2(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_cb57c2
-    ret
-  }
+kernel void compute_main(depth2d_array<float, access::sample> arg_0 [[texture(0)]], device float* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_cb57c2(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_cb57c2
-    ret
-  }
+vertex vertex_main_outputs vertex_main(depth2d_array<float, access::sample> arg_0 [[texture(0)]], device float* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/cdbcf6.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/cdbcf6.wgsl.expected.ir.msl
index c5bd0d6..4cb3275 100644
--- a/test/tint/builtins/gen/literal/textureLoad/cdbcf6.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/cdbcf6.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba8snorm, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_cdbcf6(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint2(1u), 1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_cdbcf6 = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<rgba8snorm, read_write> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec2<u32>(1u), 1u
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_cdbcf6(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_cdbcf6
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_cdbcf6(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_cdbcf6
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_cdbcf6(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_cdbcf6
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/cdccd2.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/cdccd2.wgsl.expected.ir.msl
index bc35718..3d481f6 100644
--- a/test/tint/builtins/gen/literal/textureLoad/cdccd2.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/cdccd2.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<uint, access::read_write> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rg32uint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_cdccd2(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(uint2(int2(1)), 1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_cdccd2 = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<rg32uint, read_write> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, vec2<i32>(1i), 1u
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_cdccd2(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_cdccd2
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_cdccd2(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_cdccd2
-    ret
-  }
+kernel void compute_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_cdccd2(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_cdccd2
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/cdd343.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/cdd343.wgsl.expected.ir.msl
index ad5237a..046c14c 100644
--- a/test/tint/builtins/gen/literal/textureLoad/cdd343.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/cdd343.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<uint, access::read> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba32uint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_cdd343(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(uint2(int2(1)), 1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_cdd343 = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<rgba32uint, read> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, vec2<i32>(1i), 1u
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_cdd343(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_cdd343
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_cdd343(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_cdd343
-    ret
-  }
+kernel void compute_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_cdd343(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_cdd343
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/cddf6b.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/cddf6b.wgsl.expected.ir.msl
index 4dad871..31ace54 100644
--- a/test/tint/builtins/gen/literal/textureLoad/cddf6b.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/cddf6b.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<rgba8unorm, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_cddf6b(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint2(1u));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_cddf6b = func():void {
-  $B2: {
-    %4:texture_storage_2d<rgba8unorm, read_write> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec2<u32>(1u)
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_cddf6b(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_cddf6b
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_cddf6b(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_cddf6b
-    ret
-  }
+kernel void compute_main(texture2d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_cddf6b(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_cddf6b
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/cec477.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/cec477.wgsl.expected.ir.msl
index e971bf5..07c02f5 100644
--- a/test/tint/builtins/gen/literal/textureLoad/cec477.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/cec477.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<int, access::read_write> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<r32sint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_cec477(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(uint3(1u));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_cec477 = func():void {
-  $B2: {
-    %4:texture_storage_3d<r32sint, read_write> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, vec3<u32>(1u)
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_cec477(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_cec477
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_cec477(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_cec477
-    ret
-  }
+kernel void compute_main(texture3d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_cec477(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_cec477
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/cece6c.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/cece6c.wgsl.expected.ir.msl
index aa36909..79a62cd 100644
--- a/test/tint/builtins/gen/literal/textureLoad/cece6c.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/cece6c.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<r8unorm, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_cece6c(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint3(int3(1)));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_cece6c = func():void {
-  $B2: {
-    %4:texture_storage_3d<r8unorm, read> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec3<i32>(1i)
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_cece6c(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_cece6c
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_cece6c(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_cece6c
-    ret
-  }
+kernel void compute_main(texture3d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_cece6c(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_cece6c
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/d02afc.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/d02afc.wgsl.expected.ir.msl
index 2fb613e..d137662 100644
--- a/test/tint/builtins/gen/literal/textureLoad/d02afc.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/d02afc.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<int, access::read> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<rgba32sint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_d02afc(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(uint3(1u));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_d02afc = func():void {
-  $B2: {
-    %4:texture_storage_3d<rgba32sint, read> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, vec3<u32>(1u)
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_d02afc(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_d02afc
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_d02afc(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_d02afc
-    ret
-  }
+kernel void compute_main(texture3d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_d02afc(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_d02afc
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/d0e351.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/d0e351.wgsl.expected.ir.msl
index a2bc7ae..aea41f6 100644
--- a/test/tint/builtins/gen/literal/textureLoad/d0e351.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/d0e351.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<uint, access::read_write> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rg32uint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_d0e351(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(uint2(1u), 1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_d0e351 = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<rg32uint, read_write> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, vec2<u32>(1u), 1i
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_d0e351(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_d0e351
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_d0e351(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_d0e351
-    ret
-  }
+kernel void compute_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_d0e351(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_d0e351
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/d357bb.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/d357bb.wgsl.expected.ir.msl
index 1457236..c06a664 100644
--- a/test/tint/builtins/gen/literal/textureLoad/d357bb.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/d357bb.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<bgra8unorm, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_d357bb(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint(1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_d357bb = func():void {
-  $B2: {
-    %4:texture_storage_1d<bgra8unorm, read> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, 1i
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_d357bb(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_d357bb
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_d357bb(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_d357bb
-    ret
-  }
+kernel void compute_main(texture1d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_d357bb(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_d357bb
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/d37a08.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/d37a08.wgsl.expected.ir.msl
index ccebd7a..75a637b 100644
--- a/test/tint/builtins/gen/literal/textureLoad/d37a08.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/d37a08.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<uint, access::read_write> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba8uint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_d37a08(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(uint2(int2(1)), 1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_d37a08 = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<rgba8uint, read_write> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, vec2<i32>(1i), 1u
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_d37a08(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_d37a08
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_d37a08(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_d37a08
-    ret
-  }
+kernel void compute_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_d37a08(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_d37a08
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/d3d8fc.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/d3d8fc.wgsl.expected.ir.msl
index 5379dc2..7ef6d20 100644
--- a/test/tint/builtins/gen/literal/textureLoad/d3d8fc.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/d3d8fc.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<int, access::read_write> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba16sint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_d3d8fc(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(uint2(1u), 1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_d3d8fc = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<rgba16sint, read_write> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, vec2<u32>(1u), 1i
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_d3d8fc(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_d3d8fc
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_d3d8fc(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_d3d8fc
-    ret
-  }
+kernel void compute_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_d3d8fc(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_d3d8fc
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/d41c72.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/d41c72.wgsl.expected.ir.msl
index 0a2ec03..f776fef 100644
--- a/test/tint/builtins/gen/literal/textureLoad/d41c72.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/d41c72.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<int, access::read_write> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<rg32sint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_d41c72(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(uint3(int3(1)));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_d41c72 = func():void {
-  $B2: {
-    %4:texture_storage_3d<rg32sint, read_write> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, vec3<i32>(1i)
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_d41c72(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_d41c72
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_d41c72(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_d41c72
-    ret
-  }
+kernel void compute_main(texture3d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_d41c72(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_d41c72
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/d4df19.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/d4df19.wgsl.expected.ir.msl
index bf6cd20..8f73798 100644
--- a/test/tint/builtins/gen/literal/textureLoad/d4df19.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/d4df19.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<uint, access::read> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<r32uint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_d4df19(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(uint2(1u));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_d4df19 = func():void {
-  $B2: {
-    %4:texture_storage_2d<r32uint, read> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, vec2<u32>(1u)
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_d4df19(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_d4df19
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_d4df19(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_d4df19
-    ret
-  }
+kernel void compute_main(texture2d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_d4df19(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_d4df19
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/d5c48d.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/d5c48d.wgsl.expected.ir.msl
index 767876e..a2886e3 100644
--- a/test/tint/builtins/gen/literal/textureLoad/d5c48d.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/d5c48d.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<rgba32float, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_d5c48d(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint2(int2(1)));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_d5c48d = func():void {
-  $B2: {
-    %4:texture_storage_2d<rgba32float, read> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec2<i32>(1i)
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_d5c48d(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_d5c48d
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_d5c48d(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_d5c48d
-    ret
-  }
+kernel void compute_main(texture2d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_d5c48d(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_d5c48d
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/d72de9.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/d72de9.wgsl.expected.ir.msl
index 540687a..c204ea6 100644
--- a/test/tint/builtins/gen/literal/textureLoad/d72de9.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/d72de9.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<int, access::read_write> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<rgba8sint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_d72de9(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(uint2(int2(1)));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_d72de9 = func():void {
-  $B2: {
-    %4:texture_storage_2d<rgba8sint, read_write> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, vec2<i32>(1i)
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_d72de9(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_d72de9
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_d72de9(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_d72de9
-    ret
-  }
+kernel void compute_main(texture2d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_d72de9(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_d72de9
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/d7996a.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/d7996a.wgsl.expected.ir.msl
index 0b38564..5c17d90f 100644
--- a/test/tint/builtins/gen/literal/textureLoad/d7996a.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/d7996a.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<int, access::read_write> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<rgba32sint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_d7996a(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(uint3(int3(1)));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_d7996a = func():void {
-  $B2: {
-    %4:texture_storage_3d<rgba32sint, read_write> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, vec3<i32>(1i)
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_d7996a(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_d7996a
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_d7996a(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_d7996a
-    ret
-  }
+kernel void compute_main(texture3d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_d7996a(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_d7996a
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/d79c5c.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/d79c5c.wgsl.expected.ir.msl
index a01bb0c..9ace9b4 100644
--- a/test/tint/builtins/gen/literal/textureLoad/d79c5c.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/d79c5c.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<uint, access::read_write> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<rgba16uint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_d79c5c(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(uint(1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_d79c5c = func():void {
-  $B2: {
-    %4:texture_storage_1d<rgba16uint, read_write> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, 1i
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_d79c5c(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_d79c5c
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_d79c5c(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_d79c5c
-    ret
-  }
+kernel void compute_main(texture1d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_d79c5c(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_d79c5c
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/d80ff3.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/d80ff3.wgsl.expected.ir.msl
index 7b06dc3..ab57282 100644
--- a/test/tint/builtins/gen/literal/textureLoad/d80ff3.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/d80ff3.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<bgra8unorm, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_d80ff3(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint(1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_d80ff3 = func():void {
-  $B2: {
-    %4:texture_storage_1d<bgra8unorm, read_write> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, 1i
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_d80ff3(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_d80ff3
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_d80ff3(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_d80ff3
-    ret
-  }
+kernel void compute_main(texture1d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_d80ff3(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_d80ff3
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/d81c57.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/d81c57.wgsl.expected.ir.msl
index 4bdb5e5..56043f0 100644
--- a/test/tint/builtins/gen/literal/textureLoad/d81c57.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/d81c57.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<rg32float, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_d81c57(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint(1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_d81c57 = func():void {
-  $B2: {
-    %4:texture_storage_1d<rg32float, read> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, 1i
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_d81c57(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_d81c57
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_d81c57(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_d81c57
-    ret
-  }
+kernel void compute_main(texture1d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_d81c57(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_d81c57
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/d85d61.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/d85d61.wgsl.expected.ir.msl
index 37e2b6f..f90320b 100644
--- a/test/tint/builtins/gen/literal/textureLoad/d85d61.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/d85d61.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<uint, access::read> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<rgba32uint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_d85d61(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(uint2(1u));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_d85d61 = func():void {
-  $B2: {
-    %4:texture_storage_2d<rgba32uint, read> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, vec2<u32>(1u)
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_d85d61(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_d85d61
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_d85d61(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_d85d61
-    ret
-  }
+kernel void compute_main(texture2d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_d85d61(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_d85d61
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/d8617f.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/d8617f.wgsl.expected.ir.msl
index 3f12b50..d108495 100644
--- a/test/tint/builtins/gen/literal/textureLoad/d8617f.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/d8617f.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<int, access::read> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rg32sint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_d8617f(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(uint2(int2(1)), 1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_d8617f = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<rg32sint, read> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, vec2<i32>(1i), 1i
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_d8617f(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_d8617f
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_d8617f(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_d8617f
-    ret
-  }
+kernel void compute_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_d8617f(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_d8617f
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/d8be5a.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/d8be5a.wgsl.expected.ir.msl
index dd3a098..df9e924 100644
--- a/test/tint/builtins/gen/literal/textureLoad/d8be5a.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/d8be5a.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<int, access::read_write> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<rgba16sint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_d8be5a(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(uint(1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_d8be5a = func():void {
-  $B2: {
-    %4:texture_storage_1d<rgba16sint, read_write> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, 1i
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_d8be5a(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_d8be5a
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_d8be5a(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_d8be5a
-    ret
-  }
+kernel void compute_main(texture1d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_d8be5a(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_d8be5a
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/d91f37.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/d91f37.wgsl.expected.ir.msl
index 396bd95..fcf01ad 100644
--- a/test/tint/builtins/gen/literal/textureLoad/d91f37.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/d91f37.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba8unorm, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_d91f37(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint2(int2(1)), 1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_d91f37 = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<rgba8unorm, read_write> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec2<i32>(1i), 1u
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_d91f37(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_d91f37
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_d91f37(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_d91f37
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_d91f37(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_d91f37
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/dab04f.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/dab04f.wgsl.expected.ir.msl
index 5b2f066..296b91e 100644
--- a/test/tint/builtins/gen/literal/textureLoad/dab04f.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/dab04f.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<bgra8unorm, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_dab04f(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint2(int2(1)), 1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_dab04f = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<bgra8unorm, read_write> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec2<i32>(1i), 1i
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_dab04f(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_dab04f
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_dab04f(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_dab04f
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_dab04f(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_dab04f
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/dbd554.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/dbd554.wgsl.expected.ir.msl
index aafc6e0..b78178d 100644
--- a/test/tint/builtins/gen/literal/textureLoad/dbd554.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/dbd554.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<int, access::read> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<rgba32sint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_dbd554(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(uint2(int2(1)));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_dbd554 = func():void {
-  $B2: {
-    %4:texture_storage_2d<rgba32sint, read> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, vec2<i32>(1i)
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_dbd554(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_dbd554
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_dbd554(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_dbd554
-    ret
-  }
+kernel void compute_main(texture2d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_dbd554(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_dbd554
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/dd5859.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/dd5859.wgsl.expected.ir.msl
index ccc0163..25e7e80 100644
--- a/test/tint/builtins/gen/literal/textureLoad/dd5859.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/dd5859.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba16float, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_dd5859(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint2(int2(1)), 1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_dd5859 = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<rgba16float, read_write> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec2<i32>(1i), 1i
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_dd5859(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_dd5859
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_dd5859(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_dd5859
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_dd5859(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_dd5859
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/dd8776.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/dd8776.wgsl.expected.ir.msl
index a5f48ba..52e3ce8 100644
--- a/test/tint/builtins/gen/literal/textureLoad/dd8776.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/dd8776.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rg32float, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_dd8776(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint2(1u), 1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_dd8776 = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<rg32float, read> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec2<u32>(1u), 1u
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_dd8776(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_dd8776
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_dd8776(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_dd8776
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_dd8776(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_dd8776
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/ddeed3.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/ddeed3.wgsl.expected.ir.msl
index c5e4e5f..ef93ac6 100644
--- a/test/tint/builtins/gen/literal/textureLoad/ddeed3.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/ddeed3.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<int, access::read> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<rgba32sint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_ddeed3(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(uint(1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_ddeed3 = func():void {
-  $B2: {
-    %4:texture_storage_1d<rgba32sint, read> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, 1i
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_ddeed3(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_ddeed3
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_ddeed3(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_ddeed3
-    ret
-  }
+kernel void compute_main(texture1d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_ddeed3(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_ddeed3
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/de5a0e.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/de5a0e.wgsl.expected.ir.msl
index f49ee54..407ce56 100644
--- a/test/tint/builtins/gen/literal/textureLoad/de5a0e.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/de5a0e.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<int, access::read_write> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba8sint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_de5a0e(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(uint2(1u), 1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_de5a0e = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<rgba8sint, read_write> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, vec2<u32>(1u), 1u
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_de5a0e(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_de5a0e
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_de5a0e(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_de5a0e
-    ret
-  }
+kernel void compute_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_de5a0e(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_de5a0e
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/dee8e7.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/dee8e7.wgsl.expected.ir.msl
index f45d679..e11e4f8 100644
--- a/test/tint/builtins/gen/literal/textureLoad/dee8e7.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/dee8e7.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<int, access::read> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<rgba8sint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_dee8e7(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(uint2(int2(1)));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_dee8e7 = func():void {
-  $B2: {
-    %4:texture_storage_2d<rgba8sint, read> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, vec2<i32>(1i)
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_dee8e7(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_dee8e7
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_dee8e7(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_dee8e7
-    ret
-  }
+kernel void compute_main(texture2d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_dee8e7(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_dee8e7
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/defd9a.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/defd9a.wgsl.expected.ir.msl
index 7c0ffca..0fdebf8 100644
--- a/test/tint/builtins/gen/literal/textureLoad/defd9a.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/defd9a.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<rg32float, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_defd9a(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint2(int2(1)));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_defd9a = func():void {
-  $B2: {
-    %4:texture_storage_2d<rg32float, read_write> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec2<i32>(1i)
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_defd9a(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_defd9a
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_defd9a(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_defd9a
-    ret
-  }
+kernel void compute_main(texture2d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_defd9a(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_defd9a
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/dfdf3b.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/dfdf3b.wgsl.expected.ir.msl
index 78dd06f..295156c 100644
--- a/test/tint/builtins/gen/literal/textureLoad/dfdf3b.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/dfdf3b.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<int, access::read> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba8sint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_dfdf3b(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(uint2(1u), 1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_dfdf3b = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<rgba8sint, read> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, vec2<u32>(1u), 1u
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_dfdf3b(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_dfdf3b
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_dfdf3b(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_dfdf3b
-    ret
-  }
+kernel void compute_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_dfdf3b(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_dfdf3b
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/e1c3cf.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/e1c3cf.wgsl.expected.ir.msl
index 42c883d..f2a39a1 100644
--- a/test/tint/builtins/gen/literal/textureLoad/e1c3cf.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/e1c3cf.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<rgba16float, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_e1c3cf(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint2(int2(1)));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_e1c3cf = func():void {
-  $B2: {
-    %4:texture_storage_2d<rgba16float, read_write> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec2<i32>(1i)
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_e1c3cf(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_e1c3cf
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_e1c3cf(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_e1c3cf
-    ret
-  }
+kernel void compute_main(texture2d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_e1c3cf(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_e1c3cf
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/e2292f.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/e2292f.wgsl.expected.ir.msl
index 1b105c1..a7b07e7 100644
--- a/test/tint/builtins/gen/literal/textureLoad/e2292f.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/e2292f.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<int, access::read> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<r32sint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_e2292f(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_e2292f = func():void {
-  $B2: {
-    %4:texture_storage_1d<r32sint, read> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, 1u
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_e2292f(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_e2292f
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_e2292f(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_e2292f
-    ret
-  }
+kernel void compute_main(texture1d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_e2292f(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_e2292f
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/e2b3a1.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/e2b3a1.wgsl.expected.ir.msl
index efeb5df..532ad98 100644
--- a/test/tint/builtins/gen/literal/textureLoad/e2b3a1.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/e2b3a1.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<int, access::read_write> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rg32sint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_e2b3a1(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(uint2(1u), 1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_e2b3a1 = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<rg32sint, read_write> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, vec2<u32>(1u), 1i
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_e2b3a1(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_e2b3a1
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_e2b3a1(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_e2b3a1
-    ret
-  }
+kernel void compute_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_e2b3a1(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_e2b3a1
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/e2d7da.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/e2d7da.wgsl.expected.ir.msl
index 743241e..af49402 100644
--- a/test/tint/builtins/gen/literal/textureLoad/e2d7da.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/e2d7da.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba16float, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_e2d7da(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint2(1u), 1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_e2d7da = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<rgba16float, read_write> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec2<u32>(1u), 1i
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_e2d7da(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_e2d7da
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_e2d7da(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_e2d7da
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_e2d7da(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_e2d7da
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/e33285.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/e33285.wgsl.expected.ir.msl
index 54efcbf..c1f24d5 100644
--- a/test/tint/builtins/gen/literal/textureLoad/e33285.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/e33285.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<int, access::read_write> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<rgba16sint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_e33285(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(uint2(int2(1)));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_e33285 = func():void {
-  $B2: {
-    %4:texture_storage_2d<rgba16sint, read_write> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, vec2<i32>(1i)
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_e33285(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_e33285
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_e33285(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_e33285
-    ret
-  }
+kernel void compute_main(texture2d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_e33285(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_e33285
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/e35f72.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/e35f72.wgsl.expected.ir.msl
index 92376e7..ebc10c7 100644
--- a/test/tint/builtins/gen/literal/textureLoad/e35f72.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/e35f72.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<int, access::sample> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_3d<i32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_e35f72(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(uint3(int3(1)), 1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_e35f72 = func():void {
-  $B2: {
-    %4:texture_3d<i32> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, vec3<i32>(1i), 1u
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_e35f72(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_e35f72
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_e35f72(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_e35f72
-    ret
-  }
+kernel void compute_main(texture3d<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_e35f72(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_e35f72
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/e3b08b.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/e3b08b.wgsl.expected.ir.msl
index 58d28bc..b2dd9c6 100644
--- a/test/tint/builtins/gen/literal/textureLoad/e3b08b.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/e3b08b.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<r32float, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_e3b08b(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint3(1u));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_e3b08b = func():void {
-  $B2: {
-    %4:texture_storage_3d<r32float, read> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec3<u32>(1u)
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_e3b08b(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_e3b08b
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_e3b08b(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_e3b08b
-    ret
-  }
+kernel void compute_main(texture3d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_e3b08b(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_e3b08b
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/e3d2cc.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/e3d2cc.wgsl.expected.ir.msl
index 616e1f7..d303dee 100644
--- a/test/tint/builtins/gen/literal/textureLoad/e3d2cc.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/e3d2cc.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_ms<int, access::read> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_multisampled_2d<i32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_e3d2cc(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(uint2(int2(1)), 1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_e3d2cc = func():void {
-  $B2: {
-    %4:texture_multisampled_2d<i32> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, vec2<i32>(1i), 1i
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_e3d2cc(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_e3d2cc
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_ms<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_e3d2cc(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_e3d2cc
-    ret
-  }
+kernel void compute_main(texture2d_ms<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_e3d2cc(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_e3d2cc
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_ms<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/e4051a.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/e4051a.wgsl.expected.ir.msl
index 3f9494e..2b7e2dc 100644
--- a/test/tint/builtins/gen/literal/textureLoad/e4051a.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/e4051a.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<r8unorm, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_e4051a(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint2(1u));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_e4051a = func():void {
-  $B2: {
-    %4:texture_storage_2d<r8unorm, read_write> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec2<u32>(1u)
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_e4051a(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_e4051a
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_e4051a(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_e4051a
-    ret
-  }
+kernel void compute_main(texture2d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_e4051a(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_e4051a
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/e57e92.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/e57e92.wgsl.expected.ir.msl
index 0d70e7a..a629896 100644
--- a/test/tint/builtins/gen/literal/textureLoad/e57e92.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/e57e92.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<bgra8unorm, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_e57e92(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint2(1u), 1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_e57e92 = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<bgra8unorm, read> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec2<u32>(1u), 1i
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_e57e92(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_e57e92
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_e57e92(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_e57e92
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_e57e92(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_e57e92
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/e59fdf.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/e59fdf.wgsl.expected.ir.msl
index ea988c2..797b627 100644
--- a/test/tint/builtins/gen/literal/textureLoad/e59fdf.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/e59fdf.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<uint, access::read> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<rg32uint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_e59fdf(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(uint3(1u));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_e59fdf = func():void {
-  $B2: {
-    %4:texture_storage_3d<rg32uint, read> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, vec3<u32>(1u)
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_e59fdf(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_e59fdf
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_e59fdf(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_e59fdf
-    ret
-  }
+kernel void compute_main(texture3d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_e59fdf(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_e59fdf
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/e65916.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/e65916.wgsl.expected.ir.msl
index df3e69d..ec632d4 100644
--- a/test/tint/builtins/gen/literal/textureLoad/e65916.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/e65916.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<int, access::read> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<rg32sint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_e65916(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(uint3(int3(1)));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_e65916 = func():void {
-  $B2: {
-    %4:texture_storage_3d<rg32sint, read> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, vec3<i32>(1i)
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_e65916(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_e65916
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_e65916(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_e65916
-    ret
-  }
+kernel void compute_main(texture3d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_e65916(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_e65916
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/e893d7.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/e893d7.wgsl.expected.ir.msl
index 90540ee..cd62929 100644
--- a/test/tint/builtins/gen/literal/textureLoad/e893d7.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/e893d7.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<rgba16float, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_e893d7(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint2(int2(1)));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_e893d7 = func():void {
-  $B2: {
-    %4:texture_storage_2d<rgba16float, read> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec2<i32>(1i)
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_e893d7(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_e893d7
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_e893d7(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_e893d7
-    ret
-  }
+kernel void compute_main(texture2d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_e893d7(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_e893d7
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/e92dd0.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/e92dd0.wgsl.expected.ir.msl
index a4343c6..8a6809d 100644
--- a/test/tint/builtins/gen/literal/textureLoad/e92dd0.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/e92dd0.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<rgba8unorm, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_e92dd0(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_e92dd0 = func():void {
-  $B2: {
-    %4:texture_storage_1d<rgba8unorm, read> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, 1u
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_e92dd0(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_e92dd0
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_e92dd0(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_e92dd0
-    ret
-  }
+kernel void compute_main(texture1d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_e92dd0(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_e92dd0
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/e9eb65.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/e9eb65.wgsl.expected.ir.msl
index 806832c..60008c6 100644
--- a/test/tint/builtins/gen/literal/textureLoad/e9eb65.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/e9eb65.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<uint, access::read_write> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba16uint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_e9eb65(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(uint2(1u), 1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_e9eb65 = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<rgba16uint, read_write> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, vec2<u32>(1u), 1i
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_e9eb65(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_e9eb65
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_e9eb65(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_e9eb65
-    ret
-  }
+kernel void compute_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_e9eb65(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_e9eb65
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/ea2abd.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/ea2abd.wgsl.expected.ir.msl
index 2d7fd7d..d3819f5 100644
--- a/test/tint/builtins/gen/literal/textureLoad/ea2abd.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/ea2abd.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<rgba32float, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_ea2abd(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint2(1u));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_ea2abd = func():void {
-  $B2: {
-    %4:texture_storage_2d<rgba32float, read> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec2<u32>(1u)
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_ea2abd(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_ea2abd
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_ea2abd(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_ea2abd
-    ret
-  }
+kernel void compute_main(texture2d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_ea2abd(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_ea2abd
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/eb573b.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/eb573b.wgsl.expected.ir.msl
index 9f5c0d6..f7eb810 100644
--- a/test/tint/builtins/gen/literal/textureLoad/eb573b.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/eb573b.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<int, access::read> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<r32sint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_eb573b(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(uint2(int2(1)));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_eb573b = func():void {
-  $B2: {
-    %4:texture_storage_2d<r32sint, read> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, vec2<i32>(1i)
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_eb573b(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_eb573b
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_eb573b(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_eb573b
-    ret
-  }
+kernel void compute_main(texture2d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_eb573b(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_eb573b
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/ebfb92.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/ebfb92.wgsl.expected.ir.msl
index 4b8f2de..9938300 100644
--- a/test/tint/builtins/gen/literal/textureLoad/ebfb92.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/ebfb92.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<uint, access::sample> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_2d<u32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_ebfb92(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(uint2(int2(1)), 1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_ebfb92 = func():void {
-  $B2: {
-    %4:texture_2d<u32> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, vec2<i32>(1i), 1u
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_ebfb92(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_ebfb92
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_ebfb92(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_ebfb92
-    ret
-  }
+kernel void compute_main(texture2d<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_ebfb92(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_ebfb92
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/ecc823.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/ecc823.wgsl.expected.ir.msl
index 67eb68e..478bb1f 100644
--- a/test/tint/builtins/gen/literal/textureLoad/ecc823.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/ecc823.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<uint, access::read> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<rgba16uint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_ecc823(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(uint2(int2(1)));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_ecc823 = func():void {
-  $B2: {
-    %4:texture_storage_2d<rgba16uint, read> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, vec2<i32>(1i)
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_ecc823(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_ecc823
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_ecc823(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_ecc823
-    ret
-  }
+kernel void compute_main(texture2d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_ecc823(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_ecc823
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/ed55a8.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/ed55a8.wgsl.expected.ir.msl
index 2ab426c..70ccf5b 100644
--- a/test/tint/builtins/gen/literal/textureLoad/ed55a8.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/ed55a8.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<int, access::read_write> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rg32sint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_ed55a8(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(uint2(int2(1)), 1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_ed55a8 = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<rg32sint, read_write> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, vec2<i32>(1i), 1u
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_ed55a8(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_ed55a8
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_ed55a8(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_ed55a8
-    ret
-  }
+kernel void compute_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_ed55a8(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_ed55a8
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/ee33c5.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/ee33c5.wgsl.expected.ir.msl
index 080a4fc..740b11a 100644
--- a/test/tint/builtins/gen/literal/textureLoad/ee33c5.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/ee33c5.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<int, access::read> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<rgba16sint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_ee33c5(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(uint3(1u));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_ee33c5 = func():void {
-  $B2: {
-    %4:texture_storage_3d<rgba16sint, read> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, vec3<u32>(1u)
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_ee33c5(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_ee33c5
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_ee33c5(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_ee33c5
-    ret
-  }
+kernel void compute_main(texture3d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_ee33c5(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_ee33c5
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/eecf7d.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/eecf7d.wgsl.expected.ir.msl
index b0412d9..258bbc3 100644
--- a/test/tint/builtins/gen/literal/textureLoad/eecf7d.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/eecf7d.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<uint, access::read> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rg32uint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_eecf7d(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(uint2(int2(1)), 1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_eecf7d = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<rg32uint, read> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, vec2<i32>(1i), 1u
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_eecf7d(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_eecf7d
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_eecf7d(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_eecf7d
-    ret
-  }
+kernel void compute_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_eecf7d(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_eecf7d
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/ef2ec3.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/ef2ec3.wgsl.expected.ir.msl
index e392cd0..3cd0202 100644
--- a/test/tint/builtins/gen/literal/textureLoad/ef2ec3.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/ef2ec3.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<int, access::read_write> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<rg32sint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_ef2ec3(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_ef2ec3 = func():void {
-  $B2: {
-    %4:texture_storage_1d<rg32sint, read_write> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, 1u
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_ef2ec3(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_ef2ec3
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_ef2ec3(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_ef2ec3
-    ret
-  }
+kernel void compute_main(texture1d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_ef2ec3(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_ef2ec3
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/ef5405.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/ef5405.wgsl.expected.ir.msl
index e5fdbef..742495d 100644
--- a/test/tint/builtins/gen/literal/textureLoad/ef5405.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/ef5405.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<uint, access::read> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<rg32uint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_ef5405(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(uint3(int3(1)));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_ef5405 = func():void {
-  $B2: {
-    %4:texture_storage_3d<rg32uint, read> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, vec3<i32>(1i)
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_ef5405(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_ef5405
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_ef5405(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_ef5405
-    ret
-  }
+kernel void compute_main(texture3d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_ef5405(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_ef5405
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/efa787.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/efa787.wgsl.expected.ir.msl
index 75cd72d..e9e727a 100644
--- a/test/tint/builtins/gen/literal/textureLoad/efa787.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/efa787.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba8unorm, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_efa787(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint2(1u), 1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_efa787 = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<rgba8unorm, read> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec2<u32>(1u), 1u
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_efa787(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_efa787
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_efa787(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_efa787
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_efa787(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_efa787
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/f0514a.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/f0514a.wgsl.expected.ir.msl
index f189ff2..ef6ac53 100644
--- a/test/tint/builtins/gen/literal/textureLoad/f0514a.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/f0514a.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<rgba32float, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_f0514a(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint(1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_f0514a = func():void {
-  $B2: {
-    %4:texture_storage_1d<rgba32float, read_write> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, 1i
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_f0514a(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_f0514a
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_f0514a(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_f0514a
-    ret
-  }
+kernel void compute_main(texture1d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_f0514a(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_f0514a
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/f06b69.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/f06b69.wgsl.expected.ir.msl
index 2d7ef74..f8f78a0 100644
--- a/test/tint/builtins/gen/literal/textureLoad/f06b69.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/f06b69.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<int, access::read> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<r32sint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_f06b69(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(uint(1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_f06b69 = func():void {
-  $B2: {
-    %4:texture_storage_1d<r32sint, read> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, 1i
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_f06b69(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_f06b69
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_f06b69(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_f06b69
-    ret
-  }
+kernel void compute_main(texture1d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_f06b69(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_f06b69
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/f0abad.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/f0abad.wgsl.expected.ir.msl
index 37273b2..eebbb54 100644
--- a/test/tint/builtins/gen/literal/textureLoad/f0abad.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/f0abad.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_ms<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_multisampled_2d<f32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_f0abad(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint2(1u), 1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_f0abad = func():void {
-  $B2: {
-    %4:texture_multisampled_2d<f32> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec2<u32>(1u), 1i
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_f0abad(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_f0abad
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_ms<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_f0abad(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_f0abad
-    ret
-  }
+kernel void compute_main(texture2d_ms<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_f0abad(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_f0abad
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_ms<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/f1c549.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/f1c549.wgsl.expected.ir.msl
index 5c82944..e7c42da 100644
--- a/test/tint/builtins/gen/literal/textureLoad/f1c549.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/f1c549.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<r32float, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_f1c549(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint3(int3(1)));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_f1c549 = func():void {
-  $B2: {
-    %4:texture_storage_3d<r32float, read_write> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec3<i32>(1i)
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_f1c549(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_f1c549
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_f1c549(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_f1c549
-    ret
-  }
+kernel void compute_main(texture3d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_f1c549(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_f1c549
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/f2a7ff.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/f2a7ff.wgsl.expected.ir.msl
index 9d7184e..4220f9d 100644
--- a/test/tint/builtins/gen/literal/textureLoad/f2a7ff.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/f2a7ff.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<rgba8unorm, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_f2a7ff(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint2(1u));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_f2a7ff = func():void {
-  $B2: {
-    %4:texture_storage_2d<rgba8unorm, read> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec2<u32>(1u)
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_f2a7ff(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_f2a7ff
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_f2a7ff(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_f2a7ff
-    ret
-  }
+kernel void compute_main(texture2d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_f2a7ff(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_f2a7ff
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/f2bdd4.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/f2bdd4.wgsl.expected.ir.msl
index 3844916..f982b20 100644
--- a/test/tint/builtins/gen/literal/textureLoad/f2bdd4.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/f2bdd4.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<r8unorm, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_f2bdd4(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint2(1u), 1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_f2bdd4 = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<r8unorm, read_write> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec2<u32>(1u), 1u
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_f2bdd4(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_f2bdd4
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_f2bdd4(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_f2bdd4
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_f2bdd4(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_f2bdd4
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/f2c311.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/f2c311.wgsl.expected.ir.msl
index 1d79e03..56f874d 100644
--- a/test/tint/builtins/gen/literal/textureLoad/f2c311.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/f2c311.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<int, access::read_write> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba8sint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_f2c311(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(uint2(int2(1)), 1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_f2c311 = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<rgba8sint, read_write> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, vec2<i32>(1i), 1i
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_f2c311(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_f2c311
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_f2c311(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_f2c311
-    ret
-  }
+kernel void compute_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_f2c311(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_f2c311
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/f348d9.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/f348d9.wgsl.expected.ir.msl
index 9355c5d..546c9b2 100644
--- a/test/tint/builtins/gen/literal/textureLoad/f348d9.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/f348d9.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::sample> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_2d_array<f32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_f348d9(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint2(1u), 1u, 1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_f348d9 = func():void {
-  $B2: {
-    %4:texture_2d_array<f32> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec2<u32>(1u), 1u, 1i
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_f348d9(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_f348d9
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_f348d9(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_f348d9
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_f348d9(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_f348d9
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/f35ac7.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/f35ac7.wgsl.expected.ir.msl
index 6176b1e..2d06635 100644
--- a/test/tint/builtins/gen/literal/textureLoad/f35ac7.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/f35ac7.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<int, access::read> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<rgba8sint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_f35ac7(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_f35ac7 = func():void {
-  $B2: {
-    %4:texture_storage_1d<rgba8sint, read> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, 1u
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_f35ac7(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_f35ac7
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_f35ac7(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_f35ac7
-    ret
-  }
+kernel void compute_main(texture1d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_f35ac7(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_f35ac7
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/f379e2.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/f379e2.wgsl.expected.ir.msl
index 276cdb5..f5e67d6 100644
--- a/test/tint/builtins/gen/literal/textureLoad/f379e2.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/f379e2.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba8unorm, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_f379e2(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint2(int2(1)), 1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_f379e2 = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<rgba8unorm, read> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec2<i32>(1i), 1i
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_f379e2(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_f379e2
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_f379e2(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_f379e2
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_f379e2(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_f379e2
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/f56e6f.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/f56e6f.wgsl.expected.ir.msl
index e91d6df..6e29819 100644
--- a/test/tint/builtins/gen/literal/textureLoad/f56e6f.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/f56e6f.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<uint, access::read> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<rgba16uint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_f56e6f(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(uint3(int3(1)));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_f56e6f = func():void {
-  $B2: {
-    %4:texture_storage_3d<rgba16uint, read> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, vec3<i32>(1i)
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_f56e6f(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_f56e6f
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_f56e6f(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_f56e6f
-    ret
-  }
+kernel void compute_main(texture3d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_f56e6f(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_f56e6f
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/f5aee2.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/f5aee2.wgsl.expected.ir.msl
index 9b87695..f52770b 100644
--- a/test/tint/builtins/gen/literal/textureLoad/f5aee2.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/f5aee2.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<r8unorm, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_f5aee2(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint2(1u));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_f5aee2 = func():void {
-  $B2: {
-    %4:texture_storage_2d<r8unorm, read> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec2<u32>(1u)
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_f5aee2(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_f5aee2
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_f5aee2(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_f5aee2
-    ret
-  }
+kernel void compute_main(texture2d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_f5aee2(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_f5aee2
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/f5fbc6.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/f5fbc6.wgsl.expected.ir.msl
index e26d4e5..82bcda5 100644
--- a/test/tint/builtins/gen/literal/textureLoad/f5fbc6.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/f5fbc6.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba8snorm, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_f5fbc6(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint2(int2(1)), 1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_f5fbc6 = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<rgba8snorm, read_write> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec2<i32>(1i), 1i
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_f5fbc6(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_f5fbc6
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_f5fbc6(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_f5fbc6
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_f5fbc6(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_f5fbc6
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/f74bd8.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/f74bd8.wgsl.expected.ir.msl
index 32029de..6efcbe4 100644
--- a/test/tint/builtins/gen/literal/textureLoad/f74bd8.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/f74bd8.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<rg32float, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_f74bd8(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint3(int3(1)));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_f74bd8 = func():void {
-  $B2: {
-    %4:texture_storage_3d<rg32float, read> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec3<i32>(1i)
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_f74bd8(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_f74bd8
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_f74bd8(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_f74bd8
-    ret
-  }
+kernel void compute_main(texture3d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_f74bd8(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_f74bd8
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/f7f3bc.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/f7f3bc.wgsl.expected.ir.msl
index 52f24e1..71c9661 100644
--- a/test/tint/builtins/gen/literal/textureLoad/f7f3bc.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/f7f3bc.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<rgba8snorm, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_f7f3bc(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint(1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_f7f3bc = func():void {
-  $B2: {
-    %4:texture_storage_1d<rgba8snorm, read_write> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, 1i
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_f7f3bc(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_f7f3bc
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_f7f3bc(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_f7f3bc
-    ret
-  }
+kernel void compute_main(texture1d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_f7f3bc(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_f7f3bc
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/f7f936.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/f7f936.wgsl.expected.ir.msl
index 432d1a0..c0d8ac2 100644
--- a/test/tint/builtins/gen/literal/textureLoad/f7f936.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/f7f936.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba8snorm, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_f7f936(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint2(1u), 1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_f7f936 = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<rgba8snorm, read> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec2<u32>(1u), 1u
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_f7f936(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_f7f936
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_f7f936(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_f7f936
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_f7f936(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_f7f936
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/f81792.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/f81792.wgsl.expected.ir.msl
index 3aecc6e..6002e5c 100644
--- a/test/tint/builtins/gen/literal/textureLoad/f81792.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/f81792.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<r32float, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_f81792(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint2(int2(1)), 1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_f81792 = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<r32float, read_write> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec2<i32>(1i), 1i
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_f81792(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_f81792
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_f81792(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_f81792
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_f81792(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_f81792
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/f82eb2.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/f82eb2.wgsl.expected.ir.msl
index ef5fea6..34146a9 100644
--- a/test/tint/builtins/gen/literal/textureLoad/f82eb2.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/f82eb2.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<rgba32float, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_f82eb2(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_f82eb2 = func():void {
-  $B2: {
-    %4:texture_storage_1d<rgba32float, read_write> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, 1u
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_f82eb2(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_f82eb2
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_f82eb2(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_f82eb2
-    ret
-  }
+kernel void compute_main(texture1d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_f82eb2(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_f82eb2
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/f85291.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/f85291.wgsl.expected.ir.msl
index 1d42ef5..33a7ba3 100644
--- a/test/tint/builtins/gen/literal/textureLoad/f85291.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/f85291.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<int, access::sample> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_2d<i32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_f85291(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(uint2(int2(1)), 1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_f85291 = func():void {
-  $B2: {
-    %4:texture_2d<i32> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, vec2<i32>(1i), 1u
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_f85291(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_f85291
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_f85291(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_f85291
-    ret
-  }
+kernel void compute_main(texture2d<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_f85291(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_f85291
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/f8a2e8.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/f8a2e8.wgsl.expected.ir.msl
index cb691af..1ff00e5 100644
--- a/test/tint/builtins/gen/literal/textureLoad/f8a2e8.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/f8a2e8.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<bgra8unorm, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_f8a2e8(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint3(int3(1)));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_f8a2e8 = func():void {
-  $B2: {
-    %4:texture_storage_3d<bgra8unorm, read> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec3<i32>(1i)
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_f8a2e8(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_f8a2e8
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_f8a2e8(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_f8a2e8
-    ret
-  }
+kernel void compute_main(texture3d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_f8a2e8(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_f8a2e8
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/f92c2d.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/f92c2d.wgsl.expected.ir.msl
index 0f784ff..c9433d8 100644
--- a/test/tint/builtins/gen/literal/textureLoad/f92c2d.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/f92c2d.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<r32float, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_f92c2d(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint2(int2(1)));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_f92c2d = func():void {
-  $B2: {
-    %4:texture_storage_2d<r32float, read_write> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec2<i32>(1i)
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_f92c2d(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_f92c2d
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_f92c2d(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_f92c2d
-    ret
-  }
+kernel void compute_main(texture2d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_f92c2d(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_f92c2d
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/f9eaaf.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/f9eaaf.wgsl.expected.ir.msl
index 68e0e77..2fb6cf7 100644
--- a/test/tint/builtins/gen/literal/textureLoad/f9eaaf.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/f9eaaf.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<int, access::read> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<rgba16sint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_f9eaaf(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_f9eaaf = func():void {
-  $B2: {
-    %4:texture_storage_1d<rgba16sint, read> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, 1u
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_f9eaaf(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_f9eaaf
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_f9eaaf(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_f9eaaf
-    ret
-  }
+kernel void compute_main(texture1d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_f9eaaf(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_f9eaaf
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/fc47ff.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/fc47ff.wgsl.expected.ir.msl
index 2e53fa3..15b2c17 100644
--- a/test/tint/builtins/gen/literal/textureLoad/fc47ff.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/fc47ff.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<int, access::read_write> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<rgba8sint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_fc47ff(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(uint2(1u));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_fc47ff = func():void {
-  $B2: {
-    %4:texture_storage_2d<rgba8sint, read_write> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, vec2<u32>(1u)
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_fc47ff(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_fc47ff
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_fc47ff(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_fc47ff
-    ret
-  }
+kernel void compute_main(texture2d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_fc47ff(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_fc47ff
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/fc6d36.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/fc6d36.wgsl.expected.ir.msl
index bfc353e..d9fe599 100644
--- a/test/tint/builtins/gen/literal/textureLoad/fc6d36.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/fc6d36.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<int, access::read> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba16sint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_fc6d36(tint_module_vars_struct tint_module_vars) {
+  int4 res = tint_module_vars.arg_0.read(uint2(int2(1)), 1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_fc6d36 = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<rgba16sint, read> = load %arg_0
-    %5:vec4<i32> = textureLoad %4, vec2<i32>(1i), 1i
-    %res:ptr<function, vec4<i32>, read_write> = var, %5
-    %7:vec4<i32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_fc6d36(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_fc6d36
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_fc6d36(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_fc6d36
-    ret
-  }
+kernel void compute_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_fc6d36(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_fc6d36
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/fcd23d.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/fcd23d.wgsl.expected.ir.msl
index 557e089..da56392 100644
--- a/test/tint/builtins/gen/literal/textureLoad/fcd23d.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/fcd23d.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  depth2d_ms<float, access::read> arg_0;
+  device float* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_depth_multisampled_2d, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, f32, read_write> = var @binding_point(2, 0)
+void textureLoad_fcd23d(tint_module_vars_struct tint_module_vars) {
+  float res = tint_module_vars.arg_0.read(uint2(1u), 1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_fcd23d = func():void {
-  $B2: {
-    %4:texture_depth_multisampled_2d = load %arg_0
-    %5:f32 = textureLoad %4, vec2<u32>(1u), 1i
-    %res:ptr<function, f32, read_write> = var, %5
-    %7:f32 = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_fcd23d(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_fcd23d
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(depth2d_ms<float, access::read> arg_0 [[texture(0)]], device float* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_fcd23d(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_fcd23d
-    ret
-  }
+kernel void compute_main(depth2d_ms<float, access::read> arg_0 [[texture(0)]], device float* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_fcd23d(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_fcd23d
-    ret
-  }
+vertex vertex_main_outputs vertex_main(depth2d_ms<float, access::read> arg_0 [[texture(0)]], device float* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/fd6442.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/fd6442.wgsl.expected.ir.msl
index fb6d3f0..95117c3 100644
--- a/test/tint/builtins/gen/literal/textureLoad/fd6442.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/fd6442.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<uint, access::read> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<rgba8uint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_fd6442(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(uint2(1u));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_fd6442 = func():void {
-  $B2: {
-    %4:texture_storage_2d<rgba8uint, read> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, vec2<u32>(1u)
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_fd6442(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_fd6442
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_fd6442(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_fd6442
-    ret
-  }
+kernel void compute_main(texture2d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_fd6442(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_fd6442
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/fd9606.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/fd9606.wgsl.expected.ir.msl
index 2d7d731..8d64a4d 100644
--- a/test/tint/builtins/gen/literal/textureLoad/fd9606.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/fd9606.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba8snorm, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_fd9606(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint2(1u), 1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_fd9606 = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<rgba8snorm, read_write> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec2<u32>(1u), 1i
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_fd9606(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_fd9606
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_fd9606(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_fd9606
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_fd9606(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_fd9606
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/fdebd0.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/fdebd0.wgsl.expected.ir.msl
index 7f6aacb..33a81de 100644
--- a/test/tint/builtins/gen/literal/textureLoad/fdebd0.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/fdebd0.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<uint, access::read> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba8uint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_fdebd0(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(uint2(int2(1)), 1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_fdebd0 = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<rgba8uint, read> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, vec2<i32>(1i), 1i
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_fdebd0(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_fdebd0
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_fdebd0(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_fdebd0
-    ret
-  }
+kernel void compute_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_fdebd0(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_fdebd0
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/fe0565.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/fe0565.wgsl.expected.ir.msl
index facbfe5..d608006 100644
--- a/test/tint/builtins/gen/literal/textureLoad/fe0565.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/fe0565.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_ms<uint, access::read> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_multisampled_2d<u32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_fe0565(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(uint2(1u), 1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_fe0565 = func():void {
-  $B2: {
-    %4:texture_multisampled_2d<u32> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, vec2<u32>(1u), 1i
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_fe0565(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_fe0565
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_ms<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_fe0565(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_fe0565
-    ret
-  }
+kernel void compute_main(texture2d_ms<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_fe0565(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_fe0565
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_ms<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/fe222a.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/fe222a.wgsl.expected.ir.msl
index bf7ec25..7a1adf5 100644
--- a/test/tint/builtins/gen/literal/textureLoad/fe222a.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/fe222a.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<rgba8snorm, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_fe222a(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint(1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_fe222a = func():void {
-  $B2: {
-    %4:texture_storage_1d<rgba8snorm, read> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, 1i
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_fe222a(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_fe222a
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_fe222a(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_fe222a
-    ret
-  }
+kernel void compute_main(texture1d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_fe222a(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_fe222a
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/fe2c1b.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/fe2c1b.wgsl.expected.ir.msl
index 7ceec82..c59fcb2 100644
--- a/test/tint/builtins/gen/literal/textureLoad/fe2c1b.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/fe2c1b.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<uint, access::read_write> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba32uint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_fe2c1b(tint_module_vars_struct tint_module_vars) {
+  uint4 res = tint_module_vars.arg_0.read(uint2(int2(1)), 1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_fe2c1b = func():void {
-  $B2: {
-    %4:texture_storage_2d_array<rgba32uint, read_write> = load %arg_0
-    %5:vec4<u32> = textureLoad %4, vec2<i32>(1i), 1u
-    %res:ptr<function, vec4<u32>, read_write> = var, %5
-    %7:vec4<u32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_fe2c1b(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_fe2c1b
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_fe2c1b(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_fe2c1b
-    ret
-  }
+kernel void compute_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_fe2c1b(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_fe2c1b
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/feab99.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/feab99.wgsl.expected.ir.msl
index 6878fe7..1625224 100644
--- a/test/tint/builtins/gen/literal/textureLoad/feab99.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/feab99.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<rgba16float, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_feab99(tint_module_vars_struct tint_module_vars) {
+  float4 res = tint_module_vars.arg_0.read(uint3(int3(1)));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_feab99 = func():void {
-  $B2: {
-    %4:texture_storage_3d<rgba16float, read> = load %arg_0
-    %5:vec4<f32> = textureLoad %4, vec3<i32>(1i)
-    %res:ptr<function, vec4<f32>, read_write> = var, %5
-    %7:vec4<f32> = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_feab99(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_feab99
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_feab99(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_feab99
-    ret
-  }
+kernel void compute_main(texture3d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_feab99(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_feab99
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/literal/textureLoad/ff1119.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureLoad/ff1119.wgsl.expected.ir.msl
index 4faa327..97148fc 100644
--- a/test/tint/builtins/gen/literal/textureLoad/ff1119.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/ff1119.wgsl.expected.ir.msl
@@ -1,43 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  depth2d_array<float, access::sample> arg_0;
+  device float* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_depth_2d_array, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, f32, read_write> = var @binding_point(2, 0)
+void textureLoad_ff1119(tint_module_vars_struct tint_module_vars) {
+  float res = tint_module_vars.arg_0.read(uint2(int2(1)), 1, 1u);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_ff1119 = func():void {
-  $B2: {
-    %4:texture_depth_2d_array = load %arg_0
-    %5:f32 = textureLoad %4, vec2<i32>(1i), 1i, 1u
-    %res:ptr<function, f32, read_write> = var, %5
-    %7:f32 = load %res
-    store %prevent_dce, %7
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_ff1119(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %9:void = call %textureLoad_ff1119
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(depth2d_array<float, access::sample> arg_0 [[texture(0)]], device float* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_ff1119(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %11:void = call %textureLoad_ff1119
-    ret
-  }
+kernel void compute_main(depth2d_array<float, access::sample> arg_0 [[texture(0)]], device float* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_ff1119(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %13:void = call %textureLoad_ff1119
-    ret
-  }
+vertex vertex_main_outputs vertex_main(depth2d_array<float, access::sample> arg_0 [[texture(0)]], device float* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/012e11.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/012e11.wgsl.expected.ir.msl
index cc8429b..7ce5523 100644
--- a/test/tint/builtins/gen/var/textureLoad/012e11.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/012e11.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<rgba8unorm, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_012e11(tint_module_vars_struct tint_module_vars) {
+  int3 arg_1 = int3(1);
+  float4 res = tint_module_vars.arg_0.read(uint3(arg_1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_012e11 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec3<i32>, read_write> = var, vec3<i32>(1i)
-    %5:texture_storage_3d<rgba8unorm, read_write> = load %arg_0
-    %6:vec3<i32> = load %arg_1
-    %7:vec4<f32> = textureLoad %5, %6
-    %res:ptr<function, vec4<f32>, read_write> = var, %7
-    %9:vec4<f32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_012e11(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_012e11
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_012e11(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_012e11
-    ret
-  }
+kernel void compute_main(texture3d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_012e11(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_012e11
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/019da0.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/019da0.wgsl.expected.ir.msl
index 115b8cb..e02eb12 100644
--- a/test/tint/builtins/gen/var/textureLoad/019da0.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/019da0.wgsl.expected.ir.msl
@@ -1,47 +1,33 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<float, access::sample> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_3d<f32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_019da0(tint_module_vars_struct tint_module_vars) {
+  int3 arg_1 = int3(1);
+  uint arg_2 = 1u;
+  uint const v = arg_2;
+  float4 res = tint_module_vars.arg_0.read(uint3(arg_1), v);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_019da0 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec3<i32>, read_write> = var, vec3<i32>(1i)
-    %arg_2:ptr<function, u32, read_write> = var, 1u
-    %6:texture_3d<f32> = load %arg_0
-    %7:vec3<i32> = load %arg_1
-    %8:u32 = load %arg_2
-    %9:vec4<f32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<f32>, read_write> = var, %9
-    %11:vec4<f32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_019da0(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_019da0
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_019da0(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_019da0
-    ret
-  }
+kernel void compute_main(texture3d<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_019da0(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_019da0
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/01cd01.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/01cd01.wgsl.expected.ir.msl
index c922f21..b7d07a8 100644
--- a/test/tint/builtins/gen/var/textureLoad/01cd01.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/01cd01.wgsl.expected.ir.msl
@@ -1,47 +1,32 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<int, access::read_write> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<r32sint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_01cd01(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  uint arg_2 = 1u;
+  int4 res = tint_module_vars.arg_0.read(arg_1, arg_2);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_01cd01 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %arg_2:ptr<function, u32, read_write> = var, 1u
-    %6:texture_storage_2d_array<r32sint, read_write> = load %arg_0
-    %7:vec2<u32> = load %arg_1
-    %8:u32 = load %arg_2
-    %9:vec4<i32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<i32>, read_write> = var, %9
-    %11:vec4<i32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_01cd01(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_01cd01
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_01cd01(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_01cd01
-    ret
-  }
+kernel void compute_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_01cd01(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_01cd01
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/026217.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/026217.wgsl.expected.ir.msl
index dbe5f5d..0b5c4b7 100644
--- a/test/tint/builtins/gen/var/textureLoad/026217.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/026217.wgsl.expected.ir.msl
@@ -1,49 +1,33 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<uint, access::sample> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_2d_array<u32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_026217(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  uint arg_2 = 1u;
+  int arg_3 = 1;
+  uint4 res = tint_module_vars.arg_0.read(arg_1, arg_2, arg_3);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_026217 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %arg_2:ptr<function, u32, read_write> = var, 1u
-    %arg_3:ptr<function, i32, read_write> = var, 1i
-    %7:texture_2d_array<u32> = load %arg_0
-    %8:vec2<u32> = load %arg_1
-    %9:u32 = load %arg_2
-    %10:i32 = load %arg_3
-    %11:vec4<u32> = textureLoad %7, %8, %9, %10
-    %res:ptr<function, vec4<u32>, read_write> = var, %11
-    %13:vec4<u32> = load %res
-    store %prevent_dce, %13
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_026217(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %15:void = call %textureLoad_026217
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_026217(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %17:void = call %textureLoad_026217
-    ret
-  }
+kernel void compute_main(texture2d_array<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_026217(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %19:void = call %textureLoad_026217
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/02c48d.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/02c48d.wgsl.expected.ir.msl
index 17f4ca1..9b4fd4d 100644
--- a/test/tint/builtins/gen/var/textureLoad/02c48d.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/02c48d.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<uint, access::read_write> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<rgba16uint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_02c48d(tint_module_vars_struct tint_module_vars) {
+  uint3 arg_1 = uint3(1u);
+  uint4 res = tint_module_vars.arg_0.read(arg_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_02c48d = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec3<u32>, read_write> = var, vec3<u32>(1u)
-    %5:texture_storage_3d<rgba16uint, read_write> = load %arg_0
-    %6:vec3<u32> = load %arg_1
-    %7:vec4<u32> = textureLoad %5, %6
-    %res:ptr<function, vec4<u32>, read_write> = var, %7
-    %9:vec4<u32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_02c48d(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_02c48d
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_02c48d(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_02c48d
-    ret
-  }
+kernel void compute_main(texture3d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_02c48d(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_02c48d
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/02ef1f.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/02ef1f.wgsl.expected.ir.msl
index 1181c7e..686e7a8 100644
--- a/test/tint/builtins/gen/var/textureLoad/02ef1f.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/02ef1f.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<uint, access::read_write> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<r32uint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_02ef1f(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  uint4 res = tint_module_vars.arg_0.read(uint2(arg_1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_02ef1f = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %5:texture_storage_2d<r32uint, read_write> = load %arg_0
-    %6:vec2<i32> = load %arg_1
-    %7:vec4<u32> = textureLoad %5, %6
-    %res:ptr<function, vec4<u32>, read_write> = var, %7
-    %9:vec4<u32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_02ef1f(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_02ef1f
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_02ef1f(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_02ef1f
-    ret
-  }
+kernel void compute_main(texture2d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_02ef1f(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_02ef1f
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/03e03e.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/03e03e.wgsl.expected.ir.msl
index 6d76c99..ee97a0c 100644
--- a/test/tint/builtins/gen/var/textureLoad/03e03e.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/03e03e.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<int, access::read_write> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<rgba16sint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_03e03e(tint_module_vars_struct tint_module_vars) {
+  int3 arg_1 = int3(1);
+  int4 res = tint_module_vars.arg_0.read(uint3(arg_1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_03e03e = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec3<i32>, read_write> = var, vec3<i32>(1i)
-    %5:texture_storage_3d<rgba16sint, read_write> = load %arg_0
-    %6:vec3<i32> = load %arg_1
-    %7:vec4<i32> = textureLoad %5, %6
-    %res:ptr<function, vec4<i32>, read_write> = var, %7
-    %9:vec4<i32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_03e03e(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_03e03e
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_03e03e(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_03e03e
-    ret
-  }
+kernel void compute_main(texture3d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_03e03e(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_03e03e
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/045ec9.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/045ec9.wgsl.expected.ir.msl
index 8af7b14..4650820 100644
--- a/test/tint/builtins/gen/var/textureLoad/045ec9.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/045ec9.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<int, access::read> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<rgba8sint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_045ec9(tint_module_vars_struct tint_module_vars) {
+  uint3 arg_1 = uint3(1u);
+  int4 res = tint_module_vars.arg_0.read(arg_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_045ec9 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec3<u32>, read_write> = var, vec3<u32>(1u)
-    %5:texture_storage_3d<rgba8sint, read> = load %arg_0
-    %6:vec3<u32> = load %arg_1
-    %7:vec4<i32> = textureLoad %5, %6
-    %res:ptr<function, vec4<i32>, read_write> = var, %7
-    %9:vec4<i32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_045ec9(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_045ec9
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_045ec9(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_045ec9
-    ret
-  }
+kernel void compute_main(texture3d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_045ec9(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_045ec9
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/04b911.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/04b911.wgsl.expected.ir.msl
index f1ccaea..43e9888 100644
--- a/test/tint/builtins/gen/var/textureLoad/04b911.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/04b911.wgsl.expected.ir.msl
@@ -1,49 +1,33 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  depth2d_array<float, access::sample> arg_0;
+  device float* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_depth_2d_array, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, f32, read_write> = var @binding_point(2, 0)
+void textureLoad_04b911(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  int arg_2 = 1;
+  uint arg_3 = 1u;
+  float res = tint_module_vars.arg_0.read(arg_1, arg_2, arg_3);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_04b911 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %arg_2:ptr<function, i32, read_write> = var, 1i
-    %arg_3:ptr<function, u32, read_write> = var, 1u
-    %7:texture_depth_2d_array = load %arg_0
-    %8:vec2<u32> = load %arg_1
-    %9:i32 = load %arg_2
-    %10:u32 = load %arg_3
-    %11:f32 = textureLoad %7, %8, %9, %10
-    %res:ptr<function, f32, read_write> = var, %11
-    %13:f32 = load %res
-    store %prevent_dce, %13
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_04b911(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %15:void = call %textureLoad_04b911
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(depth2d_array<float, access::sample> arg_0 [[texture(0)]], device float* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_04b911(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %17:void = call %textureLoad_04b911
-    ret
-  }
+kernel void compute_main(depth2d_array<float, access::sample> arg_0 [[texture(0)]], device float* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_04b911(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %19:void = call %textureLoad_04b911
-    ret
-  }
+vertex vertex_main_outputs vertex_main(depth2d_array<float, access::sample> arg_0 [[texture(0)]], device float* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/050c33.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/050c33.wgsl.expected.ir.msl
index 130e39b..a19d3c5 100644
--- a/test/tint/builtins/gen/var/textureLoad/050c33.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/050c33.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<uint, access::read> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<rg32uint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_050c33(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  uint4 res = tint_module_vars.arg_0.read(uint2(arg_1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_050c33 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %5:texture_storage_2d<rg32uint, read> = load %arg_0
-    %6:vec2<i32> = load %arg_1
-    %7:vec4<u32> = textureLoad %5, %6
-    %res:ptr<function, vec4<u32>, read_write> = var, %7
-    %9:vec4<u32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_050c33(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_050c33
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_050c33(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_050c33
-    ret
-  }
+kernel void compute_main(texture2d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_050c33(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_050c33
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/054350.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/054350.wgsl.expected.ir.msl
index eefdc77..01f0345 100644
--- a/test/tint/builtins/gen/var/textureLoad/054350.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/054350.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<uint, access::read_write> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<rgba8uint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_054350(tint_module_vars_struct tint_module_vars) {
+  uint arg_1 = 1u;
+  uint4 res = tint_module_vars.arg_0.read(arg_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_054350 = func():void {
-  $B2: {
-    %arg_1:ptr<function, u32, read_write> = var, 1u
-    %5:texture_storage_1d<rgba8uint, read_write> = load %arg_0
-    %6:u32 = load %arg_1
-    %7:vec4<u32> = textureLoad %5, %6
-    %res:ptr<function, vec4<u32>, read_write> = var, %7
-    %9:vec4<u32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_054350(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_054350
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_054350(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_054350
-    ret
-  }
+kernel void compute_main(texture1d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_054350(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_054350
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/0674b1.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/0674b1.wgsl.expected.ir.msl
index 5472f2c..db0dffc 100644
--- a/test/tint/builtins/gen/var/textureLoad/0674b1.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/0674b1.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<rgba8snorm, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_0674b1(tint_module_vars_struct tint_module_vars) {
+  uint3 arg_1 = uint3(1u);
+  float4 res = tint_module_vars.arg_0.read(arg_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_0674b1 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec3<u32>, read_write> = var, vec3<u32>(1u)
-    %5:texture_storage_3d<rgba8snorm, read> = load %arg_0
-    %6:vec3<u32> = load %arg_1
-    %7:vec4<f32> = textureLoad %5, %6
-    %res:ptr<function, vec4<f32>, read_write> = var, %7
-    %9:vec4<f32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_0674b1(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_0674b1
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_0674b1(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_0674b1
-    ret
-  }
+kernel void compute_main(texture3d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_0674b1(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_0674b1
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/06ac37.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/06ac37.wgsl.expected.ir.msl
index 66800f6..a444352 100644
--- a/test/tint/builtins/gen/var/textureLoad/06ac37.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/06ac37.wgsl.expected.ir.msl
@@ -1,47 +1,32 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba32float, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_06ac37(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  uint arg_2 = 1u;
+  float4 res = tint_module_vars.arg_0.read(arg_1, arg_2);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_06ac37 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %arg_2:ptr<function, u32, read_write> = var, 1u
-    %6:texture_storage_2d_array<rgba32float, read> = load %arg_0
-    %7:vec2<u32> = load %arg_1
-    %8:u32 = load %arg_2
-    %9:vec4<f32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<f32>, read_write> = var, %9
-    %11:vec4<f32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_06ac37(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_06ac37
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_06ac37(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_06ac37
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_06ac37(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_06ac37
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/072e26.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/072e26.wgsl.expected.ir.msl
index 9783701..56801ea 100644
--- a/test/tint/builtins/gen/var/textureLoad/072e26.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/072e26.wgsl.expected.ir.msl
@@ -1,47 +1,33 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba8snorm, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_072e26(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  int arg_2 = 1;
+  int const v = arg_2;
+  float4 res = tint_module_vars.arg_0.read(uint2(arg_1), v);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_072e26 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %arg_2:ptr<function, i32, read_write> = var, 1i
-    %6:texture_storage_2d_array<rgba8snorm, read> = load %arg_0
-    %7:vec2<i32> = load %arg_1
-    %8:i32 = load %arg_2
-    %9:vec4<f32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<f32>, read_write> = var, %9
-    %11:vec4<f32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_072e26(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_072e26
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_072e26(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_072e26
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_072e26(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_072e26
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/078bc4.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/078bc4.wgsl.expected.ir.msl
index 8874238..0374c5e 100644
--- a/test/tint/builtins/gen/var/textureLoad/078bc4.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/078bc4.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<rgba8snorm, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_078bc4(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  float4 res = tint_module_vars.arg_0.read(uint2(arg_1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_078bc4 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %5:texture_storage_2d<rgba8snorm, read> = load %arg_0
-    %6:vec2<i32> = load %arg_1
-    %7:vec4<f32> = textureLoad %5, %6
-    %res:ptr<function, vec4<f32>, read_write> = var, %7
-    %9:vec4<f32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_078bc4(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_078bc4
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_078bc4(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_078bc4
-    ret
-  }
+kernel void compute_main(texture2d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_078bc4(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_078bc4
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/0b515a.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/0b515a.wgsl.expected.ir.msl
index 6ed4eb2..07260f2 100644
--- a/test/tint/builtins/gen/var/textureLoad/0b515a.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/0b515a.wgsl.expected.ir.msl
@@ -1,47 +1,32 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<int, access::read_write> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba16sint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_0b515a(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  uint arg_2 = 1u;
+  int4 res = tint_module_vars.arg_0.read(arg_1, arg_2);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_0b515a = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %arg_2:ptr<function, u32, read_write> = var, 1u
-    %6:texture_storage_2d_array<rgba16sint, read_write> = load %arg_0
-    %7:vec2<u32> = load %arg_1
-    %8:u32 = load %arg_2
-    %9:vec4<i32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<i32>, read_write> = var, %9
-    %11:vec4<i32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_0b515a(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_0b515a
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_0b515a(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_0b515a
-    ret
-  }
+kernel void compute_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_0b515a(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_0b515a
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/0cb698.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/0cb698.wgsl.expected.ir.msl
index d0b6e50..44f7421 100644
--- a/test/tint/builtins/gen/var/textureLoad/0cb698.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/0cb698.wgsl.expected.ir.msl
@@ -1,47 +1,32 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<int, access::sample> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_1d<i32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_0cb698(tint_module_vars_struct tint_module_vars) {
+  uint arg_1 = 1u;
+  uint arg_2 = 1u;
+  int4 res = tint_module_vars.arg_0.read(arg_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_0cb698 = func():void {
-  $B2: {
-    %arg_1:ptr<function, u32, read_write> = var, 1u
-    %arg_2:ptr<function, u32, read_write> = var, 1u
-    %6:texture_1d<i32> = load %arg_0
-    %7:u32 = load %arg_1
-    %8:u32 = load %arg_2
-    %9:vec4<i32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<i32>, read_write> = var, %9
-    %11:vec4<i32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_0cb698(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_0cb698
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_0cb698(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_0cb698
-    ret
-  }
+kernel void compute_main(texture1d<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_0cb698(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_0cb698
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/10db82.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/10db82.wgsl.expected.ir.msl
index 73feb04..6edd551 100644
--- a/test/tint/builtins/gen/var/textureLoad/10db82.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/10db82.wgsl.expected.ir.msl
@@ -1,47 +1,32 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba16float, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_10db82(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  uint arg_2 = 1u;
+  float4 res = tint_module_vars.arg_0.read(arg_1, arg_2);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_10db82 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %arg_2:ptr<function, u32, read_write> = var, 1u
-    %6:texture_storage_2d_array<rgba16float, read> = load %arg_0
-    %7:vec2<u32> = load %arg_1
-    %8:u32 = load %arg_2
-    %9:vec4<f32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<f32>, read_write> = var, %9
-    %11:vec4<f32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_10db82(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_10db82
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_10db82(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_10db82
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_10db82(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_10db82
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/126466.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/126466.wgsl.expected.ir.msl
index 5b13617..96a92cd 100644
--- a/test/tint/builtins/gen/var/textureLoad/126466.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/126466.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<rg32float, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_126466(tint_module_vars_struct tint_module_vars) {
+  int3 arg_1 = int3(1);
+  float4 res = tint_module_vars.arg_0.read(uint3(arg_1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_126466 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec3<i32>, read_write> = var, vec3<i32>(1i)
-    %5:texture_storage_3d<rg32float, read_write> = load %arg_0
-    %6:vec3<i32> = load %arg_1
-    %7:vec4<f32> = textureLoad %5, %6
-    %res:ptr<function, vec4<f32>, read_write> = var, %7
-    %9:vec4<f32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_126466(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_126466
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_126466(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_126466
-    ret
-  }
+kernel void compute_main(texture3d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_126466(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_126466
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/127e12.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/127e12.wgsl.expected.ir.msl
index ff1ffb8..c661f2c 100644
--- a/test/tint/builtins/gen/var/textureLoad/127e12.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/127e12.wgsl.expected.ir.msl
@@ -1,47 +1,33 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<uint, access::read> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba16uint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_127e12(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  int arg_2 = 1;
+  int const v = arg_2;
+  uint4 res = tint_module_vars.arg_0.read(uint2(arg_1), v);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_127e12 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %arg_2:ptr<function, i32, read_write> = var, 1i
-    %6:texture_storage_2d_array<rgba16uint, read> = load %arg_0
-    %7:vec2<i32> = load %arg_1
-    %8:i32 = load %arg_2
-    %9:vec4<u32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<u32>, read_write> = var, %9
-    %11:vec4<u32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_127e12(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_127e12
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_127e12(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_127e12
-    ret
-  }
+kernel void compute_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_127e12(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_127e12
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/1373dc.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/1373dc.wgsl.expected.ir.msl
index d6ceef6..0e235e0 100644
--- a/test/tint/builtins/gen/var/textureLoad/1373dc.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/1373dc.wgsl.expected.ir.msl
@@ -1,47 +1,32 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<float, access::sample> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_1d<f32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_1373dc(tint_module_vars_struct tint_module_vars) {
+  uint arg_1 = 1u;
+  int arg_2 = 1;
+  float4 res = tint_module_vars.arg_0.read(arg_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_1373dc = func():void {
-  $B2: {
-    %arg_1:ptr<function, u32, read_write> = var, 1u
-    %arg_2:ptr<function, i32, read_write> = var, 1i
-    %6:texture_1d<f32> = load %arg_0
-    %7:u32 = load %arg_1
-    %8:i32 = load %arg_2
-    %9:vec4<f32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<f32>, read_write> = var, %9
-    %11:vec4<f32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_1373dc(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_1373dc
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_1373dc(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_1373dc
-    ret
-  }
+kernel void compute_main(texture1d<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_1373dc(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_1373dc
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/13d539.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/13d539.wgsl.expected.ir.msl
index 4cf24d8..13a8553 100644
--- a/test/tint/builtins/gen/var/textureLoad/13d539.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/13d539.wgsl.expected.ir.msl
@@ -1,47 +1,32 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<int, access::read> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba16sint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_13d539(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  int arg_2 = 1;
+  int4 res = tint_module_vars.arg_0.read(arg_1, arg_2);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_13d539 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %arg_2:ptr<function, i32, read_write> = var, 1i
-    %6:texture_storage_2d_array<rgba16sint, read> = load %arg_0
-    %7:vec2<u32> = load %arg_1
-    %8:i32 = load %arg_2
-    %9:vec4<i32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<i32>, read_write> = var, %9
-    %11:vec4<i32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_13d539(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_13d539
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_13d539(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_13d539
-    ret
-  }
+kernel void compute_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_13d539(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_13d539
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/13e90c.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/13e90c.wgsl.expected.ir.msl
index ae3236f..383427a 100644
--- a/test/tint/builtins/gen/var/textureLoad/13e90c.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/13e90c.wgsl.expected.ir.msl
@@ -1,47 +1,33 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba16float, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_13e90c(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  uint arg_2 = 1u;
+  uint const v = arg_2;
+  float4 res = tint_module_vars.arg_0.read(uint2(arg_1), v);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_13e90c = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %arg_2:ptr<function, u32, read_write> = var, 1u
-    %6:texture_storage_2d_array<rgba16float, read> = load %arg_0
-    %7:vec2<i32> = load %arg_1
-    %8:u32 = load %arg_2
-    %9:vec4<f32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<f32>, read_write> = var, %9
-    %11:vec4<f32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_13e90c(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_13e90c
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_13e90c(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_13e90c
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_13e90c(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_13e90c
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/143d84.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/143d84.wgsl.expected.ir.msl
index b9c267f..5eae895 100644
--- a/test/tint/builtins/gen/var/textureLoad/143d84.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/143d84.wgsl.expected.ir.msl
@@ -1,47 +1,33 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rg32float, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_143d84(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  uint arg_2 = 1u;
+  uint const v = arg_2;
+  float4 res = tint_module_vars.arg_0.read(uint2(arg_1), v);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_143d84 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %arg_2:ptr<function, u32, read_write> = var, 1u
-    %6:texture_storage_2d_array<rg32float, read> = load %arg_0
-    %7:vec2<i32> = load %arg_1
-    %8:u32 = load %arg_2
-    %9:vec4<f32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<f32>, read_write> = var, %9
-    %11:vec4<f32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_143d84(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_143d84
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_143d84(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_143d84
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_143d84(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_143d84
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/1471b8.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/1471b8.wgsl.expected.ir.msl
index 0e19713..0a81b99 100644
--- a/test/tint/builtins/gen/var/textureLoad/1471b8.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/1471b8.wgsl.expected.ir.msl
@@ -1,47 +1,32 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<int, access::read> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba32sint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_1471b8(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  int arg_2 = 1;
+  int4 res = tint_module_vars.arg_0.read(arg_1, arg_2);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_1471b8 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %arg_2:ptr<function, i32, read_write> = var, 1i
-    %6:texture_storage_2d_array<rgba32sint, read> = load %arg_0
-    %7:vec2<u32> = load %arg_1
-    %8:i32 = load %arg_2
-    %9:vec4<i32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<i32>, read_write> = var, %9
-    %11:vec4<i32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_1471b8(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_1471b8
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_1471b8(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_1471b8
-    ret
-  }
+kernel void compute_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_1471b8(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_1471b8
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/14cc4c.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/14cc4c.wgsl.expected.ir.msl
index 8536f98..64556e0 100644
--- a/test/tint/builtins/gen/var/textureLoad/14cc4c.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/14cc4c.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<rgba8unorm, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_14cc4c(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  float4 res = tint_module_vars.arg_0.read(uint2(arg_1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_14cc4c = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %5:texture_storage_2d<rgba8unorm, read_write> = load %arg_0
-    %6:vec2<i32> = load %arg_1
-    %7:vec4<f32> = textureLoad %5, %6
-    %res:ptr<function, vec4<f32>, read_write> = var, %7
-    %9:vec4<f32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_14cc4c(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_14cc4c
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_14cc4c(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_14cc4c
-    ret
-  }
+kernel void compute_main(texture2d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_14cc4c(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_14cc4c
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/1561a7.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/1561a7.wgsl.expected.ir.msl
index ceef1a7..51a836f 100644
--- a/test/tint/builtins/gen/var/textureLoad/1561a7.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/1561a7.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<uint, access::read> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<r32uint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_1561a7(tint_module_vars_struct tint_module_vars) {
+  int arg_1 = 1;
+  uint4 res = tint_module_vars.arg_0.read(uint(arg_1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_1561a7 = func():void {
-  $B2: {
-    %arg_1:ptr<function, i32, read_write> = var, 1i
-    %5:texture_storage_1d<r32uint, read> = load %arg_0
-    %6:i32 = load %arg_1
-    %7:vec4<u32> = textureLoad %5, %6
-    %res:ptr<function, vec4<u32>, read_write> = var, %7
-    %9:vec4<u32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_1561a7(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_1561a7
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_1561a7(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_1561a7
-    ret
-  }
+kernel void compute_main(texture1d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_1561a7(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_1561a7
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/15e675.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/15e675.wgsl.expected.ir.msl
index c1bd4e8..6a980cf 100644
--- a/test/tint/builtins/gen/var/textureLoad/15e675.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/15e675.wgsl.expected.ir.msl
@@ -1,47 +1,32 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<uint, access::read> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba8uint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_15e675(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  int arg_2 = 1;
+  uint4 res = tint_module_vars.arg_0.read(arg_1, arg_2);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_15e675 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %arg_2:ptr<function, i32, read_write> = var, 1i
-    %6:texture_storage_2d_array<rgba8uint, read> = load %arg_0
-    %7:vec2<u32> = load %arg_1
-    %8:i32 = load %arg_2
-    %9:vec4<u32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<u32>, read_write> = var, %9
-    %11:vec4<u32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_15e675(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_15e675
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_15e675(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_15e675
-    ret
-  }
+kernel void compute_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_15e675(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_15e675
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/1619bf.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/1619bf.wgsl.expected.ir.msl
index fe32a9c..c52d557 100644
--- a/test/tint/builtins/gen/var/textureLoad/1619bf.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/1619bf.wgsl.expected.ir.msl
@@ -1,47 +1,32 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<int, access::read_write> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<r32sint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_1619bf(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  int arg_2 = 1;
+  int4 res = tint_module_vars.arg_0.read(arg_1, arg_2);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_1619bf = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %arg_2:ptr<function, i32, read_write> = var, 1i
-    %6:texture_storage_2d_array<r32sint, read_write> = load %arg_0
-    %7:vec2<u32> = load %arg_1
-    %8:i32 = load %arg_2
-    %9:vec4<i32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<i32>, read_write> = var, %9
-    %11:vec4<i32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_1619bf(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_1619bf
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_1619bf(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_1619bf
-    ret
-  }
+kernel void compute_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_1619bf(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_1619bf
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/168dc8.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/168dc8.wgsl.expected.ir.msl
index 8e096de..840163d 100644
--- a/test/tint/builtins/gen/var/textureLoad/168dc8.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/168dc8.wgsl.expected.ir.msl
@@ -1,49 +1,33 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<int, access::sample> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_2d_array<i32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_168dc8(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  int arg_2 = 1;
+  int arg_3 = 1;
+  int4 res = tint_module_vars.arg_0.read(arg_1, arg_2, arg_3);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_168dc8 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %arg_2:ptr<function, i32, read_write> = var, 1i
-    %arg_3:ptr<function, i32, read_write> = var, 1i
-    %7:texture_2d_array<i32> = load %arg_0
-    %8:vec2<u32> = load %arg_1
-    %9:i32 = load %arg_2
-    %10:i32 = load %arg_3
-    %11:vec4<i32> = textureLoad %7, %8, %9, %10
-    %res:ptr<function, vec4<i32>, read_write> = var, %11
-    %13:vec4<i32> = load %res
-    store %prevent_dce, %13
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_168dc8(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %15:void = call %textureLoad_168dc8
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_168dc8(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %17:void = call %textureLoad_168dc8
-    ret
-  }
+kernel void compute_main(texture2d_array<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_168dc8(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %19:void = call %textureLoad_168dc8
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/170593.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/170593.wgsl.expected.ir.msl
index 157e4d2..805febd 100644
--- a/test/tint/builtins/gen/var/textureLoad/170593.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/170593.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<uint, access::read_write> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<rgba32uint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_170593(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  uint4 res = tint_module_vars.arg_0.read(uint2(arg_1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_170593 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %5:texture_storage_2d<rgba32uint, read_write> = load %arg_0
-    %6:vec2<i32> = load %arg_1
-    %7:vec4<u32> = textureLoad %5, %6
-    %res:ptr<function, vec4<u32>, read_write> = var, %7
-    %9:vec4<u32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_170593(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_170593
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_170593(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_170593
-    ret
-  }
+kernel void compute_main(texture2d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_170593(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_170593
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/17095b.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/17095b.wgsl.expected.ir.msl
index 801b064..9806bc1 100644
--- a/test/tint/builtins/gen/var/textureLoad/17095b.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/17095b.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<uint, access::read_write> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<rgba32uint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_17095b(tint_module_vars_struct tint_module_vars) {
+  uint arg_1 = 1u;
+  uint4 res = tint_module_vars.arg_0.read(arg_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_17095b = func():void {
-  $B2: {
-    %arg_1:ptr<function, u32, read_write> = var, 1u
-    %5:texture_storage_1d<rgba32uint, read_write> = load %arg_0
-    %6:u32 = load %arg_1
-    %7:vec4<u32> = textureLoad %5, %6
-    %res:ptr<function, vec4<u32>, read_write> = var, %7
-    %9:vec4<u32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_17095b(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_17095b
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_17095b(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_17095b
-    ret
-  }
+kernel void compute_main(texture1d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_17095b(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_17095b
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/18ac11.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/18ac11.wgsl.expected.ir.msl
index 589efd0..58e3a47 100644
--- a/test/tint/builtins/gen/var/textureLoad/18ac11.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/18ac11.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<int, access::read> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<rg32sint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_18ac11(tint_module_vars_struct tint_module_vars) {
+  uint arg_1 = 1u;
+  int4 res = tint_module_vars.arg_0.read(arg_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_18ac11 = func():void {
-  $B2: {
-    %arg_1:ptr<function, u32, read_write> = var, 1u
-    %5:texture_storage_1d<rg32sint, read> = load %arg_0
-    %6:u32 = load %arg_1
-    %7:vec4<i32> = textureLoad %5, %6
-    %res:ptr<function, vec4<i32>, read_write> = var, %7
-    %9:vec4<i32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_18ac11(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_18ac11
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_18ac11(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_18ac11
-    ret
-  }
+kernel void compute_main(texture1d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_18ac11(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_18ac11
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/19cf87.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/19cf87.wgsl.expected.ir.msl
index b24852b..a577ce9 100644
--- a/test/tint/builtins/gen/var/textureLoad/19cf87.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/19cf87.wgsl.expected.ir.msl
@@ -1,47 +1,33 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  depth2d<float, access::sample> arg_0;
+  device float* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_depth_2d, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, f32, read_write> = var @binding_point(2, 0)
+void textureLoad_19cf87(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  int arg_2 = 1;
+  int const v = arg_2;
+  float res = tint_module_vars.arg_0.read(uint2(arg_1), v);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_19cf87 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %arg_2:ptr<function, i32, read_write> = var, 1i
-    %6:texture_depth_2d = load %arg_0
-    %7:vec2<i32> = load %arg_1
-    %8:i32 = load %arg_2
-    %9:f32 = textureLoad %6, %7, %8
-    %res:ptr<function, f32, read_write> = var, %9
-    %11:f32 = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_19cf87(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_19cf87
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(depth2d<float, access::sample> arg_0 [[texture(0)]], device float* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_19cf87(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_19cf87
-    ret
-  }
+kernel void compute_main(depth2d<float, access::sample> arg_0 [[texture(0)]], device float* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_19cf87(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_19cf87
-    ret
-  }
+vertex vertex_main_outputs vertex_main(depth2d<float, access::sample> arg_0 [[texture(0)]], device float* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/19d6be.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/19d6be.wgsl.expected.ir.msl
index f6596bd..719a458 100644
--- a/test/tint/builtins/gen/var/textureLoad/19d6be.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/19d6be.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<uint, access::read_write> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<r32uint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_19d6be(tint_module_vars_struct tint_module_vars) {
+  uint3 arg_1 = uint3(1u);
+  uint4 res = tint_module_vars.arg_0.read(arg_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_19d6be = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec3<u32>, read_write> = var, vec3<u32>(1u)
-    %5:texture_storage_3d<r32uint, read_write> = load %arg_0
-    %6:vec3<u32> = load %arg_1
-    %7:vec4<u32> = textureLoad %5, %6
-    %res:ptr<function, vec4<u32>, read_write> = var, %7
-    %9:vec4<u32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_19d6be(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_19d6be
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_19d6be(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_19d6be
-    ret
-  }
+kernel void compute_main(texture3d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_19d6be(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_19d6be
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/19e5ca.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/19e5ca.wgsl.expected.ir.msl
index 763cd86..f00294d 100644
--- a/test/tint/builtins/gen/var/textureLoad/19e5ca.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/19e5ca.wgsl.expected.ir.msl
@@ -1,47 +1,33 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<r8unorm, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_19e5ca(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  uint arg_2 = 1u;
+  uint const v = arg_2;
+  float4 res = tint_module_vars.arg_0.read(uint2(arg_1), v);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_19e5ca = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %arg_2:ptr<function, u32, read_write> = var, 1u
-    %6:texture_storage_2d_array<r8unorm, read> = load %arg_0
-    %7:vec2<i32> = load %arg_1
-    %8:u32 = load %arg_2
-    %9:vec4<f32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<f32>, read_write> = var, %9
-    %11:vec4<f32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_19e5ca(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_19e5ca
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_19e5ca(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_19e5ca
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_19e5ca(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_19e5ca
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/1a062f.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/1a062f.wgsl.expected.ir.msl
index 791991d..5ca5501 100644
--- a/test/tint/builtins/gen/var/textureLoad/1a062f.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/1a062f.wgsl.expected.ir.msl
@@ -1,47 +1,33 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba16float, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_1a062f(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  int arg_2 = 1;
+  int const v = arg_2;
+  float4 res = tint_module_vars.arg_0.read(uint2(arg_1), v);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_1a062f = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %arg_2:ptr<function, i32, read_write> = var, 1i
-    %6:texture_storage_2d_array<rgba16float, read> = load %arg_0
-    %7:vec2<i32> = load %arg_1
-    %8:i32 = load %arg_2
-    %9:vec4<f32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<f32>, read_write> = var, %9
-    %11:vec4<f32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_1a062f(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_1a062f
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_1a062f(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_1a062f
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_1a062f(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_1a062f
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/1a8452.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/1a8452.wgsl.expected.ir.msl
index c90adee..35aa835 100644
--- a/test/tint/builtins/gen/var/textureLoad/1a8452.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/1a8452.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<uint, access::read> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<rgba8uint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_1a8452(tint_module_vars_struct tint_module_vars) {
+  int arg_1 = 1;
+  uint4 res = tint_module_vars.arg_0.read(uint(arg_1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_1a8452 = func():void {
-  $B2: {
-    %arg_1:ptr<function, i32, read_write> = var, 1i
-    %5:texture_storage_1d<rgba8uint, read> = load %arg_0
-    %6:i32 = load %arg_1
-    %7:vec4<u32> = textureLoad %5, %6
-    %res:ptr<function, vec4<u32>, read_write> = var, %7
-    %9:vec4<u32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_1a8452(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_1a8452
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_1a8452(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_1a8452
-    ret
-  }
+kernel void compute_main(texture1d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_1a8452(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_1a8452
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/1aa950.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/1aa950.wgsl.expected.ir.msl
index 8af08f3..6abbd5b 100644
--- a/test/tint/builtins/gen/var/textureLoad/1aa950.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/1aa950.wgsl.expected.ir.msl
@@ -1,47 +1,33 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<int, access::read> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba32sint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_1aa950(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  uint arg_2 = 1u;
+  uint const v = arg_2;
+  int4 res = tint_module_vars.arg_0.read(uint2(arg_1), v);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_1aa950 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %arg_2:ptr<function, u32, read_write> = var, 1u
-    %6:texture_storage_2d_array<rgba32sint, read> = load %arg_0
-    %7:vec2<i32> = load %arg_1
-    %8:u32 = load %arg_2
-    %9:vec4<i32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<i32>, read_write> = var, %9
-    %11:vec4<i32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_1aa950(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_1aa950
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_1aa950(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_1aa950
-    ret
-  }
+kernel void compute_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_1aa950(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_1aa950
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/1b051f.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/1b051f.wgsl.expected.ir.msl
index 777589c..a95d1cf 100644
--- a/test/tint/builtins/gen/var/textureLoad/1b051f.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/1b051f.wgsl.expected.ir.msl
@@ -1,49 +1,35 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<uint, access::sample> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_2d_array<u32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_1b051f(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  uint arg_2 = 1u;
+  uint arg_3 = 1u;
+  uint const v = arg_2;
+  uint const v_1 = arg_3;
+  uint4 res = tint_module_vars.arg_0.read(uint2(arg_1), v, v_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_1b051f = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %arg_2:ptr<function, u32, read_write> = var, 1u
-    %arg_3:ptr<function, u32, read_write> = var, 1u
-    %7:texture_2d_array<u32> = load %arg_0
-    %8:vec2<i32> = load %arg_1
-    %9:u32 = load %arg_2
-    %10:u32 = load %arg_3
-    %11:vec4<u32> = textureLoad %7, %8, %9, %10
-    %res:ptr<function, vec4<u32>, read_write> = var, %11
-    %13:vec4<u32> = load %res
-    store %prevent_dce, %13
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_1b051f(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %15:void = call %textureLoad_1b051f
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_1b051f(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %17:void = call %textureLoad_1b051f
-    ret
-  }
+kernel void compute_main(texture2d_array<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_1b051f(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %19:void = call %textureLoad_1b051f
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/1b4332.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/1b4332.wgsl.expected.ir.msl
index 605d7a5..441f980 100644
--- a/test/tint/builtins/gen/var/textureLoad/1b4332.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/1b4332.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<uint, access::read_write> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<r32uint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_1b4332(tint_module_vars_struct tint_module_vars) {
+  int3 arg_1 = int3(1);
+  uint4 res = tint_module_vars.arg_0.read(uint3(arg_1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_1b4332 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec3<i32>, read_write> = var, vec3<i32>(1i)
-    %5:texture_storage_3d<r32uint, read_write> = load %arg_0
-    %6:vec3<i32> = load %arg_1
-    %7:vec4<u32> = textureLoad %5, %6
-    %res:ptr<function, vec4<u32>, read_write> = var, %7
-    %9:vec4<u32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_1b4332(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_1b4332
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_1b4332(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_1b4332
-    ret
-  }
+kernel void compute_main(texture3d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_1b4332(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_1b4332
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/1b8588.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/1b8588.wgsl.expected.ir.msl
index a8637a6..92844fb 100644
--- a/test/tint/builtins/gen/var/textureLoad/1b8588.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/1b8588.wgsl.expected.ir.msl
@@ -1,47 +1,32 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<uint, access::sample> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_1d<u32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_1b8588(tint_module_vars_struct tint_module_vars) {
+  int arg_1 = 1;
+  int arg_2 = 1;
+  uint4 res = tint_module_vars.arg_0.read(uint(arg_1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_1b8588 = func():void {
-  $B2: {
-    %arg_1:ptr<function, i32, read_write> = var, 1i
-    %arg_2:ptr<function, i32, read_write> = var, 1i
-    %6:texture_1d<u32> = load %arg_0
-    %7:i32 = load %arg_1
-    %8:i32 = load %arg_2
-    %9:vec4<u32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<u32>, read_write> = var, %9
-    %11:vec4<u32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_1b8588(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_1b8588
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_1b8588(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_1b8588
-    ret
-  }
+kernel void compute_main(texture1d<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_1b8588(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_1b8588
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/1bc5ab.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/1bc5ab.wgsl.expected.ir.msl
index 05e6d8b..818cc52 100644
--- a/test/tint/builtins/gen/var/textureLoad/1bc5ab.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/1bc5ab.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<rgba8snorm, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_1bc5ab(tint_module_vars_struct tint_module_vars) {
+  uint3 arg_1 = uint3(1u);
+  float4 res = tint_module_vars.arg_0.read(arg_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_1bc5ab = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec3<u32>, read_write> = var, vec3<u32>(1u)
-    %5:texture_storage_3d<rgba8snorm, read_write> = load %arg_0
-    %6:vec3<u32> = load %arg_1
-    %7:vec4<f32> = textureLoad %5, %6
-    %res:ptr<function, vec4<f32>, read_write> = var, %7
-    %9:vec4<f32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_1bc5ab(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_1bc5ab
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_1bc5ab(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_1bc5ab
-    ret
-  }
+kernel void compute_main(texture3d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_1bc5ab(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_1bc5ab
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/1bfdfb.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/1bfdfb.wgsl.expected.ir.msl
index 2dce6f8..a48e115 100644
--- a/test/tint/builtins/gen/var/textureLoad/1bfdfb.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/1bfdfb.wgsl.expected.ir.msl
@@ -1,30 +1,9 @@
 SKIP: FAILED
 
-
-@group(1) @binding(0) var arg_0 : texture_external;
-
-fn textureLoad_1bfdfb() {
-  var arg_1 = vec2<u32>(1u);
-  var res : vec4<f32> = textureLoad(arg_0, arg_1);
-  prevent_dce = res;
-}
-
-@group(2) @binding(0) var<storage, read_write> prevent_dce : vec4<f32>;
-
-@vertex
-fn vertex_main() -> @builtin(position) vec4<f32> {
-  textureLoad_1bfdfb();
-  return vec4<f32>();
-}
-
-@fragment
-fn fragment_main() {
-  textureLoad_1bfdfb();
-}
-
-@compute @workgroup_size(1)
-fn compute_main() {
-  textureLoad_1bfdfb();
-}
-
-Failed to generate: error: ExternalTextureOptions missing binding entry for [group: 1, binding: 0]
+../../src/tint/lang/msl/writer/printer/printer.cc:1006 internal compiler error: TINT_UNREACHABLE unhandled: abs
+********************************************************************
+*  The tint shader compiler has encountered an unexpected error.   *
+*                                                                  *
+*  Please help us fix this issue by submitting a bug report at     *
+*  crbug.com/tint with the source program that triggered the bug.  *
+********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/1c562a.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/1c562a.wgsl.expected.ir.msl
index c789701..0b61bda 100644
--- a/test/tint/builtins/gen/var/textureLoad/1c562a.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/1c562a.wgsl.expected.ir.msl
@@ -1,47 +1,32 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<uint, access::sample> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_3d<u32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_1c562a(tint_module_vars_struct tint_module_vars) {
+  uint3 arg_1 = uint3(1u);
+  uint arg_2 = 1u;
+  uint4 res = tint_module_vars.arg_0.read(arg_1, arg_2);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_1c562a = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec3<u32>, read_write> = var, vec3<u32>(1u)
-    %arg_2:ptr<function, u32, read_write> = var, 1u
-    %6:texture_3d<u32> = load %arg_0
-    %7:vec3<u32> = load %arg_1
-    %8:u32 = load %arg_2
-    %9:vec4<u32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<u32>, read_write> = var, %9
-    %11:vec4<u32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_1c562a(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_1c562a
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_1c562a(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_1c562a
-    ret
-  }
+kernel void compute_main(texture3d<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_1c562a(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_1c562a
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/1d43ae.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/1d43ae.wgsl.expected.ir.msl
index 53e49cf..78533a7 100644
--- a/test/tint/builtins/gen/var/textureLoad/1d43ae.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/1d43ae.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<int, access::read_write> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<rgba32sint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_1d43ae(tint_module_vars_struct tint_module_vars) {
+  int arg_1 = 1;
+  int4 res = tint_module_vars.arg_0.read(uint(arg_1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_1d43ae = func():void {
-  $B2: {
-    %arg_1:ptr<function, i32, read_write> = var, 1i
-    %5:texture_storage_1d<rgba32sint, read_write> = load %arg_0
-    %6:i32 = load %arg_1
-    %7:vec4<i32> = textureLoad %5, %6
-    %res:ptr<function, vec4<i32>, read_write> = var, %7
-    %9:vec4<i32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_1d43ae(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_1d43ae
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_1d43ae(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_1d43ae
-    ret
-  }
+kernel void compute_main(texture1d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_1d43ae(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_1d43ae
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/1e6baa.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/1e6baa.wgsl.expected.ir.msl
index 71bbae9..eaeefa4 100644
--- a/test/tint/builtins/gen/var/textureLoad/1e6baa.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/1e6baa.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<rg32float, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_1e6baa(tint_module_vars_struct tint_module_vars) {
+  uint arg_1 = 1u;
+  float4 res = tint_module_vars.arg_0.read(arg_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_1e6baa = func():void {
-  $B2: {
-    %arg_1:ptr<function, u32, read_write> = var, 1u
-    %5:texture_storage_1d<rg32float, read_write> = load %arg_0
-    %6:u32 = load %arg_1
-    %7:vec4<f32> = textureLoad %5, %6
-    %res:ptr<function, vec4<f32>, read_write> = var, %7
-    %9:vec4<f32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_1e6baa(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_1e6baa
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_1e6baa(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_1e6baa
-    ret
-  }
+kernel void compute_main(texture1d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_1e6baa(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_1e6baa
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/1eb93f.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/1eb93f.wgsl.expected.ir.msl
index eec8787..b4a0cea 100644
--- a/test/tint/builtins/gen/var/textureLoad/1eb93f.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/1eb93f.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<rg32float, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_1eb93f(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  float4 res = tint_module_vars.arg_0.read(arg_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_1eb93f = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %5:texture_storage_2d<rg32float, read> = load %arg_0
-    %6:vec2<u32> = load %arg_1
-    %7:vec4<f32> = textureLoad %5, %6
-    %res:ptr<function, vec4<f32>, read_write> = var, %7
-    %9:vec4<f32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_1eb93f(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_1eb93f
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_1eb93f(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_1eb93f
-    ret
-  }
+kernel void compute_main(texture2d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_1eb93f(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_1eb93f
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/1f2016.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/1f2016.wgsl.expected.ir.msl
index 459c3fc..f7c826e 100644
--- a/test/tint/builtins/gen/var/textureLoad/1f2016.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/1f2016.wgsl.expected.ir.msl
@@ -1,47 +1,33 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<float, access::sample> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_3d<f32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_1f2016(tint_module_vars_struct tint_module_vars) {
+  int3 arg_1 = int3(1);
+  int arg_2 = 1;
+  int const v = arg_2;
+  float4 res = tint_module_vars.arg_0.read(uint3(arg_1), v);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_1f2016 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec3<i32>, read_write> = var, vec3<i32>(1i)
-    %arg_2:ptr<function, i32, read_write> = var, 1i
-    %6:texture_3d<f32> = load %arg_0
-    %7:vec3<i32> = load %arg_1
-    %8:i32 = load %arg_2
-    %9:vec4<f32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<f32>, read_write> = var, %9
-    %11:vec4<f32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_1f2016(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_1f2016
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_1f2016(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_1f2016
-    ret
-  }
+kernel void compute_main(texture3d<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_1f2016(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_1f2016
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/1fde63.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/1fde63.wgsl.expected.ir.msl
index 60474a4..35d373e 100644
--- a/test/tint/builtins/gen/var/textureLoad/1fde63.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/1fde63.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<r8unorm, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_1fde63(tint_module_vars_struct tint_module_vars) {
+  uint3 arg_1 = uint3(1u);
+  float4 res = tint_module_vars.arg_0.read(arg_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_1fde63 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec3<u32>, read_write> = var, vec3<u32>(1u)
-    %5:texture_storage_3d<r8unorm, read_write> = load %arg_0
-    %6:vec3<u32> = load %arg_1
-    %7:vec4<f32> = textureLoad %5, %6
-    %res:ptr<function, vec4<f32>, read_write> = var, %7
-    %9:vec4<f32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_1fde63(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_1fde63
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_1fde63(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_1fde63
-    ret
-  }
+kernel void compute_main(texture3d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_1fde63(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_1fde63
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/206a08.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/206a08.wgsl.expected.ir.msl
index 46a7dba..47e2158 100644
--- a/test/tint/builtins/gen/var/textureLoad/206a08.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/206a08.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<uint, access::read> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<rgba8uint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_206a08(tint_module_vars_struct tint_module_vars) {
+  uint arg_1 = 1u;
+  uint4 res = tint_module_vars.arg_0.read(arg_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_206a08 = func():void {
-  $B2: {
-    %arg_1:ptr<function, u32, read_write> = var, 1u
-    %5:texture_storage_1d<rgba8uint, read> = load %arg_0
-    %6:u32 = load %arg_1
-    %7:vec4<u32> = textureLoad %5, %6
-    %res:ptr<function, vec4<u32>, read_write> = var, %7
-    %9:vec4<u32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_206a08(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_206a08
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_206a08(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_206a08
-    ret
-  }
+kernel void compute_main(texture1d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_206a08(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_206a08
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/20fa2f.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/20fa2f.wgsl.expected.ir.msl
index 5436f2c..052d1fd 100644
--- a/test/tint/builtins/gen/var/textureLoad/20fa2f.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/20fa2f.wgsl.expected.ir.msl
@@ -1,47 +1,33 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rg32float, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_20fa2f(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  int arg_2 = 1;
+  int const v = arg_2;
+  float4 res = tint_module_vars.arg_0.read(uint2(arg_1), v);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_20fa2f = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %arg_2:ptr<function, i32, read_write> = var, 1i
-    %6:texture_storage_2d_array<rg32float, read> = load %arg_0
-    %7:vec2<i32> = load %arg_1
-    %8:i32 = load %arg_2
-    %9:vec4<f32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<f32>, read_write> = var, %9
-    %11:vec4<f32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_20fa2f(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_20fa2f
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_20fa2f(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_20fa2f
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_20fa2f(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_20fa2f
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/216c37.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/216c37.wgsl.expected.ir.msl
index 8a5d801..b7c9b37 100644
--- a/test/tint/builtins/gen/var/textureLoad/216c37.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/216c37.wgsl.expected.ir.msl
@@ -1,47 +1,32 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<uint, access::sample> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_1d<u32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_216c37(tint_module_vars_struct tint_module_vars) {
+  uint arg_1 = 1u;
+  int arg_2 = 1;
+  uint4 res = tint_module_vars.arg_0.read(arg_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_216c37 = func():void {
-  $B2: {
-    %arg_1:ptr<function, u32, read_write> = var, 1u
-    %arg_2:ptr<function, i32, read_write> = var, 1i
-    %6:texture_1d<u32> = load %arg_0
-    %7:u32 = load %arg_1
-    %8:i32 = load %arg_2
-    %9:vec4<u32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<u32>, read_write> = var, %9
-    %11:vec4<u32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_216c37(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_216c37
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_216c37(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_216c37
-    ret
-  }
+kernel void compute_main(texture1d<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_216c37(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_216c37
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/21d1c4.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/21d1c4.wgsl.expected.ir.msl
index 83ac922..ce74284 100644
--- a/test/tint/builtins/gen/var/textureLoad/21d1c4.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/21d1c4.wgsl.expected.ir.msl
@@ -1,47 +1,32 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<float, access::sample> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_3d<f32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_21d1c4(tint_module_vars_struct tint_module_vars) {
+  uint3 arg_1 = uint3(1u);
+  uint arg_2 = 1u;
+  float4 res = tint_module_vars.arg_0.read(arg_1, arg_2);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_21d1c4 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec3<u32>, read_write> = var, vec3<u32>(1u)
-    %arg_2:ptr<function, u32, read_write> = var, 1u
-    %6:texture_3d<f32> = load %arg_0
-    %7:vec3<u32> = load %arg_1
-    %8:u32 = load %arg_2
-    %9:vec4<f32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<f32>, read_write> = var, %9
-    %11:vec4<f32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_21d1c4(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_21d1c4
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_21d1c4(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_21d1c4
-    ret
-  }
+kernel void compute_main(texture3d<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_21d1c4(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_21d1c4
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/223246.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/223246.wgsl.expected.ir.msl
index 5f04918..0392f48 100644
--- a/test/tint/builtins/gen/var/textureLoad/223246.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/223246.wgsl.expected.ir.msl
@@ -1,47 +1,32 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<int, access::sample> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_3d<i32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_223246(tint_module_vars_struct tint_module_vars) {
+  uint3 arg_1 = uint3(1u);
+  int arg_2 = 1;
+  int4 res = tint_module_vars.arg_0.read(arg_1, arg_2);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_223246 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec3<u32>, read_write> = var, vec3<u32>(1u)
-    %arg_2:ptr<function, i32, read_write> = var, 1i
-    %6:texture_3d<i32> = load %arg_0
-    %7:vec3<u32> = load %arg_1
-    %8:i32 = load %arg_2
-    %9:vec4<i32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<i32>, read_write> = var, %9
-    %11:vec4<i32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_223246(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_223246
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_223246(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_223246
-    ret
-  }
+kernel void compute_main(texture3d<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_223246(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_223246
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/22e963.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/22e963.wgsl.expected.ir.msl
index 236ceba..848dc41 100644
--- a/test/tint/builtins/gen/var/textureLoad/22e963.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/22e963.wgsl.expected.ir.msl
@@ -1,47 +1,32 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<uint, access::read> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<r32uint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_22e963(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  uint arg_2 = 1u;
+  uint4 res = tint_module_vars.arg_0.read(arg_1, arg_2);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_22e963 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %arg_2:ptr<function, u32, read_write> = var, 1u
-    %6:texture_storage_2d_array<r32uint, read> = load %arg_0
-    %7:vec2<u32> = load %arg_1
-    %8:u32 = load %arg_2
-    %9:vec4<u32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<u32>, read_write> = var, %9
-    %11:vec4<u32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_22e963(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_22e963
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_22e963(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_22e963
-    ret
-  }
+kernel void compute_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_22e963(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_22e963
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/23007a.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/23007a.wgsl.expected.ir.msl
index e21be84..6b47012 100644
--- a/test/tint/builtins/gen/var/textureLoad/23007a.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/23007a.wgsl.expected.ir.msl
@@ -1,47 +1,32 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rg32float, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_23007a(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  int arg_2 = 1;
+  float4 res = tint_module_vars.arg_0.read(arg_1, arg_2);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_23007a = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %arg_2:ptr<function, i32, read_write> = var, 1i
-    %6:texture_storage_2d_array<rg32float, read> = load %arg_0
-    %7:vec2<u32> = load %arg_1
-    %8:i32 = load %arg_2
-    %9:vec4<f32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<f32>, read_write> = var, %9
-    %11:vec4<f32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_23007a(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_23007a
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_23007a(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_23007a
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_23007a(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_23007a
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/2363be.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/2363be.wgsl.expected.ir.msl
index 12cf3ea..2f654cb 100644
--- a/test/tint/builtins/gen/var/textureLoad/2363be.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/2363be.wgsl.expected.ir.msl
@@ -1,49 +1,33 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<int, access::sample> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_2d_array<i32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_2363be(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  int arg_2 = 1;
+  uint arg_3 = 1u;
+  int4 res = tint_module_vars.arg_0.read(arg_1, arg_2, arg_3);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_2363be = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %arg_2:ptr<function, i32, read_write> = var, 1i
-    %arg_3:ptr<function, u32, read_write> = var, 1u
-    %7:texture_2d_array<i32> = load %arg_0
-    %8:vec2<u32> = load %arg_1
-    %9:i32 = load %arg_2
-    %10:u32 = load %arg_3
-    %11:vec4<i32> = textureLoad %7, %8, %9, %10
-    %res:ptr<function, vec4<i32>, read_write> = var, %11
-    %13:vec4<i32> = load %res
-    store %prevent_dce, %13
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_2363be(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %15:void = call %textureLoad_2363be
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_2363be(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %17:void = call %textureLoad_2363be
-    ret
-  }
+kernel void compute_main(texture2d_array<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_2363be(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %19:void = call %textureLoad_2363be
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/23ff89.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/23ff89.wgsl.expected.ir.msl
index f64b6de..248bb58 100644
--- a/test/tint/builtins/gen/var/textureLoad/23ff89.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/23ff89.wgsl.expected.ir.msl
@@ -1,47 +1,32 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<uint, access::read> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba16uint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_23ff89(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  uint arg_2 = 1u;
+  uint4 res = tint_module_vars.arg_0.read(arg_1, arg_2);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_23ff89 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %arg_2:ptr<function, u32, read_write> = var, 1u
-    %6:texture_storage_2d_array<rgba16uint, read> = load %arg_0
-    %7:vec2<u32> = load %arg_1
-    %8:u32 = load %arg_2
-    %9:vec4<u32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<u32>, read_write> = var, %9
-    %11:vec4<u32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_23ff89(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_23ff89
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_23ff89(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_23ff89
-    ret
-  }
+kernel void compute_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_23ff89(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_23ff89
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/25b67f.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/25b67f.wgsl.expected.ir.msl
index dc80cf5..98c2da4 100644
--- a/test/tint/builtins/gen/var/textureLoad/25b67f.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/25b67f.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<uint, access::read_write> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<rgba8uint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_25b67f(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  uint4 res = tint_module_vars.arg_0.read(arg_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_25b67f = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %5:texture_storage_2d<rgba8uint, read_write> = load %arg_0
-    %6:vec2<u32> = load %arg_1
-    %7:vec4<u32> = textureLoad %5, %6
-    %res:ptr<function, vec4<u32>, read_write> = var, %7
-    %9:vec4<u32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_25b67f(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_25b67f
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_25b67f(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_25b67f
-    ret
-  }
+kernel void compute_main(texture2d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_25b67f(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_25b67f
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/26b8f6.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/26b8f6.wgsl.expected.ir.msl
index 6087d97..2be6cd1 100644
--- a/test/tint/builtins/gen/var/textureLoad/26b8f6.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/26b8f6.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<uint, access::read_write> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<rgba8uint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_26b8f6(tint_module_vars_struct tint_module_vars) {
+  uint3 arg_1 = uint3(1u);
+  uint4 res = tint_module_vars.arg_0.read(arg_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_26b8f6 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec3<u32>, read_write> = var, vec3<u32>(1u)
-    %5:texture_storage_3d<rgba8uint, read_write> = load %arg_0
-    %6:vec3<u32> = load %arg_1
-    %7:vec4<u32> = textureLoad %5, %6
-    %res:ptr<function, vec4<u32>, read_write> = var, %7
-    %9:vec4<u32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_26b8f6(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_26b8f6
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_26b8f6(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_26b8f6
-    ret
-  }
+kernel void compute_main(texture3d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_26b8f6(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_26b8f6
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/26c4f8.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/26c4f8.wgsl.expected.ir.msl
index 4160cbf..11832d4 100644
--- a/test/tint/builtins/gen/var/textureLoad/26c4f8.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/26c4f8.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<bgra8unorm, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_26c4f8(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  float4 res = tint_module_vars.arg_0.read(uint2(arg_1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_26c4f8 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %5:texture_storage_2d<bgra8unorm, read> = load %arg_0
-    %6:vec2<i32> = load %arg_1
-    %7:vec4<f32> = textureLoad %5, %6
-    %res:ptr<function, vec4<f32>, read_write> = var, %7
-    %9:vec4<f32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_26c4f8(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_26c4f8
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_26c4f8(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_26c4f8
-    ret
-  }
+kernel void compute_main(texture2d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_26c4f8(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_26c4f8
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/26d7f1.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/26d7f1.wgsl.expected.ir.msl
index b723bdc..145bccf 100644
--- a/test/tint/builtins/gen/var/textureLoad/26d7f1.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/26d7f1.wgsl.expected.ir.msl
@@ -1,47 +1,32 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<uint, access::read> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rg32uint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_26d7f1(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  int arg_2 = 1;
+  uint4 res = tint_module_vars.arg_0.read(arg_1, arg_2);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_26d7f1 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %arg_2:ptr<function, i32, read_write> = var, 1i
-    %6:texture_storage_2d_array<rg32uint, read> = load %arg_0
-    %7:vec2<u32> = load %arg_1
-    %8:i32 = load %arg_2
-    %9:vec4<u32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<u32>, read_write> = var, %9
-    %11:vec4<u32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_26d7f1(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_26d7f1
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_26d7f1(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_26d7f1
-    ret
-  }
+kernel void compute_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_26d7f1(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_26d7f1
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/272e7a.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/272e7a.wgsl.expected.ir.msl
index 23c0818..11cc9d1 100644
--- a/test/tint/builtins/gen/var/textureLoad/272e7a.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/272e7a.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<r32float, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_272e7a(tint_module_vars_struct tint_module_vars) {
+  uint3 arg_1 = uint3(1u);
+  float4 res = tint_module_vars.arg_0.read(arg_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_272e7a = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec3<u32>, read_write> = var, vec3<u32>(1u)
-    %5:texture_storage_3d<r32float, read_write> = load %arg_0
-    %6:vec3<u32> = load %arg_1
-    %7:vec4<f32> = textureLoad %5, %6
-    %res:ptr<function, vec4<f32>, read_write> = var, %7
-    %9:vec4<f32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_272e7a(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_272e7a
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_272e7a(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_272e7a
-    ret
-  }
+kernel void compute_main(texture3d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_272e7a(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_272e7a
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/276643.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/276643.wgsl.expected.ir.msl
index e317b52..ba6ce17 100644
--- a/test/tint/builtins/gen/var/textureLoad/276643.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/276643.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<r8unorm, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_276643(tint_module_vars_struct tint_module_vars) {
+  uint arg_1 = 1u;
+  float4 res = tint_module_vars.arg_0.read(arg_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_276643 = func():void {
-  $B2: {
-    %arg_1:ptr<function, u32, read_write> = var, 1u
-    %5:texture_storage_1d<r8unorm, read> = load %arg_0
-    %6:u32 = load %arg_1
-    %7:vec4<f32> = textureLoad %5, %6
-    %res:ptr<function, vec4<f32>, read_write> = var, %7
-    %9:vec4<f32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_276643(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_276643
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_276643(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_276643
-    ret
-  }
+kernel void compute_main(texture1d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_276643(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_276643
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/276a2c.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/276a2c.wgsl.expected.ir.msl
index d3ef2b8..2ffd862 100644
--- a/test/tint/builtins/gen/var/textureLoad/276a2c.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/276a2c.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<uint, access::read> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<rgba32uint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_276a2c(tint_module_vars_struct tint_module_vars) {
+  int arg_1 = 1;
+  uint4 res = tint_module_vars.arg_0.read(uint(arg_1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_276a2c = func():void {
-  $B2: {
-    %arg_1:ptr<function, i32, read_write> = var, 1i
-    %5:texture_storage_1d<rgba32uint, read> = load %arg_0
-    %6:i32 = load %arg_1
-    %7:vec4<u32> = textureLoad %5, %6
-    %res:ptr<function, vec4<u32>, read_write> = var, %7
-    %9:vec4<u32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_276a2c(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_276a2c
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_276a2c(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_276a2c
-    ret
-  }
+kernel void compute_main(texture1d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_276a2c(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_276a2c
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/2887d7.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/2887d7.wgsl.expected.ir.msl
index 17f1b0c..71ff161 100644
--- a/test/tint/builtins/gen/var/textureLoad/2887d7.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/2887d7.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<rgba32float, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_2887d7(tint_module_vars_struct tint_module_vars) {
+  int arg_1 = 1;
+  float4 res = tint_module_vars.arg_0.read(uint(arg_1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_2887d7 = func():void {
-  $B2: {
-    %arg_1:ptr<function, i32, read_write> = var, 1i
-    %5:texture_storage_1d<rgba32float, read> = load %arg_0
-    %6:i32 = load %arg_1
-    %7:vec4<f32> = textureLoad %5, %6
-    %res:ptr<function, vec4<f32>, read_write> = var, %7
-    %9:vec4<f32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_2887d7(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_2887d7
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_2887d7(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_2887d7
-    ret
-  }
+kernel void compute_main(texture1d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_2887d7(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_2887d7
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/2a82d9.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/2a82d9.wgsl.expected.ir.msl
index 8bd0afd..9d5a505 100644
--- a/test/tint/builtins/gen/var/textureLoad/2a82d9.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/2a82d9.wgsl.expected.ir.msl
@@ -1,47 +1,32 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<int, access::read> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba32sint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_2a82d9(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  uint arg_2 = 1u;
+  int4 res = tint_module_vars.arg_0.read(arg_1, arg_2);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_2a82d9 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %arg_2:ptr<function, u32, read_write> = var, 1u
-    %6:texture_storage_2d_array<rgba32sint, read> = load %arg_0
-    %7:vec2<u32> = load %arg_1
-    %8:u32 = load %arg_2
-    %9:vec4<i32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<i32>, read_write> = var, %9
-    %11:vec4<i32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_2a82d9(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_2a82d9
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_2a82d9(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_2a82d9
-    ret
-  }
+kernel void compute_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_2a82d9(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_2a82d9
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/2ae485.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/2ae485.wgsl.expected.ir.msl
index 3bbd27f..76c3de4 100644
--- a/test/tint/builtins/gen/var/textureLoad/2ae485.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/2ae485.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<int, access::read> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<rgba16sint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_2ae485(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  int4 res = tint_module_vars.arg_0.read(uint2(arg_1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_2ae485 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %5:texture_storage_2d<rgba16sint, read> = load %arg_0
-    %6:vec2<i32> = load %arg_1
-    %7:vec4<i32> = textureLoad %5, %6
-    %res:ptr<function, vec4<i32>, read_write> = var, %7
-    %9:vec4<i32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_2ae485(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_2ae485
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_2ae485(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_2ae485
-    ret
-  }
+kernel void compute_main(texture2d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_2ae485(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_2ae485
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/2c72ae.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/2c72ae.wgsl.expected.ir.msl
index 329f1f4..5d0d1fb 100644
--- a/test/tint/builtins/gen/var/textureLoad/2c72ae.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/2c72ae.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<int, access::read> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<rgba32sint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_2c72ae(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  int4 res = tint_module_vars.arg_0.read(arg_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_2c72ae = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %5:texture_storage_2d<rgba32sint, read> = load %arg_0
-    %6:vec2<u32> = load %arg_1
-    %7:vec4<i32> = textureLoad %5, %6
-    %res:ptr<function, vec4<i32>, read_write> = var, %7
-    %9:vec4<i32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_2c72ae(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_2c72ae
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_2c72ae(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_2c72ae
-    ret
-  }
+kernel void compute_main(texture2d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_2c72ae(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_2c72ae
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/2cee30.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/2cee30.wgsl.expected.ir.msl
index 3f05ea7..822d062 100644
--- a/test/tint/builtins/gen/var/textureLoad/2cee30.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/2cee30.wgsl.expected.ir.msl
@@ -1,47 +1,32 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<int, access::read_write> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba32sint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_2cee30(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  int arg_2 = 1;
+  int4 res = tint_module_vars.arg_0.read(arg_1, arg_2);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_2cee30 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %arg_2:ptr<function, i32, read_write> = var, 1i
-    %6:texture_storage_2d_array<rgba32sint, read_write> = load %arg_0
-    %7:vec2<u32> = load %arg_1
-    %8:i32 = load %arg_2
-    %9:vec4<i32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<i32>, read_write> = var, %9
-    %11:vec4<i32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_2cee30(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_2cee30
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_2cee30(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_2cee30
-    ret
-  }
+kernel void compute_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_2cee30(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_2cee30
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/2d479c.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/2d479c.wgsl.expected.ir.msl
index c3965ac..7152d3a 100644
--- a/test/tint/builtins/gen/var/textureLoad/2d479c.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/2d479c.wgsl.expected.ir.msl
@@ -1,47 +1,33 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<float, access::sample> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_2d<f32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_2d479c(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  uint arg_2 = 1u;
+  uint const v = arg_2;
+  float4 res = tint_module_vars.arg_0.read(uint2(arg_1), v);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_2d479c = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %arg_2:ptr<function, u32, read_write> = var, 1u
-    %6:texture_2d<f32> = load %arg_0
-    %7:vec2<i32> = load %arg_1
-    %8:u32 = load %arg_2
-    %9:vec4<f32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<f32>, read_write> = var, %9
-    %11:vec4<f32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_2d479c(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_2d479c
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_2d479c(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_2d479c
-    ret
-  }
+kernel void compute_main(texture2d<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_2d479c(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_2d479c
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/2d6cf7.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/2d6cf7.wgsl.expected.ir.msl
index 0b67a02..9db9540 100644
--- a/test/tint/builtins/gen/var/textureLoad/2d6cf7.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/2d6cf7.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<int, access::read> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<rg32sint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_2d6cf7(tint_module_vars_struct tint_module_vars) {
+  int arg_1 = 1;
+  int4 res = tint_module_vars.arg_0.read(uint(arg_1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_2d6cf7 = func():void {
-  $B2: {
-    %arg_1:ptr<function, i32, read_write> = var, 1i
-    %5:texture_storage_1d<rg32sint, read> = load %arg_0
-    %6:i32 = load %arg_1
-    %7:vec4<i32> = textureLoad %5, %6
-    %res:ptr<function, vec4<i32>, read_write> = var, %7
-    %9:vec4<i32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_2d6cf7(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_2d6cf7
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_2d6cf7(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_2d6cf7
-    ret
-  }
+kernel void compute_main(texture1d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_2d6cf7(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_2d6cf7
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/2dbfc2.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/2dbfc2.wgsl.expected.ir.msl
index f150f56..3efef8e 100644
--- a/test/tint/builtins/gen/var/textureLoad/2dbfc2.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/2dbfc2.wgsl.expected.ir.msl
@@ -1,47 +1,32 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<bgra8unorm, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_2dbfc2(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  int arg_2 = 1;
+  float4 res = tint_module_vars.arg_0.read(arg_1, arg_2);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_2dbfc2 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %arg_2:ptr<function, i32, read_write> = var, 1i
-    %6:texture_storage_2d_array<bgra8unorm, read_write> = load %arg_0
-    %7:vec2<u32> = load %arg_1
-    %8:i32 = load %arg_2
-    %9:vec4<f32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<f32>, read_write> = var, %9
-    %11:vec4<f32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_2dbfc2(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_2dbfc2
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_2dbfc2(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_2dbfc2
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_2dbfc2(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_2dbfc2
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/2e09aa.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/2e09aa.wgsl.expected.ir.msl
index 7fc52c4..4d8b548 100644
--- a/test/tint/builtins/gen/var/textureLoad/2e09aa.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/2e09aa.wgsl.expected.ir.msl
@@ -1,47 +1,32 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_ms<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_multisampled_2d<f32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_2e09aa(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  uint arg_2 = 1u;
+  float4 res = tint_module_vars.arg_0.read(arg_1, arg_2);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_2e09aa = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %arg_2:ptr<function, u32, read_write> = var, 1u
-    %6:texture_multisampled_2d<f32> = load %arg_0
-    %7:vec2<u32> = load %arg_1
-    %8:u32 = load %arg_2
-    %9:vec4<f32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<f32>, read_write> = var, %9
-    %11:vec4<f32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_2e09aa(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_2e09aa
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_ms<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_2e09aa(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_2e09aa
-    ret
-  }
+kernel void compute_main(texture2d_ms<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_2e09aa(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_2e09aa
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_ms<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/2e3552.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/2e3552.wgsl.expected.ir.msl
index b13796f..59f21be 100644
--- a/test/tint/builtins/gen/var/textureLoad/2e3552.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/2e3552.wgsl.expected.ir.msl
@@ -1,47 +1,32 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<r32float, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_2e3552(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  int arg_2 = 1;
+  float4 res = tint_module_vars.arg_0.read(arg_1, arg_2);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_2e3552 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %arg_2:ptr<function, i32, read_write> = var, 1i
-    %6:texture_storage_2d_array<r32float, read> = load %arg_0
-    %7:vec2<u32> = load %arg_1
-    %8:i32 = load %arg_2
-    %9:vec4<f32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<f32>, read_write> = var, %9
-    %11:vec4<f32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_2e3552(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_2e3552
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_2e3552(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_2e3552
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_2e3552(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_2e3552
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/2eaf31.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/2eaf31.wgsl.expected.ir.msl
index bfcaf9f..9b23ae7 100644
--- a/test/tint/builtins/gen/var/textureLoad/2eaf31.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/2eaf31.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<int, access::read_write> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<rg32sint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_2eaf31(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  int4 res = tint_module_vars.arg_0.read(arg_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_2eaf31 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %5:texture_storage_2d<rg32sint, read_write> = load %arg_0
-    %6:vec2<u32> = load %arg_1
-    %7:vec4<i32> = textureLoad %5, %6
-    %res:ptr<function, vec4<i32>, read_write> = var, %7
-    %9:vec4<i32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_2eaf31(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_2eaf31
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_2eaf31(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_2eaf31
-    ret
-  }
+kernel void compute_main(texture2d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_2eaf31(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_2eaf31
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/313c73.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/313c73.wgsl.expected.ir.msl
index 893b74b..59a0488 100644
--- a/test/tint/builtins/gen/var/textureLoad/313c73.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/313c73.wgsl.expected.ir.msl
@@ -1,47 +1,32 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<int, access::read> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba16sint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_313c73(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  uint arg_2 = 1u;
+  int4 res = tint_module_vars.arg_0.read(arg_1, arg_2);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_313c73 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %arg_2:ptr<function, u32, read_write> = var, 1u
-    %6:texture_storage_2d_array<rgba16sint, read> = load %arg_0
-    %7:vec2<u32> = load %arg_1
-    %8:u32 = load %arg_2
-    %9:vec4<i32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<i32>, read_write> = var, %9
-    %11:vec4<i32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_313c73(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_313c73
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_313c73(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_313c73
-    ret
-  }
+kernel void compute_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_313c73(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_313c73
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/31db4b.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/31db4b.wgsl.expected.ir.msl
index 34289a5..076059a 100644
--- a/test/tint/builtins/gen/var/textureLoad/31db4b.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/31db4b.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<uint, access::read> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<r32uint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_31db4b(tint_module_vars_struct tint_module_vars) {
+  uint arg_1 = 1u;
+  uint4 res = tint_module_vars.arg_0.read(arg_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_31db4b = func():void {
-  $B2: {
-    %arg_1:ptr<function, u32, read_write> = var, 1u
-    %5:texture_storage_1d<r32uint, read> = load %arg_0
-    %6:u32 = load %arg_1
-    %7:vec4<u32> = textureLoad %5, %6
-    %res:ptr<function, vec4<u32>, read_write> = var, %7
-    %9:vec4<u32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_31db4b(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_31db4b
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_31db4b(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_31db4b
-    ret
-  }
+kernel void compute_main(texture1d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_31db4b(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_31db4b
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/321210.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/321210.wgsl.expected.ir.msl
index bfd37c7..a8142a7 100644
--- a/test/tint/builtins/gen/var/textureLoad/321210.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/321210.wgsl.expected.ir.msl
@@ -1,47 +1,33 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<uint, access::read> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba16uint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_321210(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  uint arg_2 = 1u;
+  uint const v = arg_2;
+  uint4 res = tint_module_vars.arg_0.read(uint2(arg_1), v);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_321210 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %arg_2:ptr<function, u32, read_write> = var, 1u
-    %6:texture_storage_2d_array<rgba16uint, read> = load %arg_0
-    %7:vec2<i32> = load %arg_1
-    %8:u32 = load %arg_2
-    %9:vec4<u32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<u32>, read_write> = var, %9
-    %11:vec4<u32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_321210(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_321210
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_321210(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_321210
-    ret
-  }
+kernel void compute_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_321210(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_321210
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/32a7b8.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/32a7b8.wgsl.expected.ir.msl
index 5d17ae5..ca474b7 100644
--- a/test/tint/builtins/gen/var/textureLoad/32a7b8.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/32a7b8.wgsl.expected.ir.msl
@@ -1,47 +1,32 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<int, access::read_write> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba8sint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_32a7b8(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  int arg_2 = 1;
+  int4 res = tint_module_vars.arg_0.read(arg_1, arg_2);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_32a7b8 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %arg_2:ptr<function, i32, read_write> = var, 1i
-    %6:texture_storage_2d_array<rgba8sint, read_write> = load %arg_0
-    %7:vec2<u32> = load %arg_1
-    %8:i32 = load %arg_2
-    %9:vec4<i32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<i32>, read_write> = var, %9
-    %11:vec4<i32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_32a7b8(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_32a7b8
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_32a7b8(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_32a7b8
-    ret
-  }
+kernel void compute_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_32a7b8(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_32a7b8
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/33d3aa.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/33d3aa.wgsl.expected.ir.msl
index 014c93a..d5d48a7 100644
--- a/test/tint/builtins/gen/var/textureLoad/33d3aa.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/33d3aa.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<int, access::read> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<rgba32sint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_33d3aa(tint_module_vars_struct tint_module_vars) {
+  uint arg_1 = 1u;
+  int4 res = tint_module_vars.arg_0.read(arg_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_33d3aa = func():void {
-  $B2: {
-    %arg_1:ptr<function, u32, read_write> = var, 1u
-    %5:texture_storage_1d<rgba32sint, read> = load %arg_0
-    %6:u32 = load %arg_1
-    %7:vec4<i32> = textureLoad %5, %6
-    %res:ptr<function, vec4<i32>, read_write> = var, %7
-    %9:vec4<i32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_33d3aa(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_33d3aa
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_33d3aa(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_33d3aa
-    ret
-  }
+kernel void compute_main(texture1d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_33d3aa(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_33d3aa
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/348827.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/348827.wgsl.expected.ir.msl
index a4c328b..b1e3e65 100644
--- a/test/tint/builtins/gen/var/textureLoad/348827.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/348827.wgsl.expected.ir.msl
@@ -1,47 +1,32 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<uint, access::read> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba32uint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_348827(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  uint arg_2 = 1u;
+  uint4 res = tint_module_vars.arg_0.read(arg_1, arg_2);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_348827 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %arg_2:ptr<function, u32, read_write> = var, 1u
-    %6:texture_storage_2d_array<rgba32uint, read> = load %arg_0
-    %7:vec2<u32> = load %arg_1
-    %8:u32 = load %arg_2
-    %9:vec4<u32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<u32>, read_write> = var, %9
-    %11:vec4<u32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_348827(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_348827
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_348827(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_348827
-    ret
-  }
+kernel void compute_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_348827(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_348827
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/34d97c.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/34d97c.wgsl.expected.ir.msl
index 1c3443a..cf874bd 100644
--- a/test/tint/builtins/gen/var/textureLoad/34d97c.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/34d97c.wgsl.expected.ir.msl
@@ -1,47 +1,33 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<uint, access::read_write> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rg32uint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_34d97c(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  int arg_2 = 1;
+  int const v = arg_2;
+  uint4 res = tint_module_vars.arg_0.read(uint2(arg_1), v);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_34d97c = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %arg_2:ptr<function, i32, read_write> = var, 1i
-    %6:texture_storage_2d_array<rg32uint, read_write> = load %arg_0
-    %7:vec2<i32> = load %arg_1
-    %8:i32 = load %arg_2
-    %9:vec4<u32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<u32>, read_write> = var, %9
-    %11:vec4<u32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_34d97c(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_34d97c
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_34d97c(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_34d97c
-    ret
-  }
+kernel void compute_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_34d97c(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_34d97c
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/35a5e2.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/35a5e2.wgsl.expected.ir.msl
index 38eac06..d9c242b 100644
--- a/test/tint/builtins/gen/var/textureLoad/35a5e2.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/35a5e2.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<r8unorm, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_35a5e2(tint_module_vars_struct tint_module_vars) {
+  int arg_1 = 1;
+  float4 res = tint_module_vars.arg_0.read(uint(arg_1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_35a5e2 = func():void {
-  $B2: {
-    %arg_1:ptr<function, i32, read_write> = var, 1i
-    %5:texture_storage_1d<r8unorm, read_write> = load %arg_0
-    %6:i32 = load %arg_1
-    %7:vec4<f32> = textureLoad %5, %6
-    %res:ptr<function, vec4<f32>, read_write> = var, %7
-    %9:vec4<f32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_35a5e2(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_35a5e2
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_35a5e2(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_35a5e2
-    ret
-  }
+kernel void compute_main(texture1d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_35a5e2(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_35a5e2
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/35d464.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/35d464.wgsl.expected.ir.msl
index e3fbc9b..52a2741 100644
--- a/test/tint/builtins/gen/var/textureLoad/35d464.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/35d464.wgsl.expected.ir.msl
@@ -1,47 +1,33 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<r8unorm, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_35d464(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  int arg_2 = 1;
+  int const v = arg_2;
+  float4 res = tint_module_vars.arg_0.read(uint2(arg_1), v);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_35d464 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %arg_2:ptr<function, i32, read_write> = var, 1i
-    %6:texture_storage_2d_array<r8unorm, read> = load %arg_0
-    %7:vec2<i32> = load %arg_1
-    %8:i32 = load %arg_2
-    %9:vec4<f32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<f32>, read_write> = var, %9
-    %11:vec4<f32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_35d464(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_35d464
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_35d464(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_35d464
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_35d464(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_35d464
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/374351.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/374351.wgsl.expected.ir.msl
index 7499b44..77279ff 100644
--- a/test/tint/builtins/gen/var/textureLoad/374351.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/374351.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<uint, access::read> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<rgba16uint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_374351(tint_module_vars_struct tint_module_vars) {
+  uint3 arg_1 = uint3(1u);
+  uint4 res = tint_module_vars.arg_0.read(arg_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_374351 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec3<u32>, read_write> = var, vec3<u32>(1u)
-    %5:texture_storage_3d<rgba16uint, read> = load %arg_0
-    %6:vec3<u32> = load %arg_1
-    %7:vec4<u32> = textureLoad %5, %6
-    %res:ptr<function, vec4<u32>, read_write> = var, %7
-    %9:vec4<u32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_374351(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_374351
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_374351(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_374351
-    ret
-  }
+kernel void compute_main(texture3d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_374351(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_374351
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/388688.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/388688.wgsl.expected.ir.msl
index 55e16d7..3d0f64e 100644
--- a/test/tint/builtins/gen/var/textureLoad/388688.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/388688.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<rgba8snorm, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_388688(tint_module_vars_struct tint_module_vars) {
+  uint arg_1 = 1u;
+  float4 res = tint_module_vars.arg_0.read(arg_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_388688 = func():void {
-  $B2: {
-    %arg_1:ptr<function, u32, read_write> = var, 1u
-    %5:texture_storage_1d<rgba8snorm, read> = load %arg_0
-    %6:u32 = load %arg_1
-    %7:vec4<f32> = textureLoad %5, %6
-    %res:ptr<function, vec4<f32>, read_write> = var, %7
-    %9:vec4<f32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_388688(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_388688
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_388688(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_388688
-    ret
-  }
+kernel void compute_main(texture1d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_388688(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_388688
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/38f8ab.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/38f8ab.wgsl.expected.ir.msl
index dd24f9f..b95fa37 100644
--- a/test/tint/builtins/gen/var/textureLoad/38f8ab.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/38f8ab.wgsl.expected.ir.msl
@@ -1,47 +1,33 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_ms<int, access::read> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_multisampled_2d<i32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_38f8ab(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  uint arg_2 = 1u;
+  uint const v = arg_2;
+  int4 res = tint_module_vars.arg_0.read(uint2(arg_1), v);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_38f8ab = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %arg_2:ptr<function, u32, read_write> = var, 1u
-    %6:texture_multisampled_2d<i32> = load %arg_0
-    %7:vec2<i32> = load %arg_1
-    %8:u32 = load %arg_2
-    %9:vec4<i32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<i32>, read_write> = var, %9
-    %11:vec4<i32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_38f8ab(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_38f8ab
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_ms<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_38f8ab(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_38f8ab
-    ret
-  }
+kernel void compute_main(texture2d_ms<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_38f8ab(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_38f8ab
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_ms<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/39016c.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/39016c.wgsl.expected.ir.msl
index 284a48d..7890567 100644
--- a/test/tint/builtins/gen/var/textureLoad/39016c.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/39016c.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<rgba8snorm, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_39016c(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  float4 res = tint_module_vars.arg_0.read(uint2(arg_1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_39016c = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %5:texture_storage_2d<rgba8snorm, read_write> = load %arg_0
-    %6:vec2<i32> = load %arg_1
-    %7:vec4<f32> = textureLoad %5, %6
-    %res:ptr<function, vec4<f32>, read_write> = var, %7
-    %9:vec4<f32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_39016c(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_39016c
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_39016c(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_39016c
-    ret
-  }
+kernel void compute_main(texture2d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_39016c(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_39016c
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/395447.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/395447.wgsl.expected.ir.msl
index 83a083d..f347709 100644
--- a/test/tint/builtins/gen/var/textureLoad/395447.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/395447.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<rgba32float, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_395447(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  float4 res = tint_module_vars.arg_0.read(arg_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_395447 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %5:texture_storage_2d<rgba32float, read_write> = load %arg_0
-    %6:vec2<u32> = load %arg_1
-    %7:vec4<f32> = textureLoad %5, %6
-    %res:ptr<function, vec4<f32>, read_write> = var, %7
-    %9:vec4<f32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_395447(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_395447
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_395447(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_395447
-    ret
-  }
+kernel void compute_main(texture2d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_395447(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_395447
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/39ef40.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/39ef40.wgsl.expected.ir.msl
index a8d5922..7415a74 100644
--- a/test/tint/builtins/gen/var/textureLoad/39ef40.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/39ef40.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<rgba16float, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_39ef40(tint_module_vars_struct tint_module_vars) {
+  uint arg_1 = 1u;
+  float4 res = tint_module_vars.arg_0.read(arg_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_39ef40 = func():void {
-  $B2: {
-    %arg_1:ptr<function, u32, read_write> = var, 1u
-    %5:texture_storage_1d<rgba16float, read> = load %arg_0
-    %6:u32 = load %arg_1
-    %7:vec4<f32> = textureLoad %5, %6
-    %res:ptr<function, vec4<f32>, read_write> = var, %7
-    %9:vec4<f32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_39ef40(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_39ef40
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_39ef40(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_39ef40
-    ret
-  }
+kernel void compute_main(texture1d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_39ef40(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_39ef40
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/3a2350.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/3a2350.wgsl.expected.ir.msl
index 7402469..c966a76 100644
--- a/test/tint/builtins/gen/var/textureLoad/3a2350.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/3a2350.wgsl.expected.ir.msl
@@ -1,47 +1,33 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<uint, access::read_write> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba16uint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_3a2350(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  uint arg_2 = 1u;
+  uint const v = arg_2;
+  uint4 res = tint_module_vars.arg_0.read(uint2(arg_1), v);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_3a2350 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %arg_2:ptr<function, u32, read_write> = var, 1u
-    %6:texture_storage_2d_array<rgba16uint, read_write> = load %arg_0
-    %7:vec2<i32> = load %arg_1
-    %8:u32 = load %arg_2
-    %9:vec4<u32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<u32>, read_write> = var, %9
-    %11:vec4<u32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_3a2350(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_3a2350
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_3a2350(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_3a2350
-    ret
-  }
+kernel void compute_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_3a2350(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_3a2350
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/3aea13.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/3aea13.wgsl.expected.ir.msl
index 3b8b443..89e52a8 100644
--- a/test/tint/builtins/gen/var/textureLoad/3aea13.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/3aea13.wgsl.expected.ir.msl
@@ -1,47 +1,33 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<int, access::read_write> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<r32sint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_3aea13(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  uint arg_2 = 1u;
+  uint const v = arg_2;
+  int4 res = tint_module_vars.arg_0.read(uint2(arg_1), v);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_3aea13 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %arg_2:ptr<function, u32, read_write> = var, 1u
-    %6:texture_storage_2d_array<r32sint, read_write> = load %arg_0
-    %7:vec2<i32> = load %arg_1
-    %8:u32 = load %arg_2
-    %9:vec4<i32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<i32>, read_write> = var, %9
-    %11:vec4<i32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_3aea13(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_3aea13
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_3aea13(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_3aea13
-    ret
-  }
+kernel void compute_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_3aea13(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_3aea13
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/3bbc2b.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/3bbc2b.wgsl.expected.ir.msl
index 092c140..96ef135 100644
--- a/test/tint/builtins/gen/var/textureLoad/3bbc2b.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/3bbc2b.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<r32float, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_3bbc2b(tint_module_vars_struct tint_module_vars) {
+  int arg_1 = 1;
+  float4 res = tint_module_vars.arg_0.read(uint(arg_1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_3bbc2b = func():void {
-  $B2: {
-    %arg_1:ptr<function, i32, read_write> = var, 1i
-    %5:texture_storage_1d<r32float, read_write> = load %arg_0
-    %6:i32 = load %arg_1
-    %7:vec4<f32> = textureLoad %5, %6
-    %res:ptr<function, vec4<f32>, read_write> = var, %7
-    %9:vec4<f32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_3bbc2b(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_3bbc2b
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_3bbc2b(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_3bbc2b
-    ret
-  }
+kernel void compute_main(texture1d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_3bbc2b(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_3bbc2b
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/3c0d9e.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/3c0d9e.wgsl.expected.ir.msl
index 56c9743..aebb668 100644
--- a/test/tint/builtins/gen/var/textureLoad/3c0d9e.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/3c0d9e.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<uint, access::read> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<rgba8uint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_3c0d9e(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  uint4 res = tint_module_vars.arg_0.read(uint2(arg_1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_3c0d9e = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %5:texture_storage_2d<rgba8uint, read> = load %arg_0
-    %6:vec2<i32> = load %arg_1
-    %7:vec4<u32> = textureLoad %5, %6
-    %res:ptr<function, vec4<u32>, read_write> = var, %7
-    %9:vec4<u32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_3c0d9e(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_3c0d9e
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_3c0d9e(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_3c0d9e
-    ret
-  }
+kernel void compute_main(texture2d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_3c0d9e(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_3c0d9e
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/3c9587.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/3c9587.wgsl.expected.ir.msl
index e671e36..cb7caf1 100644
--- a/test/tint/builtins/gen/var/textureLoad/3c9587.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/3c9587.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<rgba8unorm, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_3c9587(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  float4 res = tint_module_vars.arg_0.read(uint2(arg_1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_3c9587 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %5:texture_storage_2d<rgba8unorm, read> = load %arg_0
-    %6:vec2<i32> = load %arg_1
-    %7:vec4<f32> = textureLoad %5, %6
-    %res:ptr<function, vec4<f32>, read_write> = var, %7
-    %9:vec4<f32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_3c9587(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_3c9587
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_3c9587(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_3c9587
-    ret
-  }
+kernel void compute_main(texture2d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_3c9587(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_3c9587
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/3c96e8.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/3c96e8.wgsl.expected.ir.msl
index 38b717e..eba7280 100644
--- a/test/tint/builtins/gen/var/textureLoad/3c96e8.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/3c96e8.wgsl.expected.ir.msl
@@ -1,49 +1,35 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::sample> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_2d_array<f32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_3c96e8(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  uint arg_2 = 1u;
+  uint arg_3 = 1u;
+  uint const v = arg_2;
+  uint const v_1 = arg_3;
+  float4 res = tint_module_vars.arg_0.read(uint2(arg_1), v, v_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_3c96e8 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %arg_2:ptr<function, u32, read_write> = var, 1u
-    %arg_3:ptr<function, u32, read_write> = var, 1u
-    %7:texture_2d_array<f32> = load %arg_0
-    %8:vec2<i32> = load %arg_1
-    %9:u32 = load %arg_2
-    %10:u32 = load %arg_3
-    %11:vec4<f32> = textureLoad %7, %8, %9, %10
-    %res:ptr<function, vec4<f32>, read_write> = var, %11
-    %13:vec4<f32> = load %res
-    store %prevent_dce, %13
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_3c96e8(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %15:void = call %textureLoad_3c96e8
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_3c96e8(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %17:void = call %textureLoad_3c96e8
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_3c96e8(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %19:void = call %textureLoad_3c96e8
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/3cfb9c.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/3cfb9c.wgsl.expected.ir.msl
index 177df6e..03a7e69 100644
--- a/test/tint/builtins/gen/var/textureLoad/3cfb9c.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/3cfb9c.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<uint, access::read_write> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<rgba8uint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_3cfb9c(tint_module_vars_struct tint_module_vars) {
+  int3 arg_1 = int3(1);
+  uint4 res = tint_module_vars.arg_0.read(uint3(arg_1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_3cfb9c = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec3<i32>, read_write> = var, vec3<i32>(1i)
-    %5:texture_storage_3d<rgba8uint, read_write> = load %arg_0
-    %6:vec3<i32> = load %arg_1
-    %7:vec4<u32> = textureLoad %5, %6
-    %res:ptr<function, vec4<u32>, read_write> = var, %7
-    %9:vec4<u32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_3cfb9c(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_3cfb9c
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_3cfb9c(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_3cfb9c
-    ret
-  }
+kernel void compute_main(texture3d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_3cfb9c(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_3cfb9c
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/3d001b.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/3d001b.wgsl.expected.ir.msl
index ee2833b..61d8ebc 100644
--- a/test/tint/builtins/gen/var/textureLoad/3d001b.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/3d001b.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<int, access::read> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<rgba8sint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_3d001b(tint_module_vars_struct tint_module_vars) {
+  int3 arg_1 = int3(1);
+  int4 res = tint_module_vars.arg_0.read(uint3(arg_1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_3d001b = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec3<i32>, read_write> = var, vec3<i32>(1i)
-    %5:texture_storage_3d<rgba8sint, read> = load %arg_0
-    %6:vec3<i32> = load %arg_1
-    %7:vec4<i32> = textureLoad %5, %6
-    %res:ptr<function, vec4<i32>, read_write> = var, %7
-    %9:vec4<i32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_3d001b(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_3d001b
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_3d001b(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_3d001b
-    ret
-  }
+kernel void compute_main(texture3d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_3d001b(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_3d001b
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/3d3fd1.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/3d3fd1.wgsl.expected.ir.msl
index 3880586..8bd688b 100644
--- a/test/tint/builtins/gen/var/textureLoad/3d3fd1.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/3d3fd1.wgsl.expected.ir.msl
@@ -1,49 +1,33 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<int, access::sample> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_2d_array<i32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_3d3fd1(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  uint arg_2 = 1u;
+  int arg_3 = 1;
+  int4 res = tint_module_vars.arg_0.read(arg_1, arg_2, arg_3);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_3d3fd1 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %arg_2:ptr<function, u32, read_write> = var, 1u
-    %arg_3:ptr<function, i32, read_write> = var, 1i
-    %7:texture_2d_array<i32> = load %arg_0
-    %8:vec2<u32> = load %arg_1
-    %9:u32 = load %arg_2
-    %10:i32 = load %arg_3
-    %11:vec4<i32> = textureLoad %7, %8, %9, %10
-    %res:ptr<function, vec4<i32>, read_write> = var, %11
-    %13:vec4<i32> = load %res
-    store %prevent_dce, %13
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_3d3fd1(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %15:void = call %textureLoad_3d3fd1
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_3d3fd1(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %17:void = call %textureLoad_3d3fd1
-    ret
-  }
+kernel void compute_main(texture2d_array<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_3d3fd1(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %19:void = call %textureLoad_3d3fd1
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/3d9c90.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/3d9c90.wgsl.expected.ir.msl
index b2074e3..22f229a 100644
--- a/test/tint/builtins/gen/var/textureLoad/3d9c90.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/3d9c90.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<rgba32float, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_3d9c90(tint_module_vars_struct tint_module_vars) {
+  int3 arg_1 = int3(1);
+  float4 res = tint_module_vars.arg_0.read(uint3(arg_1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_3d9c90 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec3<i32>, read_write> = var, vec3<i32>(1i)
-    %5:texture_storage_3d<rgba32float, read> = load %arg_0
-    %6:vec3<i32> = load %arg_1
-    %7:vec4<f32> = textureLoad %5, %6
-    %res:ptr<function, vec4<f32>, read_write> = var, %7
-    %9:vec4<f32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_3d9c90(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_3d9c90
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_3d9c90(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_3d9c90
-    ret
-  }
+kernel void compute_main(texture3d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_3d9c90(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_3d9c90
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/3da3ed.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/3da3ed.wgsl.expected.ir.msl
index e2fd7b8..c5ec05c 100644
--- a/test/tint/builtins/gen/var/textureLoad/3da3ed.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/3da3ed.wgsl.expected.ir.msl
@@ -1,47 +1,32 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<float, access::sample> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_1d<f32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_3da3ed(tint_module_vars_struct tint_module_vars) {
+  int arg_1 = 1;
+  uint arg_2 = 1u;
+  float4 res = tint_module_vars.arg_0.read(uint(arg_1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_3da3ed = func():void {
-  $B2: {
-    %arg_1:ptr<function, i32, read_write> = var, 1i
-    %arg_2:ptr<function, u32, read_write> = var, 1u
-    %6:texture_1d<f32> = load %arg_0
-    %7:i32 = load %arg_1
-    %8:u32 = load %arg_2
-    %9:vec4<f32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<f32>, read_write> = var, %9
-    %11:vec4<f32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_3da3ed(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_3da3ed
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_3da3ed(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_3da3ed
-    ret
-  }
+kernel void compute_main(texture1d<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_3da3ed(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_3da3ed
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/3e16a8.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/3e16a8.wgsl.expected.ir.msl
index 25463ec..1838ea5 100644
--- a/test/tint/builtins/gen/var/textureLoad/3e16a8.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/3e16a8.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<r8unorm, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_3e16a8(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  float4 res = tint_module_vars.arg_0.read(uint2(arg_1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_3e16a8 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %5:texture_storage_2d<r8unorm, read_write> = load %arg_0
-    %6:vec2<i32> = load %arg_1
-    %7:vec4<f32> = textureLoad %5, %6
-    %res:ptr<function, vec4<f32>, read_write> = var, %7
-    %9:vec4<f32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_3e16a8(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_3e16a8
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_3e16a8(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_3e16a8
-    ret
-  }
+kernel void compute_main(texture2d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_3e16a8(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_3e16a8
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/3e5f6a.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/3e5f6a.wgsl.expected.ir.msl
index da1add5..7b48cec 100644
--- a/test/tint/builtins/gen/var/textureLoad/3e5f6a.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/3e5f6a.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<rgba16float, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_3e5f6a(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  float4 res = tint_module_vars.arg_0.read(arg_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_3e5f6a = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %5:texture_storage_2d<rgba16float, read> = load %arg_0
-    %6:vec2<u32> = load %arg_1
-    %7:vec4<f32> = textureLoad %5, %6
-    %res:ptr<function, vec4<f32>, read_write> = var, %7
-    %9:vec4<f32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_3e5f6a(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_3e5f6a
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_3e5f6a(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_3e5f6a
-    ret
-  }
+kernel void compute_main(texture2d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_3e5f6a(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_3e5f6a
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/40ee8b.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/40ee8b.wgsl.expected.ir.msl
index fce3062..5d5beed 100644
--- a/test/tint/builtins/gen/var/textureLoad/40ee8b.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/40ee8b.wgsl.expected.ir.msl
@@ -1,47 +1,33 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<int, access::read_write> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba32sint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_40ee8b(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  uint arg_2 = 1u;
+  uint const v = arg_2;
+  int4 res = tint_module_vars.arg_0.read(uint2(arg_1), v);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_40ee8b = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %arg_2:ptr<function, u32, read_write> = var, 1u
-    %6:texture_storage_2d_array<rgba32sint, read_write> = load %arg_0
-    %7:vec2<i32> = load %arg_1
-    %8:u32 = load %arg_2
-    %9:vec4<i32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<i32>, read_write> = var, %9
-    %11:vec4<i32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_40ee8b(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_40ee8b
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_40ee8b(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_40ee8b
-    ret
-  }
+kernel void compute_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_40ee8b(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_40ee8b
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/4212a1.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/4212a1.wgsl.expected.ir.msl
index 07c3f7f..ca0fd54 100644
--- a/test/tint/builtins/gen/var/textureLoad/4212a1.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/4212a1.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<int, access::read_write> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<rgba32sint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_4212a1(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  int4 res = tint_module_vars.arg_0.read(uint2(arg_1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_4212a1 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %5:texture_storage_2d<rgba32sint, read_write> = load %arg_0
-    %6:vec2<i32> = load %arg_1
-    %7:vec4<i32> = textureLoad %5, %6
-    %res:ptr<function, vec4<i32>, read_write> = var, %7
-    %9:vec4<i32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_4212a1(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_4212a1
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_4212a1(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_4212a1
-    ret
-  }
+kernel void compute_main(texture2d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_4212a1(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_4212a1
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/424afd.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/424afd.wgsl.expected.ir.msl
index 310bcdd..bd4dde1 100644
--- a/test/tint/builtins/gen/var/textureLoad/424afd.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/424afd.wgsl.expected.ir.msl
@@ -1,47 +1,33 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<int, access::read_write> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rg32sint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_424afd(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  int arg_2 = 1;
+  int const v = arg_2;
+  int4 res = tint_module_vars.arg_0.read(uint2(arg_1), v);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_424afd = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %arg_2:ptr<function, i32, read_write> = var, 1i
-    %6:texture_storage_2d_array<rg32sint, read_write> = load %arg_0
-    %7:vec2<i32> = load %arg_1
-    %8:i32 = load %arg_2
-    %9:vec4<i32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<i32>, read_write> = var, %9
-    %11:vec4<i32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_424afd(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_424afd
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_424afd(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_424afd
-    ret
-  }
+kernel void compute_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_424afd(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_424afd
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/42a631.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/42a631.wgsl.expected.ir.msl
index 5756f18..3744acb 100644
--- a/test/tint/builtins/gen/var/textureLoad/42a631.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/42a631.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<rgba16float, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_42a631(tint_module_vars_struct tint_module_vars) {
+  int arg_1 = 1;
+  float4 res = tint_module_vars.arg_0.read(uint(arg_1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_42a631 = func():void {
-  $B2: {
-    %arg_1:ptr<function, i32, read_write> = var, 1i
-    %5:texture_storage_1d<rgba16float, read_write> = load %arg_0
-    %6:i32 = load %arg_1
-    %7:vec4<f32> = textureLoad %5, %6
-    %res:ptr<function, vec4<f32>, read_write> = var, %7
-    %9:vec4<f32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_42a631(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_42a631
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_42a631(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_42a631
-    ret
-  }
+kernel void compute_main(texture1d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_42a631(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_42a631
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/43484a.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/43484a.wgsl.expected.ir.msl
index 28224ea..3864f30 100644
--- a/test/tint/builtins/gen/var/textureLoad/43484a.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/43484a.wgsl.expected.ir.msl
@@ -1,47 +1,32 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<r32float, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_43484a(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  uint arg_2 = 1u;
+  float4 res = tint_module_vars.arg_0.read(arg_1, arg_2);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_43484a = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %arg_2:ptr<function, u32, read_write> = var, 1u
-    %6:texture_storage_2d_array<r32float, read_write> = load %arg_0
-    %7:vec2<u32> = load %arg_1
-    %8:u32 = load %arg_2
-    %9:vec4<f32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<f32>, read_write> = var, %9
-    %11:vec4<f32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_43484a(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_43484a
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_43484a(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_43484a
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_43484a(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_43484a
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/439e2a.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/439e2a.wgsl.expected.ir.msl
index de367b2..e4a86e5 100644
--- a/test/tint/builtins/gen/var/textureLoad/439e2a.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/439e2a.wgsl.expected.ir.msl
@@ -1,47 +1,32 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<float, access::sample> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_2d<f32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_439e2a(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  int arg_2 = 1;
+  float4 res = tint_module_vars.arg_0.read(arg_1, arg_2);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_439e2a = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %arg_2:ptr<function, i32, read_write> = var, 1i
-    %6:texture_2d<f32> = load %arg_0
-    %7:vec2<u32> = load %arg_1
-    %8:i32 = load %arg_2
-    %9:vec4<f32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<f32>, read_write> = var, %9
-    %11:vec4<f32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_439e2a(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_439e2a
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_439e2a(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_439e2a
-    ret
-  }
+kernel void compute_main(texture2d<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_439e2a(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_439e2a
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/43cd86.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/43cd86.wgsl.expected.ir.msl
index b42780e..0acb1aa 100644
--- a/test/tint/builtins/gen/var/textureLoad/43cd86.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/43cd86.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<rgba8snorm, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_43cd86(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  float4 res = tint_module_vars.arg_0.read(arg_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_43cd86 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %5:texture_storage_2d<rgba8snorm, read_write> = load %arg_0
-    %6:vec2<u32> = load %arg_1
-    %7:vec4<f32> = textureLoad %5, %6
-    %res:ptr<function, vec4<f32>, read_write> = var, %7
-    %9:vec4<f32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_43cd86(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_43cd86
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_43cd86(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_43cd86
-    ret
-  }
+kernel void compute_main(texture2d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_43cd86(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_43cd86
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/44c826.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/44c826.wgsl.expected.ir.msl
index 4f7c8df..201b835 100644
--- a/test/tint/builtins/gen/var/textureLoad/44c826.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/44c826.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<uint, access::read> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<rg32uint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_44c826(tint_module_vars_struct tint_module_vars) {
+  uint arg_1 = 1u;
+  uint4 res = tint_module_vars.arg_0.read(arg_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_44c826 = func():void {
-  $B2: {
-    %arg_1:ptr<function, u32, read_write> = var, 1u
-    %5:texture_storage_1d<rg32uint, read> = load %arg_0
-    %6:u32 = load %arg_1
-    %7:vec4<u32> = textureLoad %5, %6
-    %res:ptr<function, vec4<u32>, read_write> = var, %7
-    %9:vec4<u32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_44c826(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_44c826
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_44c826(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_44c826
-    ret
-  }
+kernel void compute_main(texture1d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_44c826(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_44c826
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/4542ae.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/4542ae.wgsl.expected.ir.msl
index 559a3ca..0c3ab47 100644
--- a/test/tint/builtins/gen/var/textureLoad/4542ae.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/4542ae.wgsl.expected.ir.msl
@@ -1,47 +1,33 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba8unorm, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_4542ae(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  int arg_2 = 1;
+  int const v = arg_2;
+  float4 res = tint_module_vars.arg_0.read(uint2(arg_1), v);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_4542ae = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %arg_2:ptr<function, i32, read_write> = var, 1i
-    %6:texture_storage_2d_array<rgba8unorm, read_write> = load %arg_0
-    %7:vec2<i32> = load %arg_1
-    %8:i32 = load %arg_2
-    %9:vec4<f32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<f32>, read_write> = var, %9
-    %11:vec4<f32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_4542ae(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_4542ae
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_4542ae(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_4542ae
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_4542ae(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_4542ae
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/454347.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/454347.wgsl.expected.ir.msl
index cfcc76b..13d2a10 100644
--- a/test/tint/builtins/gen/var/textureLoad/454347.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/454347.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<uint, access::read> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<rgba32uint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_454347(tint_module_vars_struct tint_module_vars) {
+  uint arg_1 = 1u;
+  uint4 res = tint_module_vars.arg_0.read(arg_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_454347 = func():void {
-  $B2: {
-    %arg_1:ptr<function, u32, read_write> = var, 1u
-    %5:texture_storage_1d<rgba32uint, read> = load %arg_0
-    %6:u32 = load %arg_1
-    %7:vec4<u32> = textureLoad %5, %6
-    %res:ptr<function, vec4<u32>, read_write> = var, %7
-    %9:vec4<u32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_454347(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_454347
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_454347(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_454347
-    ret
-  }
+kernel void compute_main(texture1d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_454347(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_454347
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/4638a0.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/4638a0.wgsl.expected.ir.msl
index 574a520..c4c29a4 100644
--- a/test/tint/builtins/gen/var/textureLoad/4638a0.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/4638a0.wgsl.expected.ir.msl
@@ -1,47 +1,33 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<int, access::read> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba16sint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_4638a0(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  uint arg_2 = 1u;
+  uint const v = arg_2;
+  int4 res = tint_module_vars.arg_0.read(uint2(arg_1), v);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_4638a0 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %arg_2:ptr<function, u32, read_write> = var, 1u
-    %6:texture_storage_2d_array<rgba16sint, read> = load %arg_0
-    %7:vec2<i32> = load %arg_1
-    %8:u32 = load %arg_2
-    %9:vec4<i32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<i32>, read_write> = var, %9
-    %11:vec4<i32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_4638a0(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_4638a0
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_4638a0(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_4638a0
-    ret
-  }
+kernel void compute_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_4638a0(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_4638a0
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/469912.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/469912.wgsl.expected.ir.msl
index 1b6aa80..d56ba2b 100644
--- a/test/tint/builtins/gen/var/textureLoad/469912.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/469912.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<int, access::read_write> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<rg32sint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_469912(tint_module_vars_struct tint_module_vars) {
+  int arg_1 = 1;
+  int4 res = tint_module_vars.arg_0.read(uint(arg_1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_469912 = func():void {
-  $B2: {
-    %arg_1:ptr<function, i32, read_write> = var, 1i
-    %5:texture_storage_1d<rg32sint, read_write> = load %arg_0
-    %6:i32 = load %arg_1
-    %7:vec4<i32> = textureLoad %5, %6
-    %res:ptr<function, vec4<i32>, read_write> = var, %7
-    %9:vec4<i32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_469912(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_469912
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_469912(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_469912
-    ret
-  }
+kernel void compute_main(texture1d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_469912(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_469912
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/46a93f.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/46a93f.wgsl.expected.ir.msl
index d66db07..97aab22 100644
--- a/test/tint/builtins/gen/var/textureLoad/46a93f.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/46a93f.wgsl.expected.ir.msl
@@ -1,49 +1,33 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::sample> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_2d_array<f32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_46a93f(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  int arg_2 = 1;
+  uint arg_3 = 1u;
+  float4 res = tint_module_vars.arg_0.read(arg_1, arg_2, arg_3);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_46a93f = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %arg_2:ptr<function, i32, read_write> = var, 1i
-    %arg_3:ptr<function, u32, read_write> = var, 1u
-    %7:texture_2d_array<f32> = load %arg_0
-    %8:vec2<u32> = load %arg_1
-    %9:i32 = load %arg_2
-    %10:u32 = load %arg_3
-    %11:vec4<f32> = textureLoad %7, %8, %9, %10
-    %res:ptr<function, vec4<f32>, read_write> = var, %11
-    %13:vec4<f32> = load %res
-    store %prevent_dce, %13
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_46a93f(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %15:void = call %textureLoad_46a93f
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_46a93f(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %17:void = call %textureLoad_46a93f
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_46a93f(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %19:void = call %textureLoad_46a93f
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/46dbf5.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/46dbf5.wgsl.expected.ir.msl
index e30f515..84a55b7 100644
--- a/test/tint/builtins/gen/var/textureLoad/46dbf5.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/46dbf5.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<rgba8unorm, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_46dbf5(tint_module_vars_struct tint_module_vars) {
+  uint3 arg_1 = uint3(1u);
+  float4 res = tint_module_vars.arg_0.read(arg_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_46dbf5 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec3<u32>, read_write> = var, vec3<u32>(1u)
-    %5:texture_storage_3d<rgba8unorm, read> = load %arg_0
-    %6:vec3<u32> = load %arg_1
-    %7:vec4<f32> = textureLoad %5, %6
-    %res:ptr<function, vec4<f32>, read_write> = var, %7
-    %9:vec4<f32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_46dbf5(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_46dbf5
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_46dbf5(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_46dbf5
-    ret
-  }
+kernel void compute_main(texture3d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_46dbf5(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_46dbf5
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/473d3e.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/473d3e.wgsl.expected.ir.msl
index 1d47fd3..ff52163 100644
--- a/test/tint/builtins/gen/var/textureLoad/473d3e.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/473d3e.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<rgba32float, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_473d3e(tint_module_vars_struct tint_module_vars) {
+  uint3 arg_1 = uint3(1u);
+  float4 res = tint_module_vars.arg_0.read(arg_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_473d3e = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec3<u32>, read_write> = var, vec3<u32>(1u)
-    %5:texture_storage_3d<rgba32float, read_write> = load %arg_0
-    %6:vec3<u32> = load %arg_1
-    %7:vec4<f32> = textureLoad %5, %6
-    %res:ptr<function, vec4<f32>, read_write> = var, %7
-    %9:vec4<f32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_473d3e(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_473d3e
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_473d3e(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_473d3e
-    ret
-  }
+kernel void compute_main(texture3d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_473d3e(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_473d3e
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/47e818.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/47e818.wgsl.expected.ir.msl
index 8720931..2278585 100644
--- a/test/tint/builtins/gen/var/textureLoad/47e818.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/47e818.wgsl.expected.ir.msl
@@ -1,47 +1,32 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<int, access::sample> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_3d<i32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_47e818(tint_module_vars_struct tint_module_vars) {
+  uint3 arg_1 = uint3(1u);
+  uint arg_2 = 1u;
+  int4 res = tint_module_vars.arg_0.read(arg_1, arg_2);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_47e818 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec3<u32>, read_write> = var, vec3<u32>(1u)
-    %arg_2:ptr<function, u32, read_write> = var, 1u
-    %6:texture_3d<i32> = load %arg_0
-    %7:vec3<u32> = load %arg_1
-    %8:u32 = load %arg_2
-    %9:vec4<i32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<i32>, read_write> = var, %9
-    %11:vec4<i32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_47e818(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_47e818
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_47e818(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_47e818
-    ret
-  }
+kernel void compute_main(texture3d<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_47e818(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_47e818
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/482627.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/482627.wgsl.expected.ir.msl
index 30f8c21..a4484fe 100644
--- a/test/tint/builtins/gen/var/textureLoad/482627.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/482627.wgsl.expected.ir.msl
@@ -1,47 +1,32 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rg32float, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_482627(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  uint arg_2 = 1u;
+  float4 res = tint_module_vars.arg_0.read(arg_1, arg_2);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_482627 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %arg_2:ptr<function, u32, read_write> = var, 1u
-    %6:texture_storage_2d_array<rg32float, read_write> = load %arg_0
-    %7:vec2<u32> = load %arg_1
-    %8:u32 = load %arg_2
-    %9:vec4<f32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<f32>, read_write> = var, %9
-    %11:vec4<f32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_482627(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_482627
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_482627(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_482627
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_482627(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_482627
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/484344.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/484344.wgsl.expected.ir.msl
index 8102f2a..c7f36f3 100644
--- a/test/tint/builtins/gen/var/textureLoad/484344.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/484344.wgsl.expected.ir.msl
@@ -1,47 +1,33 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<float, access::sample> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_2d<f32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_484344(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  int arg_2 = 1;
+  int const v = arg_2;
+  float4 res = tint_module_vars.arg_0.read(uint2(arg_1), v);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_484344 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %arg_2:ptr<function, i32, read_write> = var, 1i
-    %6:texture_2d<f32> = load %arg_0
-    %7:vec2<i32> = load %arg_1
-    %8:i32 = load %arg_2
-    %9:vec4<f32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<f32>, read_write> = var, %9
-    %11:vec4<f32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_484344(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_484344
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_484344(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_484344
-    ret
-  }
+kernel void compute_main(texture2d<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_484344(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_484344
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/4951bb.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/4951bb.wgsl.expected.ir.msl
index cdd33b6..158b0a0 100644
--- a/test/tint/builtins/gen/var/textureLoad/4951bb.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/4951bb.wgsl.expected.ir.msl
@@ -1,47 +1,32 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<r8unorm, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_4951bb(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  int arg_2 = 1;
+  float4 res = tint_module_vars.arg_0.read(arg_1, arg_2);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_4951bb = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %arg_2:ptr<function, i32, read_write> = var, 1i
-    %6:texture_storage_2d_array<r8unorm, read> = load %arg_0
-    %7:vec2<u32> = load %arg_1
-    %8:i32 = load %arg_2
-    %9:vec4<f32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<f32>, read_write> = var, %9
-    %11:vec4<f32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_4951bb(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_4951bb
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_4951bb(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_4951bb
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_4951bb(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_4951bb
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/49f76f.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/49f76f.wgsl.expected.ir.msl
index 1584dfd..591021e 100644
--- a/test/tint/builtins/gen/var/textureLoad/49f76f.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/49f76f.wgsl.expected.ir.msl
@@ -1,47 +1,32 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_ms<uint, access::read> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_multisampled_2d<u32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_49f76f(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  uint arg_2 = 1u;
+  uint4 res = tint_module_vars.arg_0.read(arg_1, arg_2);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_49f76f = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %arg_2:ptr<function, u32, read_write> = var, 1u
-    %6:texture_multisampled_2d<u32> = load %arg_0
-    %7:vec2<u32> = load %arg_1
-    %8:u32 = load %arg_2
-    %9:vec4<u32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<u32>, read_write> = var, %9
-    %11:vec4<u32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_49f76f(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_49f76f
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_ms<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_49f76f(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_49f76f
-    ret
-  }
+kernel void compute_main(texture2d_ms<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_49f76f(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_49f76f
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_ms<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/4a5c55.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/4a5c55.wgsl.expected.ir.msl
index 13d184b..4915ea1 100644
--- a/test/tint/builtins/gen/var/textureLoad/4a5c55.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/4a5c55.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<int, access::read_write> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<rgba8sint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_4a5c55(tint_module_vars_struct tint_module_vars) {
+  uint3 arg_1 = uint3(1u);
+  int4 res = tint_module_vars.arg_0.read(arg_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_4a5c55 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec3<u32>, read_write> = var, vec3<u32>(1u)
-    %5:texture_storage_3d<rgba8sint, read_write> = load %arg_0
-    %6:vec3<u32> = load %arg_1
-    %7:vec4<i32> = textureLoad %5, %6
-    %res:ptr<function, vec4<i32>, read_write> = var, %7
-    %9:vec4<i32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_4a5c55(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_4a5c55
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_4a5c55(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_4a5c55
-    ret
-  }
+kernel void compute_main(texture3d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_4a5c55(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_4a5c55
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/4acb64.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/4acb64.wgsl.expected.ir.msl
index b2fc88a..ffeb534 100644
--- a/test/tint/builtins/gen/var/textureLoad/4acb64.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/4acb64.wgsl.expected.ir.msl
@@ -1,49 +1,35 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::sample> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_2d_array<f32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_4acb64(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  uint arg_2 = 1u;
+  int arg_3 = 1;
+  uint const v = arg_2;
+  int const v_1 = arg_3;
+  float4 res = tint_module_vars.arg_0.read(uint2(arg_1), v, v_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_4acb64 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %arg_2:ptr<function, u32, read_write> = var, 1u
-    %arg_3:ptr<function, i32, read_write> = var, 1i
-    %7:texture_2d_array<f32> = load %arg_0
-    %8:vec2<i32> = load %arg_1
-    %9:u32 = load %arg_2
-    %10:i32 = load %arg_3
-    %11:vec4<f32> = textureLoad %7, %8, %9, %10
-    %res:ptr<function, vec4<f32>, read_write> = var, %11
-    %13:vec4<f32> = load %res
-    store %prevent_dce, %13
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_4acb64(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %15:void = call %textureLoad_4acb64
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_4acb64(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %17:void = call %textureLoad_4acb64
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_4acb64(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %19:void = call %textureLoad_4acb64
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/4c15b2.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/4c15b2.wgsl.expected.ir.msl
index 3cf1040..d325d4f 100644
--- a/test/tint/builtins/gen/var/textureLoad/4c15b2.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/4c15b2.wgsl.expected.ir.msl
@@ -1,47 +1,33 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba32float, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_4c15b2(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  int arg_2 = 1;
+  int const v = arg_2;
+  float4 res = tint_module_vars.arg_0.read(uint2(arg_1), v);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_4c15b2 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %arg_2:ptr<function, i32, read_write> = var, 1i
-    %6:texture_storage_2d_array<rgba32float, read_write> = load %arg_0
-    %7:vec2<i32> = load %arg_1
-    %8:i32 = load %arg_2
-    %9:vec4<f32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<f32>, read_write> = var, %9
-    %11:vec4<f32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_4c15b2(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_4c15b2
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_4c15b2(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_4c15b2
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_4c15b2(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_4c15b2
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/4c1a1e.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/4c1a1e.wgsl.expected.ir.msl
index e9c823d..cb28041 100644
--- a/test/tint/builtins/gen/var/textureLoad/4c1a1e.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/4c1a1e.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<uint, access::read_write> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<rg32uint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_4c1a1e(tint_module_vars_struct tint_module_vars) {
+  int3 arg_1 = int3(1);
+  uint4 res = tint_module_vars.arg_0.read(uint3(arg_1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_4c1a1e = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec3<i32>, read_write> = var, vec3<i32>(1i)
-    %5:texture_storage_3d<rg32uint, read_write> = load %arg_0
-    %6:vec3<i32> = load %arg_1
-    %7:vec4<u32> = textureLoad %5, %6
-    %res:ptr<function, vec4<u32>, read_write> = var, %7
-    %9:vec4<u32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_4c1a1e(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_4c1a1e
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_4c1a1e(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_4c1a1e
-    ret
-  }
+kernel void compute_main(texture3d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_4c1a1e(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_4c1a1e
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/4c423f.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/4c423f.wgsl.expected.ir.msl
index e4b523a..359887b 100644
--- a/test/tint/builtins/gen/var/textureLoad/4c423f.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/4c423f.wgsl.expected.ir.msl
@@ -1,47 +1,32 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<int, access::sample> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_1d<i32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_4c423f(tint_module_vars_struct tint_module_vars) {
+  uint arg_1 = 1u;
+  int arg_2 = 1;
+  int4 res = tint_module_vars.arg_0.read(arg_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_4c423f = func():void {
-  $B2: {
-    %arg_1:ptr<function, u32, read_write> = var, 1u
-    %arg_2:ptr<function, i32, read_write> = var, 1i
-    %6:texture_1d<i32> = load %arg_0
-    %7:u32 = load %arg_1
-    %8:i32 = load %arg_2
-    %9:vec4<i32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<i32>, read_write> = var, %9
-    %11:vec4<i32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_4c423f(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_4c423f
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_4c423f(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_4c423f
-    ret
-  }
+kernel void compute_main(texture1d<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_4c423f(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_4c423f
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/4c67be.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/4c67be.wgsl.expected.ir.msl
index 4d50435..f8e8584 100644
--- a/test/tint/builtins/gen/var/textureLoad/4c67be.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/4c67be.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<r32float, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_4c67be(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  float4 res = tint_module_vars.arg_0.read(arg_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_4c67be = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %5:texture_storage_2d<r32float, read> = load %arg_0
-    %6:vec2<u32> = load %arg_1
-    %7:vec4<f32> = textureLoad %5, %6
-    %res:ptr<function, vec4<f32>, read_write> = var, %7
-    %9:vec4<f32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_4c67be(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_4c67be
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_4c67be(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_4c67be
-    ret
-  }
+kernel void compute_main(texture2d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_4c67be(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_4c67be
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/4ccf9a.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/4ccf9a.wgsl.expected.ir.msl
index 415d25f..c0dcdd7 100644
--- a/test/tint/builtins/gen/var/textureLoad/4ccf9a.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/4ccf9a.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<uint, access::read_write> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<rg32uint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_4ccf9a(tint_module_vars_struct tint_module_vars) {
+  uint3 arg_1 = uint3(1u);
+  uint4 res = tint_module_vars.arg_0.read(arg_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_4ccf9a = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec3<u32>, read_write> = var, vec3<u32>(1u)
-    %5:texture_storage_3d<rg32uint, read_write> = load %arg_0
-    %6:vec3<u32> = load %arg_1
-    %7:vec4<u32> = textureLoad %5, %6
-    %res:ptr<function, vec4<u32>, read_write> = var, %7
-    %9:vec4<u32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_4ccf9a(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_4ccf9a
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_4ccf9a(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_4ccf9a
-    ret
-  }
+kernel void compute_main(texture3d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_4ccf9a(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_4ccf9a
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/4cdca5.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/4cdca5.wgsl.expected.ir.msl
index 5fbe847..d2f2830 100644
--- a/test/tint/builtins/gen/var/textureLoad/4cdca5.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/4cdca5.wgsl.expected.ir.msl
@@ -1,47 +1,33 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<int, access::read> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba8sint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_4cdca5(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  uint arg_2 = 1u;
+  uint const v = arg_2;
+  int4 res = tint_module_vars.arg_0.read(uint2(arg_1), v);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_4cdca5 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %arg_2:ptr<function, u32, read_write> = var, 1u
-    %6:texture_storage_2d_array<rgba8sint, read> = load %arg_0
-    %7:vec2<i32> = load %arg_1
-    %8:u32 = load %arg_2
-    %9:vec4<i32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<i32>, read_write> = var, %9
-    %11:vec4<i32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_4cdca5(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_4cdca5
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_4cdca5(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_4cdca5
-    ret
-  }
+kernel void compute_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_4cdca5(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_4cdca5
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/4db25c.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/4db25c.wgsl.expected.ir.msl
index 8312b88..2e8c22d 100644
--- a/test/tint/builtins/gen/var/textureLoad/4db25c.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/4db25c.wgsl.expected.ir.msl
@@ -1,47 +1,32 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  depth2d_ms<float, access::read> arg_0;
+  device float* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_depth_multisampled_2d, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, f32, read_write> = var @binding_point(2, 0)
+void textureLoad_4db25c(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  uint arg_2 = 1u;
+  float res = tint_module_vars.arg_0.read(arg_1, arg_2);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_4db25c = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %arg_2:ptr<function, u32, read_write> = var, 1u
-    %6:texture_depth_multisampled_2d = load %arg_0
-    %7:vec2<u32> = load %arg_1
-    %8:u32 = load %arg_2
-    %9:f32 = textureLoad %6, %7, %8
-    %res:ptr<function, f32, read_write> = var, %9
-    %11:f32 = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_4db25c(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_4db25c
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(depth2d_ms<float, access::read> arg_0 [[texture(0)]], device float* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_4db25c(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_4db25c
-    ret
-  }
+kernel void compute_main(depth2d_ms<float, access::read> arg_0 [[texture(0)]], device float* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_4db25c(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_4db25c
-    ret
-  }
+vertex vertex_main_outputs vertex_main(depth2d_ms<float, access::read> arg_0 [[texture(0)]], device float* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/4e2c5c.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/4e2c5c.wgsl.expected.ir.msl
index d0fc62d..619ed72 100644
--- a/test/tint/builtins/gen/var/textureLoad/4e2c5c.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/4e2c5c.wgsl.expected.ir.msl
@@ -1,47 +1,33 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba16float, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_4e2c5c(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  uint arg_2 = 1u;
+  uint const v = arg_2;
+  float4 res = tint_module_vars.arg_0.read(uint2(arg_1), v);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_4e2c5c = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %arg_2:ptr<function, u32, read_write> = var, 1u
-    %6:texture_storage_2d_array<rgba16float, read_write> = load %arg_0
-    %7:vec2<i32> = load %arg_1
-    %8:u32 = load %arg_2
-    %9:vec4<f32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<f32>, read_write> = var, %9
-    %11:vec4<f32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_4e2c5c(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_4e2c5c
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_4e2c5c(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_4e2c5c
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_4e2c5c(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_4e2c5c
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/4f5496.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/4f5496.wgsl.expected.ir.msl
index 3af0548..f8000fd 100644
--- a/test/tint/builtins/gen/var/textureLoad/4f5496.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/4f5496.wgsl.expected.ir.msl
@@ -1,47 +1,33 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<uint, access::read_write> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<r32uint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_4f5496(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  int arg_2 = 1;
+  int const v = arg_2;
+  uint4 res = tint_module_vars.arg_0.read(uint2(arg_1), v);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_4f5496 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %arg_2:ptr<function, i32, read_write> = var, 1i
-    %6:texture_storage_2d_array<r32uint, read_write> = load %arg_0
-    %7:vec2<i32> = load %arg_1
-    %8:i32 = load %arg_2
-    %9:vec4<u32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<u32>, read_write> = var, %9
-    %11:vec4<u32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_4f5496(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_4f5496
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_4f5496(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_4f5496
-    ret
-  }
+kernel void compute_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_4f5496(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_4f5496
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/4f90bb.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/4f90bb.wgsl.expected.ir.msl
index 9dd0f75..41bc4a2 100644
--- a/test/tint/builtins/gen/var/textureLoad/4f90bb.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/4f90bb.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<bgra8unorm, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_4f90bb(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  float4 res = tint_module_vars.arg_0.read(uint2(arg_1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_4f90bb = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %5:texture_storage_2d<bgra8unorm, read_write> = load %arg_0
-    %6:vec2<i32> = load %arg_1
-    %7:vec4<f32> = textureLoad %5, %6
-    %res:ptr<function, vec4<f32>, read_write> = var, %7
-    %9:vec4<f32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_4f90bb(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_4f90bb
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_4f90bb(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_4f90bb
-    ret
-  }
+kernel void compute_main(texture2d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_4f90bb(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_4f90bb
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/4fa6ae.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/4fa6ae.wgsl.expected.ir.msl
index 2a0ac64..2e9c258 100644
--- a/test/tint/builtins/gen/var/textureLoad/4fa6ae.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/4fa6ae.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<bgra8unorm, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_4fa6ae(tint_module_vars_struct tint_module_vars) {
+  uint3 arg_1 = uint3(1u);
+  float4 res = tint_module_vars.arg_0.read(arg_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_4fa6ae = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec3<u32>, read_write> = var, vec3<u32>(1u)
-    %5:texture_storage_3d<bgra8unorm, read> = load %arg_0
-    %6:vec3<u32> = load %arg_1
-    %7:vec4<f32> = textureLoad %5, %6
-    %res:ptr<function, vec4<f32>, read_write> = var, %7
-    %9:vec4<f32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_4fa6ae(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_4fa6ae
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_4fa6ae(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_4fa6ae
-    ret
-  }
+kernel void compute_main(texture3d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_4fa6ae(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_4fa6ae
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/4fd803.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/4fd803.wgsl.expected.ir.msl
index c94237e..d2fcbf4 100644
--- a/test/tint/builtins/gen/var/textureLoad/4fd803.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/4fd803.wgsl.expected.ir.msl
@@ -1,47 +1,33 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<int, access::sample> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_3d<i32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_4fd803(tint_module_vars_struct tint_module_vars) {
+  int3 arg_1 = int3(1);
+  int arg_2 = 1;
+  int const v = arg_2;
+  int4 res = tint_module_vars.arg_0.read(uint3(arg_1), v);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_4fd803 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec3<i32>, read_write> = var, vec3<i32>(1i)
-    %arg_2:ptr<function, i32, read_write> = var, 1i
-    %6:texture_3d<i32> = load %arg_0
-    %7:vec3<i32> = load %arg_1
-    %8:i32 = load %arg_2
-    %9:vec4<i32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<i32>, read_write> = var, %9
-    %11:vec4<i32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_4fd803(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_4fd803
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_4fd803(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_4fd803
-    ret
-  }
+kernel void compute_main(texture3d<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_4fd803(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_4fd803
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/505aa2.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/505aa2.wgsl.expected.ir.msl
index 2c6c194..4cced3e 100644
--- a/test/tint/builtins/gen/var/textureLoad/505aa2.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/505aa2.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<int, access::read> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<r32sint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_505aa2(tint_module_vars_struct tint_module_vars) {
+  int3 arg_1 = int3(1);
+  int4 res = tint_module_vars.arg_0.read(uint3(arg_1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_505aa2 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec3<i32>, read_write> = var, vec3<i32>(1i)
-    %5:texture_storage_3d<r32sint, read> = load %arg_0
-    %6:vec3<i32> = load %arg_1
-    %7:vec4<i32> = textureLoad %5, %6
-    %res:ptr<function, vec4<i32>, read_write> = var, %7
-    %9:vec4<i32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_505aa2(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_505aa2
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_505aa2(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_505aa2
-    ret
-  }
+kernel void compute_main(texture3d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_505aa2(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_505aa2
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/50915c.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/50915c.wgsl.expected.ir.msl
index 2c967e5..58f5482 100644
--- a/test/tint/builtins/gen/var/textureLoad/50915c.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/50915c.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<uint, access::read> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<rgba8uint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_50915c(tint_module_vars_struct tint_module_vars) {
+  uint3 arg_1 = uint3(1u);
+  uint4 res = tint_module_vars.arg_0.read(arg_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_50915c = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec3<u32>, read_write> = var, vec3<u32>(1u)
-    %5:texture_storage_3d<rgba8uint, read> = load %arg_0
-    %6:vec3<u32> = load %arg_1
-    %7:vec4<u32> = textureLoad %5, %6
-    %res:ptr<function, vec4<u32>, read_write> = var, %7
-    %9:vec4<u32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_50915c(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_50915c
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_50915c(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_50915c
-    ret
-  }
+kernel void compute_main(texture3d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_50915c(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_50915c
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/5154e1.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/5154e1.wgsl.expected.ir.msl
index f486810..18687d8 100644
--- a/test/tint/builtins/gen/var/textureLoad/5154e1.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/5154e1.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<rgba32float, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_5154e1(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  float4 res = tint_module_vars.arg_0.read(uint2(arg_1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_5154e1 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %5:texture_storage_2d<rgba32float, read_write> = load %arg_0
-    %6:vec2<i32> = load %arg_1
-    %7:vec4<f32> = textureLoad %5, %6
-    %res:ptr<function, vec4<f32>, read_write> = var, %7
-    %9:vec4<f32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_5154e1(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_5154e1
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_5154e1(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_5154e1
-    ret
-  }
+kernel void compute_main(texture2d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_5154e1(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_5154e1
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/519ab5.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/519ab5.wgsl.expected.ir.msl
index b2aec90..21116cf 100644
--- a/test/tint/builtins/gen/var/textureLoad/519ab5.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/519ab5.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<rgba8unorm, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_519ab5(tint_module_vars_struct tint_module_vars) {
+  int arg_1 = 1;
+  float4 res = tint_module_vars.arg_0.read(uint(arg_1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_519ab5 = func():void {
-  $B2: {
-    %arg_1:ptr<function, i32, read_write> = var, 1i
-    %5:texture_storage_1d<rgba8unorm, read> = load %arg_0
-    %6:i32 = load %arg_1
-    %7:vec4<f32> = textureLoad %5, %6
-    %res:ptr<function, vec4<f32>, read_write> = var, %7
-    %9:vec4<f32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_519ab5(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_519ab5
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_519ab5(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_519ab5
-    ret
-  }
+kernel void compute_main(texture1d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_519ab5(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_519ab5
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/53378a.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/53378a.wgsl.expected.ir.msl
index a4fafa6..d2fd6d6 100644
--- a/test/tint/builtins/gen/var/textureLoad/53378a.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/53378a.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<int, access::read> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<rg32sint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_53378a(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  int4 res = tint_module_vars.arg_0.read(uint2(arg_1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_53378a = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %5:texture_storage_2d<rg32sint, read> = load %arg_0
-    %6:vec2<i32> = load %arg_1
-    %7:vec4<i32> = textureLoad %5, %6
-    %res:ptr<function, vec4<i32>, read_write> = var, %7
-    %9:vec4<i32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_53378a(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_53378a
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_53378a(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_53378a
-    ret
-  }
+kernel void compute_main(texture2d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_53378a(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_53378a
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/53941c.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/53941c.wgsl.expected.ir.msl
index 7f0ae96..ec615d8 100644
--- a/test/tint/builtins/gen/var/textureLoad/53941c.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/53941c.wgsl.expected.ir.msl
@@ -1,47 +1,32 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<int, access::read_write> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba32sint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_53941c(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  uint arg_2 = 1u;
+  int4 res = tint_module_vars.arg_0.read(arg_1, arg_2);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_53941c = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %arg_2:ptr<function, u32, read_write> = var, 1u
-    %6:texture_storage_2d_array<rgba32sint, read_write> = load %arg_0
-    %7:vec2<u32> = load %arg_1
-    %8:u32 = load %arg_2
-    %9:vec4<i32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<i32>, read_write> = var, %9
-    %11:vec4<i32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_53941c(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_53941c
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_53941c(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_53941c
-    ret
-  }
+kernel void compute_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_53941c(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_53941c
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/53e142.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/53e142.wgsl.expected.ir.msl
index a94c0c1..57a73ee 100644
--- a/test/tint/builtins/gen/var/textureLoad/53e142.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/53e142.wgsl.expected.ir.msl
@@ -1,49 +1,33 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<uint, access::sample> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_2d_array<u32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_53e142(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  int arg_2 = 1;
+  int arg_3 = 1;
+  uint4 res = tint_module_vars.arg_0.read(arg_1, arg_2, arg_3);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_53e142 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %arg_2:ptr<function, i32, read_write> = var, 1i
-    %arg_3:ptr<function, i32, read_write> = var, 1i
-    %7:texture_2d_array<u32> = load %arg_0
-    %8:vec2<u32> = load %arg_1
-    %9:i32 = load %arg_2
-    %10:i32 = load %arg_3
-    %11:vec4<u32> = textureLoad %7, %8, %9, %10
-    %res:ptr<function, vec4<u32>, read_write> = var, %11
-    %13:vec4<u32> = load %res
-    store %prevent_dce, %13
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_53e142(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %15:void = call %textureLoad_53e142
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_53e142(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %17:void = call %textureLoad_53e142
-    ret
-  }
+kernel void compute_main(texture2d_array<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_53e142(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %19:void = call %textureLoad_53e142
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/54a59b.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/54a59b.wgsl.expected.ir.msl
index c1f318a..9732248 100644
--- a/test/tint/builtins/gen/var/textureLoad/54a59b.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/54a59b.wgsl.expected.ir.msl
@@ -1,49 +1,33 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::sample> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_2d_array<f32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_54a59b(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  int arg_2 = 1;
+  int arg_3 = 1;
+  float4 res = tint_module_vars.arg_0.read(arg_1, arg_2, arg_3);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_54a59b = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %arg_2:ptr<function, i32, read_write> = var, 1i
-    %arg_3:ptr<function, i32, read_write> = var, 1i
-    %7:texture_2d_array<f32> = load %arg_0
-    %8:vec2<u32> = load %arg_1
-    %9:i32 = load %arg_2
-    %10:i32 = load %arg_3
-    %11:vec4<f32> = textureLoad %7, %8, %9, %10
-    %res:ptr<function, vec4<f32>, read_write> = var, %11
-    %13:vec4<f32> = load %res
-    store %prevent_dce, %13
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_54a59b(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %15:void = call %textureLoad_54a59b
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_54a59b(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %17:void = call %textureLoad_54a59b
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_54a59b(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %19:void = call %textureLoad_54a59b
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/54e0ce.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/54e0ce.wgsl.expected.ir.msl
index 360ae48..a8f54f3 100644
--- a/test/tint/builtins/gen/var/textureLoad/54e0ce.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/54e0ce.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<bgra8unorm, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_54e0ce(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  float4 res = tint_module_vars.arg_0.read(arg_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_54e0ce = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %5:texture_storage_2d<bgra8unorm, read> = load %arg_0
-    %6:vec2<u32> = load %arg_1
-    %7:vec4<f32> = textureLoad %5, %6
-    %res:ptr<function, vec4<f32>, read_write> = var, %7
-    %9:vec4<f32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_54e0ce(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_54e0ce
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_54e0ce(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_54e0ce
-    ret
-  }
+kernel void compute_main(texture2d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_54e0ce(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_54e0ce
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/54fb38.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/54fb38.wgsl.expected.ir.msl
index 66fff71..b6dc063 100644
--- a/test/tint/builtins/gen/var/textureLoad/54fb38.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/54fb38.wgsl.expected.ir.msl
@@ -1,47 +1,32 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<uint, access::read_write> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rg32uint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_54fb38(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  uint arg_2 = 1u;
+  uint4 res = tint_module_vars.arg_0.read(arg_1, arg_2);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_54fb38 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %arg_2:ptr<function, u32, read_write> = var, 1u
-    %6:texture_storage_2d_array<rg32uint, read_write> = load %arg_0
-    %7:vec2<u32> = load %arg_1
-    %8:u32 = load %arg_2
-    %9:vec4<u32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<u32>, read_write> = var, %9
-    %11:vec4<u32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_54fb38(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_54fb38
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_54fb38(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_54fb38
-    ret
-  }
+kernel void compute_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_54fb38(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_54fb38
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/55e745.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/55e745.wgsl.expected.ir.msl
index efb7192..636b11c 100644
--- a/test/tint/builtins/gen/var/textureLoad/55e745.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/55e745.wgsl.expected.ir.msl
@@ -1,47 +1,32 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<int, access::read> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<r32sint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_55e745(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  int arg_2 = 1;
+  int4 res = tint_module_vars.arg_0.read(arg_1, arg_2);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_55e745 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %arg_2:ptr<function, i32, read_write> = var, 1i
-    %6:texture_storage_2d_array<r32sint, read> = load %arg_0
-    %7:vec2<u32> = load %arg_1
-    %8:i32 = load %arg_2
-    %9:vec4<i32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<i32>, read_write> = var, %9
-    %11:vec4<i32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_55e745(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_55e745
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_55e745(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_55e745
-    ret
-  }
+kernel void compute_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_55e745(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_55e745
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/560573.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/560573.wgsl.expected.ir.msl
index 68ac74a..4f0cfbe 100644
--- a/test/tint/builtins/gen/var/textureLoad/560573.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/560573.wgsl.expected.ir.msl
@@ -1,47 +1,33 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<int, access::read> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<r32sint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_560573(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  int arg_2 = 1;
+  int const v = arg_2;
+  int4 res = tint_module_vars.arg_0.read(uint2(arg_1), v);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_560573 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %arg_2:ptr<function, i32, read_write> = var, 1i
-    %6:texture_storage_2d_array<r32sint, read> = load %arg_0
-    %7:vec2<i32> = load %arg_1
-    %8:i32 = load %arg_2
-    %9:vec4<i32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<i32>, read_write> = var, %9
-    %11:vec4<i32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_560573(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_560573
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_560573(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_560573
-    ret
-  }
+kernel void compute_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_560573(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_560573
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/56a000.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/56a000.wgsl.expected.ir.msl
index fb9f9ce..abb5b4e 100644
--- a/test/tint/builtins/gen/var/textureLoad/56a000.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/56a000.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<rg32float, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_56a000(tint_module_vars_struct tint_module_vars) {
+  int arg_1 = 1;
+  float4 res = tint_module_vars.arg_0.read(uint(arg_1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_56a000 = func():void {
-  $B2: {
-    %arg_1:ptr<function, i32, read_write> = var, 1i
-    %5:texture_storage_1d<rg32float, read_write> = load %arg_0
-    %6:i32 = load %arg_1
-    %7:vec4<f32> = textureLoad %5, %6
-    %res:ptr<function, vec4<f32>, read_write> = var, %7
-    %9:vec4<f32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_56a000(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_56a000
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_56a000(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_56a000
-    ret
-  }
+kernel void compute_main(texture1d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_56a000(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_56a000
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/582015.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/582015.wgsl.expected.ir.msl
index 39ab9c1..d52a266 100644
--- a/test/tint/builtins/gen/var/textureLoad/582015.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/582015.wgsl.expected.ir.msl
@@ -1,47 +1,33 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<int, access::read> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba8sint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_582015(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  int arg_2 = 1;
+  int const v = arg_2;
+  int4 res = tint_module_vars.arg_0.read(uint2(arg_1), v);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_582015 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %arg_2:ptr<function, i32, read_write> = var, 1i
-    %6:texture_storage_2d_array<rgba8sint, read> = load %arg_0
-    %7:vec2<i32> = load %arg_1
-    %8:i32 = load %arg_2
-    %9:vec4<i32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<i32>, read_write> = var, %9
-    %11:vec4<i32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_582015(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_582015
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_582015(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_582015
-    ret
-  }
+kernel void compute_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_582015(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_582015
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/589eaa.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/589eaa.wgsl.expected.ir.msl
index bec7f7a..39abd79 100644
--- a/test/tint/builtins/gen/var/textureLoad/589eaa.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/589eaa.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<rgba16float, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_589eaa(tint_module_vars_struct tint_module_vars) {
+  uint3 arg_1 = uint3(1u);
+  float4 res = tint_module_vars.arg_0.read(arg_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_589eaa = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec3<u32>, read_write> = var, vec3<u32>(1u)
-    %5:texture_storage_3d<rgba16float, read> = load %arg_0
-    %6:vec3<u32> = load %arg_1
-    %7:vec4<f32> = textureLoad %5, %6
-    %res:ptr<function, vec4<f32>, read_write> = var, %7
-    %9:vec4<f32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_589eaa(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_589eaa
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_589eaa(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_589eaa
-    ret
-  }
+kernel void compute_main(texture3d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_589eaa(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_589eaa
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/5a2f9d.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/5a2f9d.wgsl.expected.ir.msl
index 219ef48..0eb14f5 100644
--- a/test/tint/builtins/gen/var/textureLoad/5a2f9d.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/5a2f9d.wgsl.expected.ir.msl
@@ -1,47 +1,32 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<int, access::sample> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_1d<i32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_5a2f9d(tint_module_vars_struct tint_module_vars) {
+  int arg_1 = 1;
+  int arg_2 = 1;
+  int4 res = tint_module_vars.arg_0.read(uint(arg_1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_5a2f9d = func():void {
-  $B2: {
-    %arg_1:ptr<function, i32, read_write> = var, 1i
-    %arg_2:ptr<function, i32, read_write> = var, 1i
-    %6:texture_1d<i32> = load %arg_0
-    %7:i32 = load %arg_1
-    %8:i32 = load %arg_2
-    %9:vec4<i32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<i32>, read_write> = var, %9
-    %11:vec4<i32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_5a2f9d(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_5a2f9d
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_5a2f9d(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_5a2f9d
-    ret
-  }
+kernel void compute_main(texture1d<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_5a2f9d(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_5a2f9d
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/5abbf2.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/5abbf2.wgsl.expected.ir.msl
index 719d934..1aaa964 100644
--- a/test/tint/builtins/gen/var/textureLoad/5abbf2.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/5abbf2.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<rg32float, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_5abbf2(tint_module_vars_struct tint_module_vars) {
+  uint arg_1 = 1u;
+  float4 res = tint_module_vars.arg_0.read(arg_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_5abbf2 = func():void {
-  $B2: {
-    %arg_1:ptr<function, u32, read_write> = var, 1u
-    %5:texture_storage_1d<rg32float, read> = load %arg_0
-    %6:u32 = load %arg_1
-    %7:vec4<f32> = textureLoad %5, %6
-    %res:ptr<function, vec4<f32>, read_write> = var, %7
-    %9:vec4<f32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_5abbf2(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_5abbf2
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_5abbf2(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_5abbf2
-    ret
-  }
+kernel void compute_main(texture1d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_5abbf2(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_5abbf2
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/5b0f5b.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/5b0f5b.wgsl.expected.ir.msl
index 76637c0..f2331a5 100644
--- a/test/tint/builtins/gen/var/textureLoad/5b0f5b.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/5b0f5b.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<uint, access::read_write> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<rgba16uint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_5b0f5b(tint_module_vars_struct tint_module_vars) {
+  int3 arg_1 = int3(1);
+  uint4 res = tint_module_vars.arg_0.read(uint3(arg_1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_5b0f5b = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec3<i32>, read_write> = var, vec3<i32>(1i)
-    %5:texture_storage_3d<rgba16uint, read_write> = load %arg_0
-    %6:vec3<i32> = load %arg_1
-    %7:vec4<u32> = textureLoad %5, %6
-    %res:ptr<function, vec4<u32>, read_write> = var, %7
-    %9:vec4<u32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_5b0f5b(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_5b0f5b
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_5b0f5b(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_5b0f5b
-    ret
-  }
+kernel void compute_main(texture3d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_5b0f5b(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_5b0f5b
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/5b4947.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/5b4947.wgsl.expected.ir.msl
index 31ba638..a15ea28 100644
--- a/test/tint/builtins/gen/var/textureLoad/5b4947.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/5b4947.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<bgra8unorm, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_5b4947(tint_module_vars_struct tint_module_vars) {
+  int3 arg_1 = int3(1);
+  float4 res = tint_module_vars.arg_0.read(uint3(arg_1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_5b4947 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec3<i32>, read_write> = var, vec3<i32>(1i)
-    %5:texture_storage_3d<bgra8unorm, read_write> = load %arg_0
-    %6:vec3<i32> = load %arg_1
-    %7:vec4<f32> = textureLoad %5, %6
-    %res:ptr<function, vec4<f32>, read_write> = var, %7
-    %9:vec4<f32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_5b4947(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_5b4947
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_5b4947(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_5b4947
-    ret
-  }
+kernel void compute_main(texture3d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_5b4947(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_5b4947
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/5bb7fb.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/5bb7fb.wgsl.expected.ir.msl
index e6713b8..6f57acf 100644
--- a/test/tint/builtins/gen/var/textureLoad/5bb7fb.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/5bb7fb.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<uint, access::read> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<rg32uint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_5bb7fb(tint_module_vars_struct tint_module_vars) {
+  int arg_1 = 1;
+  uint4 res = tint_module_vars.arg_0.read(uint(arg_1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_5bb7fb = func():void {
-  $B2: {
-    %arg_1:ptr<function, i32, read_write> = var, 1i
-    %5:texture_storage_1d<rg32uint, read> = load %arg_0
-    %6:i32 = load %arg_1
-    %7:vec4<u32> = textureLoad %5, %6
-    %res:ptr<function, vec4<u32>, read_write> = var, %7
-    %9:vec4<u32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_5bb7fb(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_5bb7fb
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_5bb7fb(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_5bb7fb
-    ret
-  }
+kernel void compute_main(texture1d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_5bb7fb(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_5bb7fb
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/5c69f8.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/5c69f8.wgsl.expected.ir.msl
index ea3adc9..3a9e2d3 100644
--- a/test/tint/builtins/gen/var/textureLoad/5c69f8.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/5c69f8.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<bgra8unorm, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_5c69f8(tint_module_vars_struct tint_module_vars) {
+  uint3 arg_1 = uint3(1u);
+  float4 res = tint_module_vars.arg_0.read(arg_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_5c69f8 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec3<u32>, read_write> = var, vec3<u32>(1u)
-    %5:texture_storage_3d<bgra8unorm, read_write> = load %arg_0
-    %6:vec3<u32> = load %arg_1
-    %7:vec4<f32> = textureLoad %5, %6
-    %res:ptr<function, vec4<f32>, read_write> = var, %7
-    %9:vec4<f32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_5c69f8(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_5c69f8
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_5c69f8(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_5c69f8
-    ret
-  }
+kernel void compute_main(texture3d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_5c69f8(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_5c69f8
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/5cd3fc.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/5cd3fc.wgsl.expected.ir.msl
index b585143..a1a9912 100644
--- a/test/tint/builtins/gen/var/textureLoad/5cd3fc.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/5cd3fc.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<int, access::read_write> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<r32sint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_5cd3fc(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  int4 res = tint_module_vars.arg_0.read(uint2(arg_1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_5cd3fc = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %5:texture_storage_2d<r32sint, read_write> = load %arg_0
-    %6:vec2<i32> = load %arg_1
-    %7:vec4<i32> = textureLoad %5, %6
-    %res:ptr<function, vec4<i32>, read_write> = var, %7
-    %9:vec4<i32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_5cd3fc(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_5cd3fc
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_5cd3fc(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_5cd3fc
-    ret
-  }
+kernel void compute_main(texture2d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_5cd3fc(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_5cd3fc
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/5cee3b.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/5cee3b.wgsl.expected.ir.msl
index 0daed4f..12bf382 100644
--- a/test/tint/builtins/gen/var/textureLoad/5cee3b.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/5cee3b.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<uint, access::read> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<r32uint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_5cee3b(tint_module_vars_struct tint_module_vars) {
+  uint3 arg_1 = uint3(1u);
+  uint4 res = tint_module_vars.arg_0.read(arg_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_5cee3b = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec3<u32>, read_write> = var, vec3<u32>(1u)
-    %5:texture_storage_3d<r32uint, read> = load %arg_0
-    %6:vec3<u32> = load %arg_1
-    %7:vec4<u32> = textureLoad %5, %6
-    %res:ptr<function, vec4<u32>, read_write> = var, %7
-    %9:vec4<u32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_5cee3b(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_5cee3b
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_5cee3b(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_5cee3b
-    ret
-  }
+kernel void compute_main(texture3d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_5cee3b(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_5cee3b
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/5d0a2f.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/5d0a2f.wgsl.expected.ir.msl
index a7c3d77..078f530 100644
--- a/test/tint/builtins/gen/var/textureLoad/5d0a2f.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/5d0a2f.wgsl.expected.ir.msl
@@ -1,47 +1,33 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<uint, access::read> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<r32uint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_5d0a2f(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  int arg_2 = 1;
+  int const v = arg_2;
+  uint4 res = tint_module_vars.arg_0.read(uint2(arg_1), v);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_5d0a2f = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %arg_2:ptr<function, i32, read_write> = var, 1i
-    %6:texture_storage_2d_array<r32uint, read> = load %arg_0
-    %7:vec2<i32> = load %arg_1
-    %8:i32 = load %arg_2
-    %9:vec4<u32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<u32>, read_write> = var, %9
-    %11:vec4<u32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_5d0a2f(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_5d0a2f
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_5d0a2f(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_5d0a2f
-    ret
-  }
+kernel void compute_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_5d0a2f(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_5d0a2f
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/5d4042.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/5d4042.wgsl.expected.ir.msl
index dcef503..b31e73b 100644
--- a/test/tint/builtins/gen/var/textureLoad/5d4042.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/5d4042.wgsl.expected.ir.msl
@@ -1,47 +1,32 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba32float, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_5d4042(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  int arg_2 = 1;
+  float4 res = tint_module_vars.arg_0.read(arg_1, arg_2);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_5d4042 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %arg_2:ptr<function, i32, read_write> = var, 1i
-    %6:texture_storage_2d_array<rgba32float, read> = load %arg_0
-    %7:vec2<u32> = load %arg_1
-    %8:i32 = load %arg_2
-    %9:vec4<f32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<f32>, read_write> = var, %9
-    %11:vec4<f32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_5d4042(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_5d4042
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_5d4042(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_5d4042
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_5d4042(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_5d4042
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/5dd4c7.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/5dd4c7.wgsl.expected.ir.msl
index b840a43..80eba96 100644
--- a/test/tint/builtins/gen/var/textureLoad/5dd4c7.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/5dd4c7.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<r8unorm, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_5dd4c7(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  float4 res = tint_module_vars.arg_0.read(uint2(arg_1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_5dd4c7 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %5:texture_storage_2d<r8unorm, read> = load %arg_0
-    %6:vec2<i32> = load %arg_1
-    %7:vec4<f32> = textureLoad %5, %6
-    %res:ptr<function, vec4<f32>, read_write> = var, %7
-    %9:vec4<f32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_5dd4c7(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_5dd4c7
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_5dd4c7(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_5dd4c7
-    ret
-  }
+kernel void compute_main(texture2d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_5dd4c7(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_5dd4c7
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/5e17a7.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/5e17a7.wgsl.expected.ir.msl
index f93484c..a22dcab 100644
--- a/test/tint/builtins/gen/var/textureLoad/5e17a7.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/5e17a7.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<int, access::read_write> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<rgba8sint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_5e17a7(tint_module_vars_struct tint_module_vars) {
+  int arg_1 = 1;
+  int4 res = tint_module_vars.arg_0.read(uint(arg_1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_5e17a7 = func():void {
-  $B2: {
-    %arg_1:ptr<function, i32, read_write> = var, 1i
-    %5:texture_storage_1d<rgba8sint, read_write> = load %arg_0
-    %6:i32 = load %arg_1
-    %7:vec4<i32> = textureLoad %5, %6
-    %res:ptr<function, vec4<i32>, read_write> = var, %7
-    %9:vec4<i32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_5e17a7(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_5e17a7
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_5e17a7(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_5e17a7
-    ret
-  }
+kernel void compute_main(texture1d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_5e17a7(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_5e17a7
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/5e1843.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/5e1843.wgsl.expected.ir.msl
index bb5aac6..952e784 100644
--- a/test/tint/builtins/gen/var/textureLoad/5e1843.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/5e1843.wgsl.expected.ir.msl
@@ -1,47 +1,32 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<uint, access::read_write> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba16uint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_5e1843(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  uint arg_2 = 1u;
+  uint4 res = tint_module_vars.arg_0.read(arg_1, arg_2);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_5e1843 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %arg_2:ptr<function, u32, read_write> = var, 1u
-    %6:texture_storage_2d_array<rgba16uint, read_write> = load %arg_0
-    %7:vec2<u32> = load %arg_1
-    %8:u32 = load %arg_2
-    %9:vec4<u32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<u32>, read_write> = var, %9
-    %11:vec4<u32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_5e1843(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_5e1843
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_5e1843(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_5e1843
-    ret
-  }
+kernel void compute_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_5e1843(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_5e1843
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/5e8d3f.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/5e8d3f.wgsl.expected.ir.msl
index 58c5c84..fd4dd0a 100644
--- a/test/tint/builtins/gen/var/textureLoad/5e8d3f.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/5e8d3f.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<int, access::read> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<r32sint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_5e8d3f(tint_module_vars_struct tint_module_vars) {
+  uint3 arg_1 = uint3(1u);
+  int4 res = tint_module_vars.arg_0.read(arg_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_5e8d3f = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec3<u32>, read_write> = var, vec3<u32>(1u)
-    %5:texture_storage_3d<r32sint, read> = load %arg_0
-    %6:vec3<u32> = load %arg_1
-    %7:vec4<i32> = textureLoad %5, %6
-    %res:ptr<function, vec4<i32>, read_write> = var, %7
-    %9:vec4<i32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_5e8d3f(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_5e8d3f
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_5e8d3f(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_5e8d3f
-    ret
-  }
+kernel void compute_main(texture3d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_5e8d3f(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_5e8d3f
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/5ed6ad.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/5ed6ad.wgsl.expected.ir.msl
index d6b3f48..ff08ae0 100644
--- a/test/tint/builtins/gen/var/textureLoad/5ed6ad.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/5ed6ad.wgsl.expected.ir.msl
@@ -1,47 +1,32 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<r8unorm, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_5ed6ad(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  uint arg_2 = 1u;
+  float4 res = tint_module_vars.arg_0.read(arg_1, arg_2);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_5ed6ad = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %arg_2:ptr<function, u32, read_write> = var, 1u
-    %6:texture_storage_2d_array<r8unorm, read> = load %arg_0
-    %7:vec2<u32> = load %arg_1
-    %8:u32 = load %arg_2
-    %9:vec4<f32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<f32>, read_write> = var, %9
-    %11:vec4<f32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_5ed6ad(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_5ed6ad
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_5ed6ad(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_5ed6ad
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_5ed6ad(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_5ed6ad
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/5f4473.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/5f4473.wgsl.expected.ir.msl
index f9f13bf..8ba0a95 100644
--- a/test/tint/builtins/gen/var/textureLoad/5f4473.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/5f4473.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<uint, access::read> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<rgba32uint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_5f4473(tint_module_vars_struct tint_module_vars) {
+  uint3 arg_1 = uint3(1u);
+  uint4 res = tint_module_vars.arg_0.read(arg_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_5f4473 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec3<u32>, read_write> = var, vec3<u32>(1u)
-    %5:texture_storage_3d<rgba32uint, read> = load %arg_0
-    %6:vec3<u32> = load %arg_1
-    %7:vec4<u32> = textureLoad %5, %6
-    %res:ptr<function, vec4<u32>, read_write> = var, %7
-    %9:vec4<u32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_5f4473(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_5f4473
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_5f4473(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_5f4473
-    ret
-  }
+kernel void compute_main(texture3d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_5f4473(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_5f4473
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/5feb4d.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/5feb4d.wgsl.expected.ir.msl
index d61bb5b..6ad1e91 100644
--- a/test/tint/builtins/gen/var/textureLoad/5feb4d.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/5feb4d.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<r32float, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_5feb4d(tint_module_vars_struct tint_module_vars) {
+  uint arg_1 = 1u;
+  float4 res = tint_module_vars.arg_0.read(arg_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_5feb4d = func():void {
-  $B2: {
-    %arg_1:ptr<function, u32, read_write> = var, 1u
-    %5:texture_storage_1d<r32float, read> = load %arg_0
-    %6:u32 = load %arg_1
-    %7:vec4<f32> = textureLoad %5, %6
-    %res:ptr<function, vec4<f32>, read_write> = var, %7
-    %9:vec4<f32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_5feb4d(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_5feb4d
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_5feb4d(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_5feb4d
-    ret
-  }
+kernel void compute_main(texture1d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_5feb4d(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_5feb4d
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/6154d4.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/6154d4.wgsl.expected.ir.msl
index d2c4dd7..2be19f3 100644
--- a/test/tint/builtins/gen/var/textureLoad/6154d4.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/6154d4.wgsl.expected.ir.msl
@@ -1,47 +1,33 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<uint, access::sample> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_2d<u32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_6154d4(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  int arg_2 = 1;
+  int const v = arg_2;
+  uint4 res = tint_module_vars.arg_0.read(uint2(arg_1), v);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_6154d4 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %arg_2:ptr<function, i32, read_write> = var, 1i
-    %6:texture_2d<u32> = load %arg_0
-    %7:vec2<i32> = load %arg_1
-    %8:i32 = load %arg_2
-    %9:vec4<u32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<u32>, read_write> = var, %9
-    %11:vec4<u32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_6154d4(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_6154d4
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_6154d4(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_6154d4
-    ret
-  }
+kernel void compute_main(texture2d<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_6154d4(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_6154d4
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/61e2e8.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/61e2e8.wgsl.expected.ir.msl
index 8611505..e0a360d 100644
--- a/test/tint/builtins/gen/var/textureLoad/61e2e8.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/61e2e8.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<int, access::read_write> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<rg32sint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_61e2e8(tint_module_vars_struct tint_module_vars) {
+  uint3 arg_1 = uint3(1u);
+  int4 res = tint_module_vars.arg_0.read(arg_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_61e2e8 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec3<u32>, read_write> = var, vec3<u32>(1u)
-    %5:texture_storage_3d<rg32sint, read_write> = load %arg_0
-    %6:vec3<u32> = load %arg_1
-    %7:vec4<i32> = textureLoad %5, %6
-    %res:ptr<function, vec4<i32>, read_write> = var, %7
-    %9:vec4<i32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_61e2e8(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_61e2e8
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_61e2e8(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_61e2e8
-    ret
-  }
+kernel void compute_main(texture3d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_61e2e8(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_61e2e8
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/620caa.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/620caa.wgsl.expected.ir.msl
index 2fae076..5a1a02a 100644
--- a/test/tint/builtins/gen/var/textureLoad/620caa.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/620caa.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<int, access::read> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<rg32sint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_620caa(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  int4 res = tint_module_vars.arg_0.read(arg_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_620caa = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %5:texture_storage_2d<rg32sint, read> = load %arg_0
-    %6:vec2<u32> = load %arg_1
-    %7:vec4<i32> = textureLoad %5, %6
-    %res:ptr<function, vec4<i32>, read_write> = var, %7
-    %9:vec4<i32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_620caa(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_620caa
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_620caa(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_620caa
-    ret
-  }
+kernel void compute_main(texture2d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_620caa(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_620caa
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/622278.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/622278.wgsl.expected.ir.msl
index 40ec67f..f5158c8 100644
--- a/test/tint/builtins/gen/var/textureLoad/622278.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/622278.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<uint, access::read_write> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<rgba32uint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_622278(tint_module_vars_struct tint_module_vars) {
+  int3 arg_1 = int3(1);
+  uint4 res = tint_module_vars.arg_0.read(uint3(arg_1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_622278 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec3<i32>, read_write> = var, vec3<i32>(1i)
-    %5:texture_storage_3d<rgba32uint, read_write> = load %arg_0
-    %6:vec3<i32> = load %arg_1
-    %7:vec4<u32> = textureLoad %5, %6
-    %res:ptr<function, vec4<u32>, read_write> = var, %7
-    %9:vec4<u32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_622278(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_622278
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_622278(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_622278
-    ret
-  }
+kernel void compute_main(texture3d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_622278(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_622278
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/6273b1.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/6273b1.wgsl.expected.ir.msl
index ce48978..a1110e5 100644
--- a/test/tint/builtins/gen/var/textureLoad/6273b1.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/6273b1.wgsl.expected.ir.msl
@@ -1,47 +1,33 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  depth2d_ms<float, access::read> arg_0;
+  device float* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_depth_multisampled_2d, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, f32, read_write> = var @binding_point(2, 0)
+void textureLoad_6273b1(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  int arg_2 = 1;
+  int const v = arg_2;
+  float res = tint_module_vars.arg_0.read(uint2(arg_1), v);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_6273b1 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %arg_2:ptr<function, i32, read_write> = var, 1i
-    %6:texture_depth_multisampled_2d = load %arg_0
-    %7:vec2<i32> = load %arg_1
-    %8:i32 = load %arg_2
-    %9:f32 = textureLoad %6, %7, %8
-    %res:ptr<function, f32, read_write> = var, %9
-    %11:f32 = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_6273b1(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_6273b1
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(depth2d_ms<float, access::read> arg_0 [[texture(0)]], device float* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_6273b1(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_6273b1
-    ret
-  }
+kernel void compute_main(depth2d_ms<float, access::read> arg_0 [[texture(0)]], device float* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_6273b1(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_6273b1
-    ret
-  }
+vertex vertex_main_outputs vertex_main(depth2d_ms<float, access::read> arg_0 [[texture(0)]], device float* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/62d125.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/62d125.wgsl.expected.ir.msl
index ed92598..bd96049 100644
--- a/test/tint/builtins/gen/var/textureLoad/62d125.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/62d125.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<rgba8snorm, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_62d125(tint_module_vars_struct tint_module_vars) {
+  int3 arg_1 = int3(1);
+  float4 res = tint_module_vars.arg_0.read(uint3(arg_1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_62d125 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec3<i32>, read_write> = var, vec3<i32>(1i)
-    %5:texture_storage_3d<rgba8snorm, read> = load %arg_0
-    %6:vec3<i32> = load %arg_1
-    %7:vec4<f32> = textureLoad %5, %6
-    %res:ptr<function, vec4<f32>, read_write> = var, %7
-    %9:vec4<f32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_62d125(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_62d125
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_62d125(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_62d125
-    ret
-  }
+kernel void compute_main(texture3d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_62d125(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_62d125
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/62d1de.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/62d1de.wgsl.expected.ir.msl
index ad3258d..29aae07 100644
--- a/test/tint/builtins/gen/var/textureLoad/62d1de.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/62d1de.wgsl.expected.ir.msl
@@ -1,47 +1,32 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<int, access::sample> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_1d<i32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_62d1de(tint_module_vars_struct tint_module_vars) {
+  int arg_1 = 1;
+  uint arg_2 = 1u;
+  int4 res = tint_module_vars.arg_0.read(uint(arg_1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_62d1de = func():void {
-  $B2: {
-    %arg_1:ptr<function, i32, read_write> = var, 1i
-    %arg_2:ptr<function, u32, read_write> = var, 1u
-    %6:texture_1d<i32> = load %arg_0
-    %7:i32 = load %arg_1
-    %8:u32 = load %arg_2
-    %9:vec4<i32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<i32>, read_write> = var, %9
-    %11:vec4<i32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_62d1de(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_62d1de
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_62d1de(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_62d1de
-    ret
-  }
+kernel void compute_main(texture1d<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_62d1de(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_62d1de
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/639962.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/639962.wgsl.expected.ir.msl
index dda2571..5c5c27c 100644
--- a/test/tint/builtins/gen/var/textureLoad/639962.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/639962.wgsl.expected.ir.msl
@@ -1,47 +1,32 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_ms<int, access::read> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_multisampled_2d<i32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_639962(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  uint arg_2 = 1u;
+  int4 res = tint_module_vars.arg_0.read(arg_1, arg_2);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_639962 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %arg_2:ptr<function, u32, read_write> = var, 1u
-    %6:texture_multisampled_2d<i32> = load %arg_0
-    %7:vec2<u32> = load %arg_1
-    %8:u32 = load %arg_2
-    %9:vec4<i32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<i32>, read_write> = var, %9
-    %11:vec4<i32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_639962(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_639962
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_ms<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_639962(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_639962
-    ret
-  }
+kernel void compute_main(texture2d_ms<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_639962(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_639962
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_ms<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/63be18.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/63be18.wgsl.expected.ir.msl
index 04aba10..07c23d9 100644
--- a/test/tint/builtins/gen/var/textureLoad/63be18.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/63be18.wgsl.expected.ir.msl
@@ -1,47 +1,32 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<int, access::read> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rg32sint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_63be18(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  uint arg_2 = 1u;
+  int4 res = tint_module_vars.arg_0.read(arg_1, arg_2);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_63be18 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %arg_2:ptr<function, u32, read_write> = var, 1u
-    %6:texture_storage_2d_array<rg32sint, read> = load %arg_0
-    %7:vec2<u32> = load %arg_1
-    %8:u32 = load %arg_2
-    %9:vec4<i32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<i32>, read_write> = var, %9
-    %11:vec4<i32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_63be18(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_63be18
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_63be18(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_63be18
-    ret
-  }
+kernel void compute_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_63be18(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_63be18
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/64c372.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/64c372.wgsl.expected.ir.msl
index 07b5c2c..6c2a47c 100644
--- a/test/tint/builtins/gen/var/textureLoad/64c372.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/64c372.wgsl.expected.ir.msl
@@ -1,47 +1,33 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<uint, access::read_write> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba16uint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_64c372(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  int arg_2 = 1;
+  int const v = arg_2;
+  uint4 res = tint_module_vars.arg_0.read(uint2(arg_1), v);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_64c372 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %arg_2:ptr<function, i32, read_write> = var, 1i
-    %6:texture_storage_2d_array<rgba16uint, read_write> = load %arg_0
-    %7:vec2<i32> = load %arg_1
-    %8:i32 = load %arg_2
-    %9:vec4<u32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<u32>, read_write> = var, %9
-    %11:vec4<u32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_64c372(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_64c372
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_64c372(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_64c372
-    ret
-  }
+kernel void compute_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_64c372(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_64c372
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/656d76.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/656d76.wgsl.expected.ir.msl
index e069fae..4e50e80 100644
--- a/test/tint/builtins/gen/var/textureLoad/656d76.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/656d76.wgsl.expected.ir.msl
@@ -1,49 +1,35 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<uint, access::sample> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_2d_array<u32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_656d76(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  int arg_2 = 1;
+  uint arg_3 = 1u;
+  int const v = arg_2;
+  uint const v_1 = arg_3;
+  uint4 res = tint_module_vars.arg_0.read(uint2(arg_1), v, v_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_656d76 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %arg_2:ptr<function, i32, read_write> = var, 1i
-    %arg_3:ptr<function, u32, read_write> = var, 1u
-    %7:texture_2d_array<u32> = load %arg_0
-    %8:vec2<i32> = load %arg_1
-    %9:i32 = load %arg_2
-    %10:u32 = load %arg_3
-    %11:vec4<u32> = textureLoad %7, %8, %9, %10
-    %res:ptr<function, vec4<u32>, read_write> = var, %11
-    %13:vec4<u32> = load %res
-    store %prevent_dce, %13
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_656d76(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %15:void = call %textureLoad_656d76
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_656d76(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %17:void = call %textureLoad_656d76
-    ret
-  }
+kernel void compute_main(texture2d_array<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_656d76(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %19:void = call %textureLoad_656d76
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/65a4d0.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/65a4d0.wgsl.expected.ir.msl
index 38d79fe..6421dfa 100644
--- a/test/tint/builtins/gen/var/textureLoad/65a4d0.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/65a4d0.wgsl.expected.ir.msl
@@ -1,47 +1,32 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba8unorm, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_65a4d0(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  int arg_2 = 1;
+  float4 res = tint_module_vars.arg_0.read(arg_1, arg_2);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_65a4d0 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %arg_2:ptr<function, i32, read_write> = var, 1i
-    %6:texture_storage_2d_array<rgba8unorm, read> = load %arg_0
-    %7:vec2<u32> = load %arg_1
-    %8:i32 = load %arg_2
-    %9:vec4<f32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<f32>, read_write> = var, %9
-    %11:vec4<f32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_65a4d0(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_65a4d0
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_65a4d0(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_65a4d0
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_65a4d0(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_65a4d0
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/666010.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/666010.wgsl.expected.ir.msl
index 0524b7b..aa52915 100644
--- a/test/tint/builtins/gen/var/textureLoad/666010.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/666010.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<rgba8unorm, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_666010(tint_module_vars_struct tint_module_vars) {
+  uint arg_1 = 1u;
+  float4 res = tint_module_vars.arg_0.read(arg_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_666010 = func():void {
-  $B2: {
-    %arg_1:ptr<function, u32, read_write> = var, 1u
-    %5:texture_storage_1d<rgba8unorm, read_write> = load %arg_0
-    %6:u32 = load %arg_1
-    %7:vec4<f32> = textureLoad %5, %6
-    %res:ptr<function, vec4<f32>, read_write> = var, %7
-    %9:vec4<f32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_666010(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_666010
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_666010(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_666010
-    ret
-  }
+kernel void compute_main(texture1d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_666010(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_666010
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/6678b6.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/6678b6.wgsl.expected.ir.msl
index 505ab3b..6e399c1 100644
--- a/test/tint/builtins/gen/var/textureLoad/6678b6.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/6678b6.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<int, access::read> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<rgba16sint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_6678b6(tint_module_vars_struct tint_module_vars) {
+  int arg_1 = 1;
+  int4 res = tint_module_vars.arg_0.read(uint(arg_1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_6678b6 = func():void {
-  $B2: {
-    %arg_1:ptr<function, i32, read_write> = var, 1i
-    %5:texture_storage_1d<rgba16sint, read> = load %arg_0
-    %6:i32 = load %arg_1
-    %7:vec4<i32> = textureLoad %5, %6
-    %res:ptr<function, vec4<i32>, read_write> = var, %7
-    %9:vec4<i32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_6678b6(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_6678b6
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_6678b6(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_6678b6
-    ret
-  }
+kernel void compute_main(texture1d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_6678b6(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_6678b6
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/66be47.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/66be47.wgsl.expected.ir.msl
index 09fb9fe..da10d0a 100644
--- a/test/tint/builtins/gen/var/textureLoad/66be47.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/66be47.wgsl.expected.ir.msl
@@ -1,49 +1,35 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  depth2d_array<float, access::sample> arg_0;
+  device float* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_depth_2d_array, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, f32, read_write> = var @binding_point(2, 0)
+void textureLoad_66be47(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  uint arg_2 = 1u;
+  uint arg_3 = 1u;
+  uint const v = arg_2;
+  uint const v_1 = arg_3;
+  float res = tint_module_vars.arg_0.read(uint2(arg_1), v, v_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_66be47 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %arg_2:ptr<function, u32, read_write> = var, 1u
-    %arg_3:ptr<function, u32, read_write> = var, 1u
-    %7:texture_depth_2d_array = load %arg_0
-    %8:vec2<i32> = load %arg_1
-    %9:u32 = load %arg_2
-    %10:u32 = load %arg_3
-    %11:f32 = textureLoad %7, %8, %9, %10
-    %res:ptr<function, f32, read_write> = var, %11
-    %13:f32 = load %res
-    store %prevent_dce, %13
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_66be47(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %15:void = call %textureLoad_66be47
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(depth2d_array<float, access::sample> arg_0 [[texture(0)]], device float* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_66be47(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %17:void = call %textureLoad_66be47
-    ret
-  }
+kernel void compute_main(depth2d_array<float, access::sample> arg_0 [[texture(0)]], device float* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_66be47(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %19:void = call %textureLoad_66be47
-    ret
-  }
+vertex vertex_main_outputs vertex_main(depth2d_array<float, access::sample> arg_0 [[texture(0)]], device float* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/67d826.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/67d826.wgsl.expected.ir.msl
index 756e595..58f6770 100644
--- a/test/tint/builtins/gen/var/textureLoad/67d826.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/67d826.wgsl.expected.ir.msl
@@ -1,47 +1,33 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<r32float, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_67d826(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  uint arg_2 = 1u;
+  uint const v = arg_2;
+  float4 res = tint_module_vars.arg_0.read(uint2(arg_1), v);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_67d826 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %arg_2:ptr<function, u32, read_write> = var, 1u
-    %6:texture_storage_2d_array<r32float, read_write> = load %arg_0
-    %7:vec2<i32> = load %arg_1
-    %8:u32 = load %arg_2
-    %9:vec4<f32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<f32>, read_write> = var, %9
-    %11:vec4<f32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_67d826(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_67d826
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_67d826(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_67d826
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_67d826(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_67d826
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/67edca.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/67edca.wgsl.expected.ir.msl
index 523719c..2528f1f 100644
--- a/test/tint/builtins/gen/var/textureLoad/67edca.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/67edca.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<uint, access::read> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<rgba32uint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_67edca(tint_module_vars_struct tint_module_vars) {
+  int3 arg_1 = int3(1);
+  uint4 res = tint_module_vars.arg_0.read(uint3(arg_1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_67edca = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec3<i32>, read_write> = var, vec3<i32>(1i)
-    %5:texture_storage_3d<rgba32uint, read> = load %arg_0
-    %6:vec3<i32> = load %arg_1
-    %7:vec4<u32> = textureLoad %5, %6
-    %res:ptr<function, vec4<u32>, read_write> = var, %7
-    %9:vec4<u32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_67edca(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_67edca
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_67edca(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_67edca
-    ret
-  }
+kernel void compute_main(texture3d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_67edca(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_67edca
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/68d273.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/68d273.wgsl.expected.ir.msl
index 8276858..b6cccc4 100644
--- a/test/tint/builtins/gen/var/textureLoad/68d273.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/68d273.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<int, access::read_write> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<rgba16sint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_68d273(tint_module_vars_struct tint_module_vars) {
+  uint3 arg_1 = uint3(1u);
+  int4 res = tint_module_vars.arg_0.read(arg_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_68d273 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec3<u32>, read_write> = var, vec3<u32>(1u)
-    %5:texture_storage_3d<rgba16sint, read_write> = load %arg_0
-    %6:vec3<u32> = load %arg_1
-    %7:vec4<i32> = textureLoad %5, %6
-    %res:ptr<function, vec4<i32>, read_write> = var, %7
-    %9:vec4<i32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_68d273(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_68d273
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_68d273(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_68d273
-    ret
-  }
+kernel void compute_main(texture3d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_68d273(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_68d273
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/6925bc.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/6925bc.wgsl.expected.ir.msl
index c0e775a..932d9b3 100644
--- a/test/tint/builtins/gen/var/textureLoad/6925bc.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/6925bc.wgsl.expected.ir.msl
@@ -1,47 +1,33 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  depth2d_ms<float, access::read> arg_0;
+  device float* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_depth_multisampled_2d, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, f32, read_write> = var @binding_point(2, 0)
+void textureLoad_6925bc(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  uint arg_2 = 1u;
+  uint const v = arg_2;
+  float res = tint_module_vars.arg_0.read(uint2(arg_1), v);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_6925bc = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %arg_2:ptr<function, u32, read_write> = var, 1u
-    %6:texture_depth_multisampled_2d = load %arg_0
-    %7:vec2<i32> = load %arg_1
-    %8:u32 = load %arg_2
-    %9:f32 = textureLoad %6, %7, %8
-    %res:ptr<function, f32, read_write> = var, %9
-    %11:f32 = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_6925bc(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_6925bc
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(depth2d_ms<float, access::read> arg_0 [[texture(0)]], device float* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_6925bc(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_6925bc
-    ret
-  }
+kernel void compute_main(depth2d_ms<float, access::read> arg_0 [[texture(0)]], device float* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_6925bc(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_6925bc
-    ret
-  }
+vertex vertex_main_outputs vertex_main(depth2d_ms<float, access::read> arg_0 [[texture(0)]], device float* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/69fee5.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/69fee5.wgsl.expected.ir.msl
index 65eb84e..3ef7324 100644
--- a/test/tint/builtins/gen/var/textureLoad/69fee5.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/69fee5.wgsl.expected.ir.msl
@@ -1,47 +1,32 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<r32float, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_69fee5(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  int arg_2 = 1;
+  float4 res = tint_module_vars.arg_0.read(arg_1, arg_2);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_69fee5 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %arg_2:ptr<function, i32, read_write> = var, 1i
-    %6:texture_storage_2d_array<r32float, read_write> = load %arg_0
-    %7:vec2<u32> = load %arg_1
-    %8:i32 = load %arg_2
-    %9:vec4<f32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<f32>, read_write> = var, %9
-    %11:vec4<f32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_69fee5(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_69fee5
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_69fee5(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_69fee5
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_69fee5(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_69fee5
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/6a6871.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/6a6871.wgsl.expected.ir.msl
index 48854d2..e43ba23 100644
--- a/test/tint/builtins/gen/var/textureLoad/6a6871.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/6a6871.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<rgba32float, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_6a6871(tint_module_vars_struct tint_module_vars) {
+  int3 arg_1 = int3(1);
+  float4 res = tint_module_vars.arg_0.read(uint3(arg_1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_6a6871 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec3<i32>, read_write> = var, vec3<i32>(1i)
-    %5:texture_storage_3d<rgba32float, read_write> = load %arg_0
-    %6:vec3<i32> = load %arg_1
-    %7:vec4<f32> = textureLoad %5, %6
-    %res:ptr<function, vec4<f32>, read_write> = var, %7
-    %9:vec4<f32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_6a6871(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_6a6871
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_6a6871(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_6a6871
-    ret
-  }
+kernel void compute_main(texture3d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_6a6871(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_6a6871
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/6b77d4.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/6b77d4.wgsl.expected.ir.msl
index 66a9d20..066f148 100644
--- a/test/tint/builtins/gen/var/textureLoad/6b77d4.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/6b77d4.wgsl.expected.ir.msl
@@ -1,47 +1,32 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<uint, access::sample> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_1d<u32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_6b77d4(tint_module_vars_struct tint_module_vars) {
+  int arg_1 = 1;
+  uint arg_2 = 1u;
+  uint4 res = tint_module_vars.arg_0.read(uint(arg_1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_6b77d4 = func():void {
-  $B2: {
-    %arg_1:ptr<function, i32, read_write> = var, 1i
-    %arg_2:ptr<function, u32, read_write> = var, 1u
-    %6:texture_1d<u32> = load %arg_0
-    %7:i32 = load %arg_1
-    %8:u32 = load %arg_2
-    %9:vec4<u32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<u32>, read_write> = var, %9
-    %11:vec4<u32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_6b77d4(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_6b77d4
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_6b77d4(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_6b77d4
-    ret
-  }
+kernel void compute_main(texture1d<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_6b77d4(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_6b77d4
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/6b8ba6.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/6b8ba6.wgsl.expected.ir.msl
index 27d97c9..2d9e3a4 100644
--- a/test/tint/builtins/gen/var/textureLoad/6b8ba6.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/6b8ba6.wgsl.expected.ir.msl
@@ -1,47 +1,32 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba16float, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_6b8ba6(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  uint arg_2 = 1u;
+  float4 res = tint_module_vars.arg_0.read(arg_1, arg_2);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_6b8ba6 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %arg_2:ptr<function, u32, read_write> = var, 1u
-    %6:texture_storage_2d_array<rgba16float, read_write> = load %arg_0
-    %7:vec2<u32> = load %arg_1
-    %8:u32 = load %arg_2
-    %9:vec4<f32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<f32>, read_write> = var, %9
-    %11:vec4<f32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_6b8ba6(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_6b8ba6
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_6b8ba6(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_6b8ba6
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_6b8ba6(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_6b8ba6
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/6ba9ab.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/6ba9ab.wgsl.expected.ir.msl
index 5e431d2..0210620 100644
--- a/test/tint/builtins/gen/var/textureLoad/6ba9ab.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/6ba9ab.wgsl.expected.ir.msl
@@ -1,47 +1,32 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba8unorm, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_6ba9ab(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  uint arg_2 = 1u;
+  float4 res = tint_module_vars.arg_0.read(arg_1, arg_2);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_6ba9ab = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %arg_2:ptr<function, u32, read_write> = var, 1u
-    %6:texture_storage_2d_array<rgba8unorm, read_write> = load %arg_0
-    %7:vec2<u32> = load %arg_1
-    %8:u32 = load %arg_2
-    %9:vec4<f32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<f32>, read_write> = var, %9
-    %11:vec4<f32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_6ba9ab(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_6ba9ab
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_6ba9ab(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_6ba9ab
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_6ba9ab(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_6ba9ab
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/6bf3e2.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/6bf3e2.wgsl.expected.ir.msl
index f0542fe..822cb9d 100644
--- a/test/tint/builtins/gen/var/textureLoad/6bf3e2.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/6bf3e2.wgsl.expected.ir.msl
@@ -1,47 +1,33 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<bgra8unorm, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_6bf3e2(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  uint arg_2 = 1u;
+  uint const v = arg_2;
+  float4 res = tint_module_vars.arg_0.read(uint2(arg_1), v);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_6bf3e2 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %arg_2:ptr<function, u32, read_write> = var, 1u
-    %6:texture_storage_2d_array<bgra8unorm, read_write> = load %arg_0
-    %7:vec2<i32> = load %arg_1
-    %8:u32 = load %arg_2
-    %9:vec4<f32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<f32>, read_write> = var, %9
-    %11:vec4<f32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_6bf3e2(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_6bf3e2
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_6bf3e2(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_6bf3e2
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_6bf3e2(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_6bf3e2
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/6bf4b7.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/6bf4b7.wgsl.expected.ir.msl
index 5ead07e..4ad8f5b 100644
--- a/test/tint/builtins/gen/var/textureLoad/6bf4b7.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/6bf4b7.wgsl.expected.ir.msl
@@ -1,47 +1,33 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<uint, access::sample> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_3d<u32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_6bf4b7(tint_module_vars_struct tint_module_vars) {
+  int3 arg_1 = int3(1);
+  uint arg_2 = 1u;
+  uint const v = arg_2;
+  uint4 res = tint_module_vars.arg_0.read(uint3(arg_1), v);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_6bf4b7 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec3<i32>, read_write> = var, vec3<i32>(1i)
-    %arg_2:ptr<function, u32, read_write> = var, 1u
-    %6:texture_3d<u32> = load %arg_0
-    %7:vec3<i32> = load %arg_1
-    %8:u32 = load %arg_2
-    %9:vec4<u32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<u32>, read_write> = var, %9
-    %11:vec4<u32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_6bf4b7(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_6bf4b7
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_6bf4b7(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_6bf4b7
-    ret
-  }
+kernel void compute_main(texture3d<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_6bf4b7(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_6bf4b7
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/6d1fb4.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/6d1fb4.wgsl.expected.ir.msl
index 25444b7..6c898a1 100644
--- a/test/tint/builtins/gen/var/textureLoad/6d1fb4.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/6d1fb4.wgsl.expected.ir.msl
@@ -1,47 +1,32 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<uint, access::read_write> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<r32uint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_6d1fb4(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  uint arg_2 = 1u;
+  uint4 res = tint_module_vars.arg_0.read(arg_1, arg_2);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_6d1fb4 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %arg_2:ptr<function, u32, read_write> = var, 1u
-    %6:texture_storage_2d_array<r32uint, read_write> = load %arg_0
-    %7:vec2<u32> = load %arg_1
-    %8:u32 = load %arg_2
-    %9:vec4<u32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<u32>, read_write> = var, %9
-    %11:vec4<u32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_6d1fb4(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_6d1fb4
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_6d1fb4(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_6d1fb4
-    ret
-  }
+kernel void compute_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_6d1fb4(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_6d1fb4
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/6d376a.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/6d376a.wgsl.expected.ir.msl
index 49cf4c6..3f3aa25 100644
--- a/test/tint/builtins/gen/var/textureLoad/6d376a.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/6d376a.wgsl.expected.ir.msl
@@ -1,47 +1,32 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<float, access::sample> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_1d<f32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_6d376a(tint_module_vars_struct tint_module_vars) {
+  uint arg_1 = 1u;
+  uint arg_2 = 1u;
+  float4 res = tint_module_vars.arg_0.read(arg_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_6d376a = func():void {
-  $B2: {
-    %arg_1:ptr<function, u32, read_write> = var, 1u
-    %arg_2:ptr<function, u32, read_write> = var, 1u
-    %6:texture_1d<f32> = load %arg_0
-    %7:u32 = load %arg_1
-    %8:u32 = load %arg_2
-    %9:vec4<f32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<f32>, read_write> = var, %9
-    %11:vec4<f32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_6d376a(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_6d376a
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_6d376a(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_6d376a
-    ret
-  }
+kernel void compute_main(texture1d<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_6d376a(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_6d376a
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/6d7bb5.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/6d7bb5.wgsl.expected.ir.msl
index 8ebb6f0..94b05fc 100644
--- a/test/tint/builtins/gen/var/textureLoad/6d7bb5.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/6d7bb5.wgsl.expected.ir.msl
@@ -1,47 +1,32 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba8unorm, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_6d7bb5(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  int arg_2 = 1;
+  float4 res = tint_module_vars.arg_0.read(arg_1, arg_2);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_6d7bb5 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %arg_2:ptr<function, i32, read_write> = var, 1i
-    %6:texture_storage_2d_array<rgba8unorm, read_write> = load %arg_0
-    %7:vec2<u32> = load %arg_1
-    %8:i32 = load %arg_2
-    %9:vec4<f32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<f32>, read_write> = var, %9
-    %11:vec4<f32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_6d7bb5(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_6d7bb5
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_6d7bb5(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_6d7bb5
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_6d7bb5(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_6d7bb5
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/6e903f.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/6e903f.wgsl.expected.ir.msl
index 2110de9..6198411 100644
--- a/test/tint/builtins/gen/var/textureLoad/6e903f.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/6e903f.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<int, access::read_write> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<rgba8sint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_6e903f(tint_module_vars_struct tint_module_vars) {
+  int3 arg_1 = int3(1);
+  int4 res = tint_module_vars.arg_0.read(uint3(arg_1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_6e903f = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec3<i32>, read_write> = var, vec3<i32>(1i)
-    %5:texture_storage_3d<rgba8sint, read_write> = load %arg_0
-    %6:vec3<i32> = load %arg_1
-    %7:vec4<i32> = textureLoad %5, %6
-    %res:ptr<function, vec4<i32>, read_write> = var, %7
-    %9:vec4<i32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_6e903f(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_6e903f
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_6e903f(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_6e903f
-    ret
-  }
+kernel void compute_main(texture3d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_6e903f(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_6e903f
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/6f0370.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/6f0370.wgsl.expected.ir.msl
index 226165f..53a67f1 100644
--- a/test/tint/builtins/gen/var/textureLoad/6f0370.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/6f0370.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<r8unorm, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_6f0370(tint_module_vars_struct tint_module_vars) {
+  uint3 arg_1 = uint3(1u);
+  float4 res = tint_module_vars.arg_0.read(arg_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_6f0370 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec3<u32>, read_write> = var, vec3<u32>(1u)
-    %5:texture_storage_3d<r8unorm, read> = load %arg_0
-    %6:vec3<u32> = load %arg_1
-    %7:vec4<f32> = textureLoad %5, %6
-    %res:ptr<function, vec4<f32>, read_write> = var, %7
-    %9:vec4<f32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_6f0370(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_6f0370
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_6f0370(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_6f0370
-    ret
-  }
+kernel void compute_main(texture3d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_6f0370(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_6f0370
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/6f0ea8.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/6f0ea8.wgsl.expected.ir.msl
index 6307856..2fd61e4 100644
--- a/test/tint/builtins/gen/var/textureLoad/6f0ea8.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/6f0ea8.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<rgba16float, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_6f0ea8(tint_module_vars_struct tint_module_vars) {
+  int3 arg_1 = int3(1);
+  float4 res = tint_module_vars.arg_0.read(uint3(arg_1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_6f0ea8 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec3<i32>, read_write> = var, vec3<i32>(1i)
-    %5:texture_storage_3d<rgba16float, read_write> = load %arg_0
-    %6:vec3<i32> = load %arg_1
-    %7:vec4<f32> = textureLoad %5, %6
-    %res:ptr<function, vec4<f32>, read_write> = var, %7
-    %9:vec4<f32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_6f0ea8(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_6f0ea8
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_6f0ea8(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_6f0ea8
-    ret
-  }
+kernel void compute_main(texture3d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_6f0ea8(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_6f0ea8
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/6f1750.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/6f1750.wgsl.expected.ir.msl
index 873d5a4..37dd19e 100644
--- a/test/tint/builtins/gen/var/textureLoad/6f1750.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/6f1750.wgsl.expected.ir.msl
@@ -1,47 +1,32 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<r32float, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_6f1750(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  uint arg_2 = 1u;
+  float4 res = tint_module_vars.arg_0.read(arg_1, arg_2);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_6f1750 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %arg_2:ptr<function, u32, read_write> = var, 1u
-    %6:texture_storage_2d_array<r32float, read> = load %arg_0
-    %7:vec2<u32> = load %arg_1
-    %8:u32 = load %arg_2
-    %9:vec4<f32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<f32>, read_write> = var, %9
-    %11:vec4<f32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_6f1750(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_6f1750
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_6f1750(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_6f1750
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_6f1750(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_6f1750
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/6f8927.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/6f8927.wgsl.expected.ir.msl
index db63453..882a412 100644
--- a/test/tint/builtins/gen/var/textureLoad/6f8927.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/6f8927.wgsl.expected.ir.msl
@@ -1,47 +1,33 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba32float, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_6f8927(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  uint arg_2 = 1u;
+  uint const v = arg_2;
+  float4 res = tint_module_vars.arg_0.read(uint2(arg_1), v);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_6f8927 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %arg_2:ptr<function, u32, read_write> = var, 1u
-    %6:texture_storage_2d_array<rgba32float, read_write> = load %arg_0
-    %7:vec2<i32> = load %arg_1
-    %8:u32 = load %arg_2
-    %9:vec4<f32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<f32>, read_write> = var, %9
-    %11:vec4<f32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_6f8927(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_6f8927
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_6f8927(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_6f8927
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_6f8927(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_6f8927
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/714471.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/714471.wgsl.expected.ir.msl
index eaac8b7..48badb2 100644
--- a/test/tint/builtins/gen/var/textureLoad/714471.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/714471.wgsl.expected.ir.msl
@@ -1,47 +1,32 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<int, access::sample> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_2d<i32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_714471(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  uint arg_2 = 1u;
+  int4 res = tint_module_vars.arg_0.read(arg_1, arg_2);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_714471 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %arg_2:ptr<function, u32, read_write> = var, 1u
-    %6:texture_2d<i32> = load %arg_0
-    %7:vec2<u32> = load %arg_1
-    %8:u32 = load %arg_2
-    %9:vec4<i32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<i32>, read_write> = var, %9
-    %11:vec4<i32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_714471(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_714471
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_714471(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_714471
-    ret
-  }
+kernel void compute_main(texture2d<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_714471(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_714471
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/72bb3c.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/72bb3c.wgsl.expected.ir.msl
index f861597..fc98f6d 100644
--- a/test/tint/builtins/gen/var/textureLoad/72bb3c.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/72bb3c.wgsl.expected.ir.msl
@@ -1,47 +1,32 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba8snorm, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_72bb3c(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  int arg_2 = 1;
+  float4 res = tint_module_vars.arg_0.read(arg_1, arg_2);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_72bb3c = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %arg_2:ptr<function, i32, read_write> = var, 1i
-    %6:texture_storage_2d_array<rgba8snorm, read> = load %arg_0
-    %7:vec2<u32> = load %arg_1
-    %8:i32 = load %arg_2
-    %9:vec4<f32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<f32>, read_write> = var, %9
-    %11:vec4<f32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_72bb3c(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_72bb3c
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_72bb3c(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_72bb3c
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_72bb3c(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_72bb3c
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/72c9c3.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/72c9c3.wgsl.expected.ir.msl
index ada8331..98782c8 100644
--- a/test/tint/builtins/gen/var/textureLoad/72c9c3.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/72c9c3.wgsl.expected.ir.msl
@@ -1,47 +1,33 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<r8unorm, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_72c9c3(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  uint arg_2 = 1u;
+  uint const v = arg_2;
+  float4 res = tint_module_vars.arg_0.read(uint2(arg_1), v);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_72c9c3 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %arg_2:ptr<function, u32, read_write> = var, 1u
-    %6:texture_storage_2d_array<r8unorm, read_write> = load %arg_0
-    %7:vec2<i32> = load %arg_1
-    %8:u32 = load %arg_2
-    %9:vec4<f32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<f32>, read_write> = var, %9
-    %11:vec4<f32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_72c9c3(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_72c9c3
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_72c9c3(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_72c9c3
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_72c9c3(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_72c9c3
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/742f1b.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/742f1b.wgsl.expected.ir.msl
index 726dab2..9ecdb28 100644
--- a/test/tint/builtins/gen/var/textureLoad/742f1b.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/742f1b.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<rgba16float, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_742f1b(tint_module_vars_struct tint_module_vars) {
+  uint3 arg_1 = uint3(1u);
+  float4 res = tint_module_vars.arg_0.read(arg_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_742f1b = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec3<u32>, read_write> = var, vec3<u32>(1u)
-    %5:texture_storage_3d<rgba16float, read_write> = load %arg_0
-    %6:vec3<u32> = load %arg_1
-    %7:vec4<f32> = textureLoad %5, %6
-    %res:ptr<function, vec4<f32>, read_write> = var, %7
-    %9:vec4<f32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_742f1b(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_742f1b
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_742f1b(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_742f1b
-    ret
-  }
+kernel void compute_main(texture3d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_742f1b(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_742f1b
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/749704.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/749704.wgsl.expected.ir.msl
index f05d19c..dfe1705 100644
--- a/test/tint/builtins/gen/var/textureLoad/749704.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/749704.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<uint, access::read> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<r32uint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_749704(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  uint4 res = tint_module_vars.arg_0.read(uint2(arg_1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_749704 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %5:texture_storage_2d<r32uint, read> = load %arg_0
-    %6:vec2<i32> = load %arg_1
-    %7:vec4<u32> = textureLoad %5, %6
-    %res:ptr<function, vec4<u32>, read_write> = var, %7
-    %9:vec4<u32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_749704(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_749704
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_749704(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_749704
-    ret
-  }
+kernel void compute_main(texture2d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_749704(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_749704
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/74a387.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/74a387.wgsl.expected.ir.msl
index d6ba41d..d627b04 100644
--- a/test/tint/builtins/gen/var/textureLoad/74a387.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/74a387.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<int, access::read_write> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<rgba8sint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_74a387(tint_module_vars_struct tint_module_vars) {
+  uint arg_1 = 1u;
+  int4 res = tint_module_vars.arg_0.read(arg_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_74a387 = func():void {
-  $B2: {
-    %arg_1:ptr<function, u32, read_write> = var, 1u
-    %5:texture_storage_1d<rgba8sint, read_write> = load %arg_0
-    %6:u32 = load %arg_1
-    %7:vec4<i32> = textureLoad %5, %6
-    %res:ptr<function, vec4<i32>, read_write> = var, %7
-    %9:vec4<i32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_74a387(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_74a387
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_74a387(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_74a387
-    ret
-  }
+kernel void compute_main(texture1d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_74a387(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_74a387
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/773c46.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/773c46.wgsl.expected.ir.msl
index 1cccab3..8223b4e 100644
--- a/test/tint/builtins/gen/var/textureLoad/773c46.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/773c46.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<uint, access::read> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<rg32uint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_773c46(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  uint4 res = tint_module_vars.arg_0.read(arg_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_773c46 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %5:texture_storage_2d<rg32uint, read> = load %arg_0
-    %6:vec2<u32> = load %arg_1
-    %7:vec4<u32> = textureLoad %5, %6
-    %res:ptr<function, vec4<u32>, read_write> = var, %7
-    %9:vec4<u32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_773c46(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_773c46
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_773c46(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_773c46
-    ret
-  }
+kernel void compute_main(texture2d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_773c46(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_773c46
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/789045.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/789045.wgsl.expected.ir.msl
index d969e01..0946646 100644
--- a/test/tint/builtins/gen/var/textureLoad/789045.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/789045.wgsl.expected.ir.msl
@@ -1,49 +1,35 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::sample> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_2d_array<f32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_789045(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  int arg_2 = 1;
+  uint arg_3 = 1u;
+  int const v = arg_2;
+  uint const v_1 = arg_3;
+  float4 res = tint_module_vars.arg_0.read(uint2(arg_1), v, v_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_789045 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %arg_2:ptr<function, i32, read_write> = var, 1i
-    %arg_3:ptr<function, u32, read_write> = var, 1u
-    %7:texture_2d_array<f32> = load %arg_0
-    %8:vec2<i32> = load %arg_1
-    %9:i32 = load %arg_2
-    %10:u32 = load %arg_3
-    %11:vec4<f32> = textureLoad %7, %8, %9, %10
-    %res:ptr<function, vec4<f32>, read_write> = var, %11
-    %13:vec4<f32> = load %res
-    store %prevent_dce, %13
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_789045(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %15:void = call %textureLoad_789045
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_789045(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %17:void = call %textureLoad_789045
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_789045(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %19:void = call %textureLoad_789045
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/79e697.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/79e697.wgsl.expected.ir.msl
index a22a214..27dcf16 100644
--- a/test/tint/builtins/gen/var/textureLoad/79e697.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/79e697.wgsl.expected.ir.msl
@@ -1,49 +1,35 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<int, access::sample> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_2d_array<i32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_79e697(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  int arg_2 = 1;
+  int arg_3 = 1;
+  int const v = arg_2;
+  int const v_1 = arg_3;
+  int4 res = tint_module_vars.arg_0.read(uint2(arg_1), v, v_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_79e697 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %arg_2:ptr<function, i32, read_write> = var, 1i
-    %arg_3:ptr<function, i32, read_write> = var, 1i
-    %7:texture_2d_array<i32> = load %arg_0
-    %8:vec2<i32> = load %arg_1
-    %9:i32 = load %arg_2
-    %10:i32 = load %arg_3
-    %11:vec4<i32> = textureLoad %7, %8, %9, %10
-    %res:ptr<function, vec4<i32>, read_write> = var, %11
-    %13:vec4<i32> = load %res
-    store %prevent_dce, %13
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_79e697(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %15:void = call %textureLoad_79e697
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_79e697(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %17:void = call %textureLoad_79e697
-    ret
-  }
+kernel void compute_main(texture2d_array<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_79e697(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %19:void = call %textureLoad_79e697
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/7ab4df.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/7ab4df.wgsl.expected.ir.msl
index c447fb6..356de0f 100644
--- a/test/tint/builtins/gen/var/textureLoad/7ab4df.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/7ab4df.wgsl.expected.ir.msl
@@ -1,49 +1,35 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<uint, access::sample> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_2d_array<u32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_7ab4df(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  uint arg_2 = 1u;
+  int arg_3 = 1;
+  uint const v = arg_2;
+  int const v_1 = arg_3;
+  uint4 res = tint_module_vars.arg_0.read(uint2(arg_1), v, v_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_7ab4df = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %arg_2:ptr<function, u32, read_write> = var, 1u
-    %arg_3:ptr<function, i32, read_write> = var, 1i
-    %7:texture_2d_array<u32> = load %arg_0
-    %8:vec2<i32> = load %arg_1
-    %9:u32 = load %arg_2
-    %10:i32 = load %arg_3
-    %11:vec4<u32> = textureLoad %7, %8, %9, %10
-    %res:ptr<function, vec4<u32>, read_write> = var, %11
-    %13:vec4<u32> = load %res
-    store %prevent_dce, %13
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_7ab4df(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %15:void = call %textureLoad_7ab4df
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_7ab4df(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %17:void = call %textureLoad_7ab4df
-    ret
-  }
+kernel void compute_main(texture2d_array<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_7ab4df(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %19:void = call %textureLoad_7ab4df
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/7b63e0.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/7b63e0.wgsl.expected.ir.msl
index 84eae31..9c774ca 100644
--- a/test/tint/builtins/gen/var/textureLoad/7b63e0.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/7b63e0.wgsl.expected.ir.msl
@@ -1,49 +1,33 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  depth2d_array<float, access::sample> arg_0;
+  device float* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_depth_2d_array, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, f32, read_write> = var @binding_point(2, 0)
+void textureLoad_7b63e0(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  uint arg_2 = 1u;
+  uint arg_3 = 1u;
+  float res = tint_module_vars.arg_0.read(arg_1, arg_2, arg_3);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_7b63e0 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %arg_2:ptr<function, u32, read_write> = var, 1u
-    %arg_3:ptr<function, u32, read_write> = var, 1u
-    %7:texture_depth_2d_array = load %arg_0
-    %8:vec2<u32> = load %arg_1
-    %9:u32 = load %arg_2
-    %10:u32 = load %arg_3
-    %11:f32 = textureLoad %7, %8, %9, %10
-    %res:ptr<function, f32, read_write> = var, %11
-    %13:f32 = load %res
-    store %prevent_dce, %13
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_7b63e0(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %15:void = call %textureLoad_7b63e0
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(depth2d_array<float, access::sample> arg_0 [[texture(0)]], device float* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_7b63e0(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %17:void = call %textureLoad_7b63e0
-    ret
-  }
+kernel void compute_main(depth2d_array<float, access::sample> arg_0 [[texture(0)]], device float* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_7b63e0(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %19:void = call %textureLoad_7b63e0
-    ret
-  }
+vertex vertex_main_outputs vertex_main(depth2d_array<float, access::sample> arg_0 [[texture(0)]], device float* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/7bee94.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/7bee94.wgsl.expected.ir.msl
index 1f30506..40b5aa1 100644
--- a/test/tint/builtins/gen/var/textureLoad/7bee94.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/7bee94.wgsl.expected.ir.msl
@@ -1,47 +1,32 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_ms<int, access::read> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_multisampled_2d<i32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_7bee94(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  int arg_2 = 1;
+  int4 res = tint_module_vars.arg_0.read(arg_1, arg_2);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_7bee94 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %arg_2:ptr<function, i32, read_write> = var, 1i
-    %6:texture_multisampled_2d<i32> = load %arg_0
-    %7:vec2<u32> = load %arg_1
-    %8:i32 = load %arg_2
-    %9:vec4<i32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<i32>, read_write> = var, %9
-    %11:vec4<i32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_7bee94(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_7bee94
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_ms<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_7bee94(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_7bee94
-    ret
-  }
+kernel void compute_main(texture2d_ms<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_7bee94(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_7bee94
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_ms<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/7c90e5.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/7c90e5.wgsl.expected.ir.msl
index 3f6532c..aa03e10 100644
--- a/test/tint/builtins/gen/var/textureLoad/7c90e5.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/7c90e5.wgsl.expected.ir.msl
@@ -1,49 +1,35 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<uint, access::sample> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_2d_array<u32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_7c90e5(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  int arg_2 = 1;
+  int arg_3 = 1;
+  int const v = arg_2;
+  int const v_1 = arg_3;
+  uint4 res = tint_module_vars.arg_0.read(uint2(arg_1), v, v_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_7c90e5 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %arg_2:ptr<function, i32, read_write> = var, 1i
-    %arg_3:ptr<function, i32, read_write> = var, 1i
-    %7:texture_2d_array<u32> = load %arg_0
-    %8:vec2<i32> = load %arg_1
-    %9:i32 = load %arg_2
-    %10:i32 = load %arg_3
-    %11:vec4<u32> = textureLoad %7, %8, %9, %10
-    %res:ptr<function, vec4<u32>, read_write> = var, %11
-    %13:vec4<u32> = load %res
-    store %prevent_dce, %13
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_7c90e5(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %15:void = call %textureLoad_7c90e5
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_7c90e5(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %17:void = call %textureLoad_7c90e5
-    ret
-  }
+kernel void compute_main(texture2d_array<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_7c90e5(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %19:void = call %textureLoad_7c90e5
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/7dab57.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/7dab57.wgsl.expected.ir.msl
index 9e66eec..8d17733 100644
--- a/test/tint/builtins/gen/var/textureLoad/7dab57.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/7dab57.wgsl.expected.ir.msl
@@ -1,47 +1,32 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<int, access::read> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rg32sint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_7dab57(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  int arg_2 = 1;
+  int4 res = tint_module_vars.arg_0.read(arg_1, arg_2);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_7dab57 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %arg_2:ptr<function, i32, read_write> = var, 1i
-    %6:texture_storage_2d_array<rg32sint, read> = load %arg_0
-    %7:vec2<u32> = load %arg_1
-    %8:i32 = load %arg_2
-    %9:vec4<i32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<i32>, read_write> = var, %9
-    %11:vec4<i32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_7dab57(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_7dab57
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_7dab57(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_7dab57
-    ret
-  }
+kernel void compute_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_7dab57(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_7dab57
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/7dd3d5.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/7dd3d5.wgsl.expected.ir.msl
index b08d6d9..7577732 100644
--- a/test/tint/builtins/gen/var/textureLoad/7dd3d5.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/7dd3d5.wgsl.expected.ir.msl
@@ -1,47 +1,33 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<r8unorm, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_7dd3d5(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  int arg_2 = 1;
+  int const v = arg_2;
+  float4 res = tint_module_vars.arg_0.read(uint2(arg_1), v);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_7dd3d5 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %arg_2:ptr<function, i32, read_write> = var, 1i
-    %6:texture_storage_2d_array<r8unorm, read_write> = load %arg_0
-    %7:vec2<i32> = load %arg_1
-    %8:i32 = load %arg_2
-    %9:vec4<f32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<f32>, read_write> = var, %9
-    %11:vec4<f32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_7dd3d5(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_7dd3d5
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_7dd3d5(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_7dd3d5
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_7dd3d5(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_7dd3d5
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/7e5cbc.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/7e5cbc.wgsl.expected.ir.msl
index 9cd480d..3737b74 100644
--- a/test/tint/builtins/gen/var/textureLoad/7e5cbc.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/7e5cbc.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<bgra8unorm, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_7e5cbc(tint_module_vars_struct tint_module_vars) {
+  uint arg_1 = 1u;
+  float4 res = tint_module_vars.arg_0.read(arg_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_7e5cbc = func():void {
-  $B2: {
-    %arg_1:ptr<function, u32, read_write> = var, 1u
-    %5:texture_storage_1d<bgra8unorm, read_write> = load %arg_0
-    %6:u32 = load %arg_1
-    %7:vec4<f32> = textureLoad %5, %6
-    %res:ptr<function, vec4<f32>, read_write> = var, %7
-    %9:vec4<f32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_7e5cbc(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_7e5cbc
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_7e5cbc(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_7e5cbc
-    ret
-  }
+kernel void compute_main(texture1d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_7e5cbc(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_7e5cbc
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/7fd822.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/7fd822.wgsl.expected.ir.msl
index 52b39ce..fba5831 100644
--- a/test/tint/builtins/gen/var/textureLoad/7fd822.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/7fd822.wgsl.expected.ir.msl
@@ -1,47 +1,32 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  depth2d<float, access::sample> arg_0;
+  device float* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_depth_2d, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, f32, read_write> = var @binding_point(2, 0)
+void textureLoad_7fd822(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  int arg_2 = 1;
+  float res = tint_module_vars.arg_0.read(arg_1, arg_2);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_7fd822 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %arg_2:ptr<function, i32, read_write> = var, 1i
-    %6:texture_depth_2d = load %arg_0
-    %7:vec2<u32> = load %arg_1
-    %8:i32 = load %arg_2
-    %9:f32 = textureLoad %6, %7, %8
-    %res:ptr<function, f32, read_write> = var, %9
-    %11:f32 = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_7fd822(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_7fd822
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(depth2d<float, access::sample> arg_0 [[texture(0)]], device float* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_7fd822(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_7fd822
-    ret
-  }
+kernel void compute_main(depth2d<float, access::sample> arg_0 [[texture(0)]], device float* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_7fd822(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_7fd822
-    ret
-  }
+vertex vertex_main_outputs vertex_main(depth2d<float, access::sample> arg_0 [[texture(0)]], device float* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/80dae1.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/80dae1.wgsl.expected.ir.msl
index e74885f..4ccbacc 100644
--- a/test/tint/builtins/gen/var/textureLoad/80dae1.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/80dae1.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<int, access::read_write> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<rgba16sint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_80dae1(tint_module_vars_struct tint_module_vars) {
+  uint arg_1 = 1u;
+  int4 res = tint_module_vars.arg_0.read(arg_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_80dae1 = func():void {
-  $B2: {
-    %arg_1:ptr<function, u32, read_write> = var, 1u
-    %5:texture_storage_1d<rgba16sint, read_write> = load %arg_0
-    %6:u32 = load %arg_1
-    %7:vec4<i32> = textureLoad %5, %6
-    %res:ptr<function, vec4<i32>, read_write> = var, %7
-    %9:vec4<i32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_80dae1(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_80dae1
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_80dae1(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_80dae1
-    ret
-  }
+kernel void compute_main(texture1d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_80dae1(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_80dae1
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/81c381.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/81c381.wgsl.expected.ir.msl
index 1f19de3..4ffd41b 100644
--- a/test/tint/builtins/gen/var/textureLoad/81c381.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/81c381.wgsl.expected.ir.msl
@@ -1,47 +1,32 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<float, access::sample> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_1d<f32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_81c381(tint_module_vars_struct tint_module_vars) {
+  int arg_1 = 1;
+  int arg_2 = 1;
+  float4 res = tint_module_vars.arg_0.read(uint(arg_1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_81c381 = func():void {
-  $B2: {
-    %arg_1:ptr<function, i32, read_write> = var, 1i
-    %arg_2:ptr<function, i32, read_write> = var, 1i
-    %6:texture_1d<f32> = load %arg_0
-    %7:i32 = load %arg_1
-    %8:i32 = load %arg_2
-    %9:vec4<f32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<f32>, read_write> = var, %9
-    %11:vec4<f32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_81c381(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_81c381
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_81c381(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_81c381
-    ret
-  }
+kernel void compute_main(texture1d<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_81c381(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_81c381
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/83162f.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/83162f.wgsl.expected.ir.msl
index 1e37af2..a82246f 100644
--- a/test/tint/builtins/gen/var/textureLoad/83162f.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/83162f.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<rg32float, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_83162f(tint_module_vars_struct tint_module_vars) {
+  uint3 arg_1 = uint3(1u);
+  float4 res = tint_module_vars.arg_0.read(arg_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_83162f = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec3<u32>, read_write> = var, vec3<u32>(1u)
-    %5:texture_storage_3d<rg32float, read> = load %arg_0
-    %6:vec3<u32> = load %arg_1
-    %7:vec4<f32> = textureLoad %5, %6
-    %res:ptr<function, vec4<f32>, read_write> = var, %7
-    %9:vec4<f32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_83162f(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_83162f
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_83162f(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_83162f
-    ret
-  }
+kernel void compute_main(texture3d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_83162f(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_83162f
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/83cea4.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/83cea4.wgsl.expected.ir.msl
index ceaa9b2..488b932 100644
--- a/test/tint/builtins/gen/var/textureLoad/83cea4.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/83cea4.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<uint, access::read> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<rgba16uint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_83cea4(tint_module_vars_struct tint_module_vars) {
+  int arg_1 = 1;
+  uint4 res = tint_module_vars.arg_0.read(uint(arg_1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_83cea4 = func():void {
-  $B2: {
-    %arg_1:ptr<function, i32, read_write> = var, 1i
-    %5:texture_storage_1d<rgba16uint, read> = load %arg_0
-    %6:i32 = load %arg_1
-    %7:vec4<u32> = textureLoad %5, %6
-    %res:ptr<function, vec4<u32>, read_write> = var, %7
-    %9:vec4<u32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_83cea4(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_83cea4
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_83cea4(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_83cea4
-    ret
-  }
+kernel void compute_main(texture1d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_83cea4(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_83cea4
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/83d6e3.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/83d6e3.wgsl.expected.ir.msl
index fde7e44..c005ed5 100644
--- a/test/tint/builtins/gen/var/textureLoad/83d6e3.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/83d6e3.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<uint, access::read_write> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<r32uint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_83d6e3(tint_module_vars_struct tint_module_vars) {
+  int arg_1 = 1;
+  uint4 res = tint_module_vars.arg_0.read(uint(arg_1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_83d6e3 = func():void {
-  $B2: {
-    %arg_1:ptr<function, i32, read_write> = var, 1i
-    %5:texture_storage_1d<r32uint, read_write> = load %arg_0
-    %6:i32 = load %arg_1
-    %7:vec4<u32> = textureLoad %5, %6
-    %res:ptr<function, vec4<u32>, read_write> = var, %7
-    %9:vec4<u32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_83d6e3(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_83d6e3
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_83d6e3(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_83d6e3
-    ret
-  }
+kernel void compute_main(texture1d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_83d6e3(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_83d6e3
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/848d85.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/848d85.wgsl.expected.ir.msl
index 72691f1..506e35e 100644
--- a/test/tint/builtins/gen/var/textureLoad/848d85.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/848d85.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<rgba16float, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_848d85(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  float4 res = tint_module_vars.arg_0.read(arg_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_848d85 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %5:texture_storage_2d<rgba16float, read_write> = load %arg_0
-    %6:vec2<u32> = load %arg_1
-    %7:vec4<f32> = textureLoad %5, %6
-    %res:ptr<function, vec4<f32>, read_write> = var, %7
-    %9:vec4<f32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_848d85(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_848d85
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_848d85(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_848d85
-    ret
-  }
+kernel void compute_main(texture2d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_848d85(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_848d85
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/84a438.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/84a438.wgsl.expected.ir.msl
index f65d0bd..6931524 100644
--- a/test/tint/builtins/gen/var/textureLoad/84a438.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/84a438.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<uint, access::read_write> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<rgba8uint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_84a438(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  uint4 res = tint_module_vars.arg_0.read(uint2(arg_1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_84a438 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %5:texture_storage_2d<rgba8uint, read_write> = load %arg_0
-    %6:vec2<i32> = load %arg_1
-    %7:vec4<u32> = textureLoad %5, %6
-    %res:ptr<function, vec4<u32>, read_write> = var, %7
-    %9:vec4<u32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_84a438(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_84a438
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_84a438(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_84a438
-    ret
-  }
+kernel void compute_main(texture2d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_84a438(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_84a438
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/84c728.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/84c728.wgsl.expected.ir.msl
index 8d22db2..347eb6c 100644
--- a/test/tint/builtins/gen/var/textureLoad/84c728.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/84c728.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<rgba32float, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_84c728(tint_module_vars_struct tint_module_vars) {
+  uint arg_1 = 1u;
+  float4 res = tint_module_vars.arg_0.read(arg_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_84c728 = func():void {
-  $B2: {
-    %arg_1:ptr<function, u32, read_write> = var, 1u
-    %5:texture_storage_1d<rgba32float, read> = load %arg_0
-    %6:u32 = load %arg_1
-    %7:vec4<f32> = textureLoad %5, %6
-    %res:ptr<function, vec4<f32>, read_write> = var, %7
-    %9:vec4<f32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_84c728(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_84c728
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_84c728(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_84c728
-    ret
-  }
+kernel void compute_main(texture1d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_84c728(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_84c728
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/84dee1.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/84dee1.wgsl.expected.ir.msl
index 8ca984c..b9a48ea 100644
--- a/test/tint/builtins/gen/var/textureLoad/84dee1.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/84dee1.wgsl.expected.ir.msl
@@ -1,47 +1,32 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<float, access::sample> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_2d<f32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_84dee1(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  uint arg_2 = 1u;
+  float4 res = tint_module_vars.arg_0.read(arg_1, arg_2);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_84dee1 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %arg_2:ptr<function, u32, read_write> = var, 1u
-    %6:texture_2d<f32> = load %arg_0
-    %7:vec2<u32> = load %arg_1
-    %8:u32 = load %arg_2
-    %9:vec4<f32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<f32>, read_write> = var, %9
-    %11:vec4<f32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_84dee1(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_84dee1
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_84dee1(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_84dee1
-    ret
-  }
+kernel void compute_main(texture2d<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_84dee1(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_84dee1
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/8527b1.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/8527b1.wgsl.expected.ir.msl
index ee3e1c3..bb37ea8 100644
--- a/test/tint/builtins/gen/var/textureLoad/8527b1.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/8527b1.wgsl.expected.ir.msl
@@ -1,49 +1,33 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<uint, access::sample> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_2d_array<u32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_8527b1(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  uint arg_2 = 1u;
+  uint arg_3 = 1u;
+  uint4 res = tint_module_vars.arg_0.read(arg_1, arg_2, arg_3);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_8527b1 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %arg_2:ptr<function, u32, read_write> = var, 1u
-    %arg_3:ptr<function, u32, read_write> = var, 1u
-    %7:texture_2d_array<u32> = load %arg_0
-    %8:vec2<u32> = load %arg_1
-    %9:u32 = load %arg_2
-    %10:u32 = load %arg_3
-    %11:vec4<u32> = textureLoad %7, %8, %9, %10
-    %res:ptr<function, vec4<u32>, read_write> = var, %11
-    %13:vec4<u32> = load %res
-    store %prevent_dce, %13
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_8527b1(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %15:void = call %textureLoad_8527b1
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_8527b1(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %17:void = call %textureLoad_8527b1
-    ret
-  }
+kernel void compute_main(texture2d_array<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_8527b1(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %19:void = call %textureLoad_8527b1
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/862833.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/862833.wgsl.expected.ir.msl
index 1bda51e..5fb5c97 100644
--- a/test/tint/builtins/gen/var/textureLoad/862833.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/862833.wgsl.expected.ir.msl
@@ -1,47 +1,33 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba32float, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_862833(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  uint arg_2 = 1u;
+  uint const v = arg_2;
+  float4 res = tint_module_vars.arg_0.read(uint2(arg_1), v);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_862833 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %arg_2:ptr<function, u32, read_write> = var, 1u
-    %6:texture_storage_2d_array<rgba32float, read> = load %arg_0
-    %7:vec2<i32> = load %arg_1
-    %8:u32 = load %arg_2
-    %9:vec4<f32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<f32>, read_write> = var, %9
-    %11:vec4<f32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_862833(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_862833
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_862833(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_862833
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_862833(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_862833
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/878e24.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/878e24.wgsl.expected.ir.msl
index 4006d28..11b8922 100644
--- a/test/tint/builtins/gen/var/textureLoad/878e24.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/878e24.wgsl.expected.ir.msl
@@ -1,47 +1,32 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba32float, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_878e24(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  uint arg_2 = 1u;
+  float4 res = tint_module_vars.arg_0.read(arg_1, arg_2);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_878e24 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %arg_2:ptr<function, u32, read_write> = var, 1u
-    %6:texture_storage_2d_array<rgba32float, read_write> = load %arg_0
-    %7:vec2<u32> = load %arg_1
-    %8:u32 = load %arg_2
-    %9:vec4<f32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<f32>, read_write> = var, %9
-    %11:vec4<f32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_878e24(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_878e24
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_878e24(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_878e24
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_878e24(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_878e24
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/87be85.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/87be85.wgsl.expected.ir.msl
index f6af7c4..16e6073 100644
--- a/test/tint/builtins/gen/var/textureLoad/87be85.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/87be85.wgsl.expected.ir.msl
@@ -1,49 +1,35 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::sample> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_2d_array<f32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_87be85(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  int arg_2 = 1;
+  int arg_3 = 1;
+  int const v = arg_2;
+  int const v_1 = arg_3;
+  float4 res = tint_module_vars.arg_0.read(uint2(arg_1), v, v_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_87be85 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %arg_2:ptr<function, i32, read_write> = var, 1i
-    %arg_3:ptr<function, i32, read_write> = var, 1i
-    %7:texture_2d_array<f32> = load %arg_0
-    %8:vec2<i32> = load %arg_1
-    %9:i32 = load %arg_2
-    %10:i32 = load %arg_3
-    %11:vec4<f32> = textureLoad %7, %8, %9, %10
-    %res:ptr<function, vec4<f32>, read_write> = var, %11
-    %13:vec4<f32> = load %res
-    store %prevent_dce, %13
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_87be85(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %15:void = call %textureLoad_87be85
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_87be85(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %17:void = call %textureLoad_87be85
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_87be85(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %19:void = call %textureLoad_87be85
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/87f0a6.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/87f0a6.wgsl.expected.ir.msl
index 1c855b1..3ee5c6f 100644
--- a/test/tint/builtins/gen/var/textureLoad/87f0a6.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/87f0a6.wgsl.expected.ir.msl
@@ -1,47 +1,33 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<uint, access::read_write> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba8uint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_87f0a6(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  int arg_2 = 1;
+  int const v = arg_2;
+  uint4 res = tint_module_vars.arg_0.read(uint2(arg_1), v);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_87f0a6 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %arg_2:ptr<function, i32, read_write> = var, 1i
-    %6:texture_storage_2d_array<rgba8uint, read_write> = load %arg_0
-    %7:vec2<i32> = load %arg_1
-    %8:i32 = load %arg_2
-    %9:vec4<u32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<u32>, read_write> = var, %9
-    %11:vec4<u32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_87f0a6(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_87f0a6
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_87f0a6(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_87f0a6
-    ret
-  }
+kernel void compute_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_87f0a6(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_87f0a6
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/881349.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/881349.wgsl.expected.ir.msl
index cf18074..938c7d9 100644
--- a/test/tint/builtins/gen/var/textureLoad/881349.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/881349.wgsl.expected.ir.msl
@@ -1,47 +1,33 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rg32float, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_881349(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  int arg_2 = 1;
+  int const v = arg_2;
+  float4 res = tint_module_vars.arg_0.read(uint2(arg_1), v);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_881349 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %arg_2:ptr<function, i32, read_write> = var, 1i
-    %6:texture_storage_2d_array<rg32float, read_write> = load %arg_0
-    %7:vec2<i32> = load %arg_1
-    %8:i32 = load %arg_2
-    %9:vec4<f32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<f32>, read_write> = var, %9
-    %11:vec4<f32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_881349(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_881349
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_881349(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_881349
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_881349(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_881349
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/89620b.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/89620b.wgsl.expected.ir.msl
index 4af7e77..7bf75b0 100644
--- a/test/tint/builtins/gen/var/textureLoad/89620b.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/89620b.wgsl.expected.ir.msl
@@ -1,47 +1,33 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<bgra8unorm, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_89620b(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  int arg_2 = 1;
+  int const v = arg_2;
+  float4 res = tint_module_vars.arg_0.read(uint2(arg_1), v);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_89620b = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %arg_2:ptr<function, i32, read_write> = var, 1i
-    %6:texture_storage_2d_array<bgra8unorm, read> = load %arg_0
-    %7:vec2<i32> = load %arg_1
-    %8:i32 = load %arg_2
-    %9:vec4<f32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<f32>, read_write> = var, %9
-    %11:vec4<f32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_89620b(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_89620b
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_89620b(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_89620b
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_89620b(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_89620b
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/897cf3.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/897cf3.wgsl.expected.ir.msl
index 4cfdc84..b9bd470 100644
--- a/test/tint/builtins/gen/var/textureLoad/897cf3.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/897cf3.wgsl.expected.ir.msl
@@ -1,47 +1,32 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<uint, access::sample> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_2d<u32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_897cf3(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  uint arg_2 = 1u;
+  uint4 res = tint_module_vars.arg_0.read(arg_1, arg_2);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_897cf3 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %arg_2:ptr<function, u32, read_write> = var, 1u
-    %6:texture_2d<u32> = load %arg_0
-    %7:vec2<u32> = load %arg_1
-    %8:u32 = load %arg_2
-    %9:vec4<u32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<u32>, read_write> = var, %9
-    %11:vec4<u32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_897cf3(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_897cf3
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_897cf3(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_897cf3
-    ret
-  }
+kernel void compute_main(texture2d<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_897cf3(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_897cf3
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/8a291b.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/8a291b.wgsl.expected.ir.msl
index 4613819..b030f5c 100644
--- a/test/tint/builtins/gen/var/textureLoad/8a291b.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/8a291b.wgsl.expected.ir.msl
@@ -1,47 +1,33 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<bgra8unorm, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_8a291b(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  uint arg_2 = 1u;
+  uint const v = arg_2;
+  float4 res = tint_module_vars.arg_0.read(uint2(arg_1), v);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_8a291b = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %arg_2:ptr<function, u32, read_write> = var, 1u
-    %6:texture_storage_2d_array<bgra8unorm, read> = load %arg_0
-    %7:vec2<i32> = load %arg_1
-    %8:u32 = load %arg_2
-    %9:vec4<f32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<f32>, read_write> = var, %9
-    %11:vec4<f32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_8a291b(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_8a291b
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_8a291b(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_8a291b
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_8a291b(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_8a291b
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/8a9988.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/8a9988.wgsl.expected.ir.msl
index 3ca9e7f..2b3fa5a 100644
--- a/test/tint/builtins/gen/var/textureLoad/8a9988.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/8a9988.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<int, access::read> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<rg32sint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_8a9988(tint_module_vars_struct tint_module_vars) {
+  uint3 arg_1 = uint3(1u);
+  int4 res = tint_module_vars.arg_0.read(arg_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_8a9988 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec3<u32>, read_write> = var, vec3<u32>(1u)
-    %5:texture_storage_3d<rg32sint, read> = load %arg_0
-    %6:vec3<u32> = load %arg_1
-    %7:vec4<i32> = textureLoad %5, %6
-    %res:ptr<function, vec4<i32>, read_write> = var, %7
-    %9:vec4<i32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_8a9988(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_8a9988
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_8a9988(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_8a9988
-    ret
-  }
+kernel void compute_main(texture3d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_8a9988(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_8a9988
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/8acf41.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/8acf41.wgsl.expected.ir.msl
index 26574a5..a48e115 100644
--- a/test/tint/builtins/gen/var/textureLoad/8acf41.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/8acf41.wgsl.expected.ir.msl
@@ -1,30 +1,9 @@
 SKIP: FAILED
 
-
-@group(1) @binding(0) var arg_0 : texture_external;
-
-fn textureLoad_8acf41() {
-  var arg_1 = vec2<i32>(1i);
-  var res : vec4<f32> = textureLoad(arg_0, arg_1);
-  prevent_dce = res;
-}
-
-@group(2) @binding(0) var<storage, read_write> prevent_dce : vec4<f32>;
-
-@vertex
-fn vertex_main() -> @builtin(position) vec4<f32> {
-  textureLoad_8acf41();
-  return vec4<f32>();
-}
-
-@fragment
-fn fragment_main() {
-  textureLoad_8acf41();
-}
-
-@compute @workgroup_size(1)
-fn compute_main() {
-  textureLoad_8acf41();
-}
-
-Failed to generate: error: ExternalTextureOptions missing binding entry for [group: 1, binding: 0]
+../../src/tint/lang/msl/writer/printer/printer.cc:1006 internal compiler error: TINT_UNREACHABLE unhandled: abs
+********************************************************************
+*  The tint shader compiler has encountered an unexpected error.   *
+*                                                                  *
+*  Please help us fix this issue by submitting a bug report at     *
+*  crbug.com/tint with the source program that triggered the bug.  *
+********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/8b62fb.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/8b62fb.wgsl.expected.ir.msl
index 00b512d..e01552e 100644
--- a/test/tint/builtins/gen/var/textureLoad/8b62fb.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/8b62fb.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<bgra8unorm, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_8b62fb(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  float4 res = tint_module_vars.arg_0.read(arg_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_8b62fb = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %5:texture_storage_2d<bgra8unorm, read_write> = load %arg_0
-    %6:vec2<u32> = load %arg_1
-    %7:vec4<f32> = textureLoad %5, %6
-    %res:ptr<function, vec4<f32>, read_write> = var, %7
-    %9:vec4<f32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_8b62fb(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_8b62fb
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_8b62fb(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_8b62fb
-    ret
-  }
+kernel void compute_main(texture2d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_8b62fb(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_8b62fb
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/8bf8c2.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/8bf8c2.wgsl.expected.ir.msl
index 98214c5..5b6b72c 100644
--- a/test/tint/builtins/gen/var/textureLoad/8bf8c2.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/8bf8c2.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<r32float, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_8bf8c2(tint_module_vars_struct tint_module_vars) {
+  uint arg_1 = 1u;
+  float4 res = tint_module_vars.arg_0.read(arg_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_8bf8c2 = func():void {
-  $B2: {
-    %arg_1:ptr<function, u32, read_write> = var, 1u
-    %5:texture_storage_1d<r32float, read_write> = load %arg_0
-    %6:u32 = load %arg_1
-    %7:vec4<f32> = textureLoad %5, %6
-    %res:ptr<function, vec4<f32>, read_write> = var, %7
-    %9:vec4<f32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_8bf8c2(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_8bf8c2
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_8bf8c2(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_8bf8c2
-    ret
-  }
+kernel void compute_main(texture1d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_8bf8c2(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_8bf8c2
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/8c6176.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/8c6176.wgsl.expected.ir.msl
index fb5ce82..623f378 100644
--- a/test/tint/builtins/gen/var/textureLoad/8c6176.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/8c6176.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<uint, access::read_write> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<rg32uint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_8c6176(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  uint4 res = tint_module_vars.arg_0.read(arg_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_8c6176 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %5:texture_storage_2d<rg32uint, read_write> = load %arg_0
-    %6:vec2<u32> = load %arg_1
-    %7:vec4<u32> = textureLoad %5, %6
-    %res:ptr<function, vec4<u32>, read_write> = var, %7
-    %9:vec4<u32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_8c6176(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_8c6176
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_8c6176(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_8c6176
-    ret
-  }
+kernel void compute_main(texture2d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_8c6176(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_8c6176
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/8ccbe3.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/8ccbe3.wgsl.expected.ir.msl
index 7bcf6ce..96219b2 100644
--- a/test/tint/builtins/gen/var/textureLoad/8ccbe3.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/8ccbe3.wgsl.expected.ir.msl
@@ -1,47 +1,33 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  depth2d<float, access::sample> arg_0;
+  device float* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_depth_2d, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, f32, read_write> = var @binding_point(2, 0)
+void textureLoad_8ccbe3(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  uint arg_2 = 1u;
+  uint const v = arg_2;
+  float res = tint_module_vars.arg_0.read(uint2(arg_1), v);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_8ccbe3 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %arg_2:ptr<function, u32, read_write> = var, 1u
-    %6:texture_depth_2d = load %arg_0
-    %7:vec2<i32> = load %arg_1
-    %8:u32 = load %arg_2
-    %9:f32 = textureLoad %6, %7, %8
-    %res:ptr<function, f32, read_write> = var, %9
-    %11:f32 = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_8ccbe3(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_8ccbe3
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(depth2d<float, access::sample> arg_0 [[texture(0)]], device float* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_8ccbe3(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_8ccbe3
-    ret
-  }
+kernel void compute_main(depth2d<float, access::sample> arg_0 [[texture(0)]], device float* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_8ccbe3(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_8ccbe3
-    ret
-  }
+vertex vertex_main_outputs vertex_main(depth2d<float, access::sample> arg_0 [[texture(0)]], device float* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/8d64c3.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/8d64c3.wgsl.expected.ir.msl
index 7c0ae6a..21e8d10 100644
--- a/test/tint/builtins/gen/var/textureLoad/8d64c3.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/8d64c3.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<uint, access::read_write> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<rg32uint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_8d64c3(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  uint4 res = tint_module_vars.arg_0.read(uint2(arg_1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_8d64c3 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %5:texture_storage_2d<rg32uint, read_write> = load %arg_0
-    %6:vec2<i32> = load %arg_1
-    %7:vec4<u32> = textureLoad %5, %6
-    %res:ptr<function, vec4<u32>, read_write> = var, %7
-    %9:vec4<u32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_8d64c3(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_8d64c3
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_8d64c3(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_8d64c3
-    ret
-  }
+kernel void compute_main(texture2d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_8d64c3(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_8d64c3
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/8db0ce.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/8db0ce.wgsl.expected.ir.msl
index 25f3b07..69024c0 100644
--- a/test/tint/builtins/gen/var/textureLoad/8db0ce.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/8db0ce.wgsl.expected.ir.msl
@@ -1,47 +1,32 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<int, access::read> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<r32sint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_8db0ce(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  uint arg_2 = 1u;
+  int4 res = tint_module_vars.arg_0.read(arg_1, arg_2);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_8db0ce = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %arg_2:ptr<function, u32, read_write> = var, 1u
-    %6:texture_storage_2d_array<r32sint, read> = load %arg_0
-    %7:vec2<u32> = load %arg_1
-    %8:u32 = load %arg_2
-    %9:vec4<i32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<i32>, read_write> = var, %9
-    %11:vec4<i32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_8db0ce(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_8db0ce
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_8db0ce(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_8db0ce
-    ret
-  }
+kernel void compute_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_8db0ce(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_8db0ce
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/8e5032.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/8e5032.wgsl.expected.ir.msl
index e693dc8..902bbe5 100644
--- a/test/tint/builtins/gen/var/textureLoad/8e5032.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/8e5032.wgsl.expected.ir.msl
@@ -1,47 +1,33 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<uint, access::read> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rg32uint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_8e5032(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  int arg_2 = 1;
+  int const v = arg_2;
+  uint4 res = tint_module_vars.arg_0.read(uint2(arg_1), v);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_8e5032 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %arg_2:ptr<function, i32, read_write> = var, 1i
-    %6:texture_storage_2d_array<rg32uint, read> = load %arg_0
-    %7:vec2<i32> = load %arg_1
-    %8:i32 = load %arg_2
-    %9:vec4<u32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<u32>, read_write> = var, %9
-    %11:vec4<u32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_8e5032(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_8e5032
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_8e5032(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_8e5032
-    ret
-  }
+kernel void compute_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_8e5032(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_8e5032
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/8e68c9.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/8e68c9.wgsl.expected.ir.msl
index 8b07739..410d95d 100644
--- a/test/tint/builtins/gen/var/textureLoad/8e68c9.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/8e68c9.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<int, access::read_write> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<rgba32sint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_8e68c9(tint_module_vars_struct tint_module_vars) {
+  uint3 arg_1 = uint3(1u);
+  int4 res = tint_module_vars.arg_0.read(arg_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_8e68c9 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec3<u32>, read_write> = var, vec3<u32>(1u)
-    %5:texture_storage_3d<rgba32sint, read_write> = load %arg_0
-    %6:vec3<u32> = load %arg_1
-    %7:vec4<i32> = textureLoad %5, %6
-    %res:ptr<function, vec4<i32>, read_write> = var, %7
-    %9:vec4<i32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_8e68c9(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_8e68c9
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_8e68c9(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_8e68c9
-    ret
-  }
+kernel void compute_main(texture3d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_8e68c9(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_8e68c9
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/8fc29b.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/8fc29b.wgsl.expected.ir.msl
index e6cd140..62eca72 100644
--- a/test/tint/builtins/gen/var/textureLoad/8fc29b.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/8fc29b.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<rgba8unorm, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_8fc29b(tint_module_vars_struct tint_module_vars) {
+  int arg_1 = 1;
+  float4 res = tint_module_vars.arg_0.read(uint(arg_1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_8fc29b = func():void {
-  $B2: {
-    %arg_1:ptr<function, i32, read_write> = var, 1i
-    %5:texture_storage_1d<rgba8unorm, read_write> = load %arg_0
-    %6:i32 = load %arg_1
-    %7:vec4<f32> = textureLoad %5, %6
-    %res:ptr<function, vec4<f32>, read_write> = var, %7
-    %9:vec4<f32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_8fc29b(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_8fc29b
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_8fc29b(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_8fc29b
-    ret
-  }
+kernel void compute_main(texture1d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_8fc29b(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_8fc29b
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/8ff033.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/8ff033.wgsl.expected.ir.msl
index de89b7a..3a7f580 100644
--- a/test/tint/builtins/gen/var/textureLoad/8ff033.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/8ff033.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<rgba8snorm, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_8ff033(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  float4 res = tint_module_vars.arg_0.read(arg_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_8ff033 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %5:texture_storage_2d<rgba8snorm, read> = load %arg_0
-    %6:vec2<u32> = load %arg_1
-    %7:vec4<f32> = textureLoad %5, %6
-    %res:ptr<function, vec4<f32>, read_write> = var, %7
-    %9:vec4<f32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_8ff033(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_8ff033
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_8ff033(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_8ff033
-    ret
-  }
+kernel void compute_main(texture2d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_8ff033(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_8ff033
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/91ede5.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/91ede5.wgsl.expected.ir.msl
index cd617e4..f525379 100644
--- a/test/tint/builtins/gen/var/textureLoad/91ede5.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/91ede5.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<rg32float, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_91ede5(tint_module_vars_struct tint_module_vars) {
+  uint3 arg_1 = uint3(1u);
+  float4 res = tint_module_vars.arg_0.read(arg_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_91ede5 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec3<u32>, read_write> = var, vec3<u32>(1u)
-    %5:texture_storage_3d<rg32float, read_write> = load %arg_0
-    %6:vec3<u32> = load %arg_1
-    %7:vec4<f32> = textureLoad %5, %6
-    %res:ptr<function, vec4<f32>, read_write> = var, %7
-    %9:vec4<f32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_91ede5(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_91ede5
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_91ede5(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_91ede5
-    ret
-  }
+kernel void compute_main(texture3d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_91ede5(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_91ede5
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/9242e7.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/9242e7.wgsl.expected.ir.msl
index 1f0910d..cf682f6 100644
--- a/test/tint/builtins/gen/var/textureLoad/9242e7.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/9242e7.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<uint, access::read_write> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<rgba16uint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_9242e7(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  uint4 res = tint_module_vars.arg_0.read(arg_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_9242e7 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %5:texture_storage_2d<rgba16uint, read_write> = load %arg_0
-    %6:vec2<u32> = load %arg_1
-    %7:vec4<u32> = textureLoad %5, %6
-    %res:ptr<function, vec4<u32>, read_write> = var, %7
-    %9:vec4<u32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_9242e7(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_9242e7
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_9242e7(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_9242e7
-    ret
-  }
+kernel void compute_main(texture2d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_9242e7(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_9242e7
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/92dd61.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/92dd61.wgsl.expected.ir.msl
index 400f5a3..3096e3b 100644
--- a/test/tint/builtins/gen/var/textureLoad/92dd61.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/92dd61.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<r8unorm, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_92dd61(tint_module_vars_struct tint_module_vars) {
+  uint arg_1 = 1u;
+  float4 res = tint_module_vars.arg_0.read(arg_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_92dd61 = func():void {
-  $B2: {
-    %arg_1:ptr<function, u32, read_write> = var, 1u
-    %5:texture_storage_1d<r8unorm, read_write> = load %arg_0
-    %6:u32 = load %arg_1
-    %7:vec4<f32> = textureLoad %5, %6
-    %res:ptr<function, vec4<f32>, read_write> = var, %7
-    %9:vec4<f32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_92dd61(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_92dd61
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_92dd61(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_92dd61
-    ret
-  }
+kernel void compute_main(texture1d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_92dd61(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_92dd61
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/92eb1f.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/92eb1f.wgsl.expected.ir.msl
index e605ac2..5205a7f 100644
--- a/test/tint/builtins/gen/var/textureLoad/92eb1f.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/92eb1f.wgsl.expected.ir.msl
@@ -1,47 +1,32 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<uint, access::sample> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_3d<u32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_92eb1f(tint_module_vars_struct tint_module_vars) {
+  uint3 arg_1 = uint3(1u);
+  int arg_2 = 1;
+  uint4 res = tint_module_vars.arg_0.read(arg_1, arg_2);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_92eb1f = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec3<u32>, read_write> = var, vec3<u32>(1u)
-    %arg_2:ptr<function, i32, read_write> = var, 1i
-    %6:texture_3d<u32> = load %arg_0
-    %7:vec3<u32> = load %arg_1
-    %8:i32 = load %arg_2
-    %9:vec4<u32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<u32>, read_write> = var, %9
-    %11:vec4<u32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_92eb1f(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_92eb1f
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_92eb1f(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_92eb1f
-    ret
-  }
+kernel void compute_main(texture3d<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_92eb1f(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_92eb1f
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/936952.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/936952.wgsl.expected.ir.msl
index 8eff80d..0c18011 100644
--- a/test/tint/builtins/gen/var/textureLoad/936952.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/936952.wgsl.expected.ir.msl
@@ -1,47 +1,33 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba32float, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_936952(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  int arg_2 = 1;
+  int const v = arg_2;
+  float4 res = tint_module_vars.arg_0.read(uint2(arg_1), v);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_936952 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %arg_2:ptr<function, i32, read_write> = var, 1i
-    %6:texture_storage_2d_array<rgba32float, read> = load %arg_0
-    %7:vec2<i32> = load %arg_1
-    %8:i32 = load %arg_2
-    %9:vec4<f32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<f32>, read_write> = var, %9
-    %11:vec4<f32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_936952(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_936952
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_936952(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_936952
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_936952(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_936952
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/93f23e.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/93f23e.wgsl.expected.ir.msl
index 16f79c0..695d54b 100644
--- a/test/tint/builtins/gen/var/textureLoad/93f23e.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/93f23e.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<uint, access::read_write> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<r32uint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_93f23e(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  uint4 res = tint_module_vars.arg_0.read(arg_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_93f23e = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %5:texture_storage_2d<r32uint, read_write> = load %arg_0
-    %6:vec2<u32> = load %arg_1
-    %7:vec4<u32> = textureLoad %5, %6
-    %res:ptr<function, vec4<u32>, read_write> = var, %7
-    %9:vec4<u32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_93f23e(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_93f23e
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_93f23e(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_93f23e
-    ret
-  }
+kernel void compute_main(texture2d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_93f23e(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_93f23e
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/947107.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/947107.wgsl.expected.ir.msl
index eb75db0..55f9ad6 100644
--- a/test/tint/builtins/gen/var/textureLoad/947107.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/947107.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<r8unorm, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_947107(tint_module_vars_struct tint_module_vars) {
+  int arg_1 = 1;
+  float4 res = tint_module_vars.arg_0.read(uint(arg_1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_947107 = func():void {
-  $B2: {
-    %arg_1:ptr<function, i32, read_write> = var, 1i
-    %5:texture_storage_1d<r8unorm, read> = load %arg_0
-    %6:i32 = load %arg_1
-    %7:vec4<f32> = textureLoad %5, %6
-    %res:ptr<function, vec4<f32>, read_write> = var, %7
-    %9:vec4<f32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_947107(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_947107
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_947107(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_947107
-    ret
-  }
+kernel void compute_main(texture1d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_947107(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_947107
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/96efd5.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/96efd5.wgsl.expected.ir.msl
index 633abfc..f8c5dc8 100644
--- a/test/tint/builtins/gen/var/textureLoad/96efd5.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/96efd5.wgsl.expected.ir.msl
@@ -1,49 +1,33 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::sample> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_2d_array<f32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_96efd5(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  uint arg_2 = 1u;
+  uint arg_3 = 1u;
+  float4 res = tint_module_vars.arg_0.read(arg_1, arg_2, arg_3);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_96efd5 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %arg_2:ptr<function, u32, read_write> = var, 1u
-    %arg_3:ptr<function, u32, read_write> = var, 1u
-    %7:texture_2d_array<f32> = load %arg_0
-    %8:vec2<u32> = load %arg_1
-    %9:u32 = load %arg_2
-    %10:u32 = load %arg_3
-    %11:vec4<f32> = textureLoad %7, %8, %9, %10
-    %res:ptr<function, vec4<f32>, read_write> = var, %11
-    %13:vec4<f32> = load %res
-    store %prevent_dce, %13
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_96efd5(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %15:void = call %textureLoad_96efd5
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_96efd5(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %17:void = call %textureLoad_96efd5
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_96efd5(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %19:void = call %textureLoad_96efd5
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/970308.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/970308.wgsl.expected.ir.msl
index fea9ec7..129fd4c 100644
--- a/test/tint/builtins/gen/var/textureLoad/970308.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/970308.wgsl.expected.ir.msl
@@ -1,47 +1,33 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<uint, access::read> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<r32uint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_970308(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  uint arg_2 = 1u;
+  uint const v = arg_2;
+  uint4 res = tint_module_vars.arg_0.read(uint2(arg_1), v);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_970308 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %arg_2:ptr<function, u32, read_write> = var, 1u
-    %6:texture_storage_2d_array<r32uint, read> = load %arg_0
-    %7:vec2<i32> = load %arg_1
-    %8:u32 = load %arg_2
-    %9:vec4<u32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<u32>, read_write> = var, %9
-    %11:vec4<u32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_970308(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_970308
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_970308(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_970308
-    ret
-  }
+kernel void compute_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_970308(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_970308
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/9885b0.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/9885b0.wgsl.expected.ir.msl
index 929fd7b..e3f09a5 100644
--- a/test/tint/builtins/gen/var/textureLoad/9885b0.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/9885b0.wgsl.expected.ir.msl
@@ -1,49 +1,33 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<int, access::sample> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_2d_array<i32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_9885b0(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  uint arg_2 = 1u;
+  uint arg_3 = 1u;
+  int4 res = tint_module_vars.arg_0.read(arg_1, arg_2, arg_3);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_9885b0 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %arg_2:ptr<function, u32, read_write> = var, 1u
-    %arg_3:ptr<function, u32, read_write> = var, 1u
-    %7:texture_2d_array<i32> = load %arg_0
-    %8:vec2<u32> = load %arg_1
-    %9:u32 = load %arg_2
-    %10:u32 = load %arg_3
-    %11:vec4<i32> = textureLoad %7, %8, %9, %10
-    %res:ptr<function, vec4<i32>, read_write> = var, %11
-    %13:vec4<i32> = load %res
-    store %prevent_dce, %13
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_9885b0(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %15:void = call %textureLoad_9885b0
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_9885b0(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %17:void = call %textureLoad_9885b0
-    ret
-  }
+kernel void compute_main(texture2d_array<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_9885b0(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %19:void = call %textureLoad_9885b0
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/99d8fa.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/99d8fa.wgsl.expected.ir.msl
index da7ff57..0e83dea 100644
--- a/test/tint/builtins/gen/var/textureLoad/99d8fa.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/99d8fa.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<r8unorm, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_99d8fa(tint_module_vars_struct tint_module_vars) {
+  int3 arg_1 = int3(1);
+  float4 res = tint_module_vars.arg_0.read(uint3(arg_1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_99d8fa = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec3<i32>, read_write> = var, vec3<i32>(1i)
-    %5:texture_storage_3d<r8unorm, read_write> = load %arg_0
-    %6:vec3<i32> = load %arg_1
-    %7:vec4<f32> = textureLoad %5, %6
-    %res:ptr<function, vec4<f32>, read_write> = var, %7
-    %9:vec4<f32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_99d8fa(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_99d8fa
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_99d8fa(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_99d8fa
-    ret
-  }
+kernel void compute_main(texture3d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_99d8fa(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_99d8fa
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/9a7c90.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/9a7c90.wgsl.expected.ir.msl
index ae7761f..1d46136 100644
--- a/test/tint/builtins/gen/var/textureLoad/9a7c90.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/9a7c90.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<uint, access::read> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<rgba8uint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_9a7c90(tint_module_vars_struct tint_module_vars) {
+  int3 arg_1 = int3(1);
+  uint4 res = tint_module_vars.arg_0.read(uint3(arg_1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_9a7c90 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec3<i32>, read_write> = var, vec3<i32>(1i)
-    %5:texture_storage_3d<rgba8uint, read> = load %arg_0
-    %6:vec3<i32> = load %arg_1
-    %7:vec4<u32> = textureLoad %5, %6
-    %res:ptr<function, vec4<u32>, read_write> = var, %7
-    %9:vec4<u32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_9a7c90(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_9a7c90
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_9a7c90(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_9a7c90
-    ret
-  }
+kernel void compute_main(texture3d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_9a7c90(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_9a7c90
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/9a8c1e.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/9a8c1e.wgsl.expected.ir.msl
index 0573637..e4b1b16 100644
--- a/test/tint/builtins/gen/var/textureLoad/9a8c1e.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/9a8c1e.wgsl.expected.ir.msl
@@ -1,47 +1,32 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<int, access::read> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba8sint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_9a8c1e(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  int arg_2 = 1;
+  int4 res = tint_module_vars.arg_0.read(arg_1, arg_2);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_9a8c1e = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %arg_2:ptr<function, i32, read_write> = var, 1i
-    %6:texture_storage_2d_array<rgba8sint, read> = load %arg_0
-    %7:vec2<u32> = load %arg_1
-    %8:i32 = load %arg_2
-    %9:vec4<i32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<i32>, read_write> = var, %9
-    %11:vec4<i32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_9a8c1e(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_9a8c1e
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_9a8c1e(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_9a8c1e
-    ret
-  }
+kernel void compute_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_9a8c1e(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_9a8c1e
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/9aa733.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/9aa733.wgsl.expected.ir.msl
index 754b55b..fda5519 100644
--- a/test/tint/builtins/gen/var/textureLoad/9aa733.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/9aa733.wgsl.expected.ir.msl
@@ -1,47 +1,32 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<int, access::sample> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_2d<i32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_9aa733(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  int arg_2 = 1;
+  int4 res = tint_module_vars.arg_0.read(arg_1, arg_2);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_9aa733 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %arg_2:ptr<function, i32, read_write> = var, 1i
-    %6:texture_2d<i32> = load %arg_0
-    %7:vec2<u32> = load %arg_1
-    %8:i32 = load %arg_2
-    %9:vec4<i32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<i32>, read_write> = var, %9
-    %11:vec4<i32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_9aa733(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_9aa733
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_9aa733(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_9aa733
-    ret
-  }
+kernel void compute_main(texture2d<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_9aa733(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_9aa733
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/9b2667.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/9b2667.wgsl.expected.ir.msl
index 3b4aef7..1c43cd1 100644
--- a/test/tint/builtins/gen/var/textureLoad/9b2667.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/9b2667.wgsl.expected.ir.msl
@@ -1,49 +1,35 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  depth2d_array<float, access::sample> arg_0;
+  device float* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_depth_2d_array, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, f32, read_write> = var @binding_point(2, 0)
+void textureLoad_9b2667(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  int arg_2 = 1;
+  int arg_3 = 1;
+  int const v = arg_2;
+  int const v_1 = arg_3;
+  float res = tint_module_vars.arg_0.read(uint2(arg_1), v, v_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_9b2667 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %arg_2:ptr<function, i32, read_write> = var, 1i
-    %arg_3:ptr<function, i32, read_write> = var, 1i
-    %7:texture_depth_2d_array = load %arg_0
-    %8:vec2<i32> = load %arg_1
-    %9:i32 = load %arg_2
-    %10:i32 = load %arg_3
-    %11:f32 = textureLoad %7, %8, %9, %10
-    %res:ptr<function, f32, read_write> = var, %11
-    %13:f32 = load %res
-    store %prevent_dce, %13
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_9b2667(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %15:void = call %textureLoad_9b2667
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(depth2d_array<float, access::sample> arg_0 [[texture(0)]], device float* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_9b2667(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %17:void = call %textureLoad_9b2667
-    ret
-  }
+kernel void compute_main(depth2d_array<float, access::sample> arg_0 [[texture(0)]], device float* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_9b2667(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %19:void = call %textureLoad_9b2667
-    ret
-  }
+vertex vertex_main_outputs vertex_main(depth2d_array<float, access::sample> arg_0 [[texture(0)]], device float* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/9b5343.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/9b5343.wgsl.expected.ir.msl
index c2c2c48..78929fc 100644
--- a/test/tint/builtins/gen/var/textureLoad/9b5343.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/9b5343.wgsl.expected.ir.msl
@@ -1,47 +1,32 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<uint, access::read> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba16uint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_9b5343(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  int arg_2 = 1;
+  uint4 res = tint_module_vars.arg_0.read(arg_1, arg_2);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_9b5343 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %arg_2:ptr<function, i32, read_write> = var, 1i
-    %6:texture_storage_2d_array<rgba16uint, read> = load %arg_0
-    %7:vec2<u32> = load %arg_1
-    %8:i32 = load %arg_2
-    %9:vec4<u32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<u32>, read_write> = var, %9
-    %11:vec4<u32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_9b5343(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_9b5343
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_9b5343(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_9b5343
-    ret
-  }
+kernel void compute_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_9b5343(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_9b5343
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/9c2376.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/9c2376.wgsl.expected.ir.msl
index f8f3967..e1d99d0 100644
--- a/test/tint/builtins/gen/var/textureLoad/9c2376.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/9c2376.wgsl.expected.ir.msl
@@ -1,47 +1,33 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<r32float, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_9c2376(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  uint arg_2 = 1u;
+  uint const v = arg_2;
+  float4 res = tint_module_vars.arg_0.read(uint2(arg_1), v);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_9c2376 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %arg_2:ptr<function, u32, read_write> = var, 1u
-    %6:texture_storage_2d_array<r32float, read> = load %arg_0
-    %7:vec2<i32> = load %arg_1
-    %8:u32 = load %arg_2
-    %9:vec4<f32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<f32>, read_write> = var, %9
-    %11:vec4<f32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_9c2376(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_9c2376
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_9c2376(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_9c2376
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_9c2376(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_9c2376
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/9c2a14.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/9c2a14.wgsl.expected.ir.msl
index 29782a6..23ee680 100644
--- a/test/tint/builtins/gen/var/textureLoad/9c2a14.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/9c2a14.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<rg32float, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_9c2a14(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  float4 res = tint_module_vars.arg_0.read(uint2(arg_1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_9c2a14 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %5:texture_storage_2d<rg32float, read> = load %arg_0
-    %6:vec2<i32> = load %arg_1
-    %7:vec4<f32> = textureLoad %5, %6
-    %res:ptr<function, vec4<f32>, read_write> = var, %7
-    %9:vec4<f32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_9c2a14(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_9c2a14
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_9c2a14(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_9c2a14
-    ret
-  }
+kernel void compute_main(texture2d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_9c2a14(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_9c2a14
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/9cf7df.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/9cf7df.wgsl.expected.ir.msl
index e4f14a7..8a6a6e7 100644
--- a/test/tint/builtins/gen/var/textureLoad/9cf7df.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/9cf7df.wgsl.expected.ir.msl
@@ -1,47 +1,33 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<int, access::read> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rg32sint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_9cf7df(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  uint arg_2 = 1u;
+  uint const v = arg_2;
+  int4 res = tint_module_vars.arg_0.read(uint2(arg_1), v);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_9cf7df = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %arg_2:ptr<function, u32, read_write> = var, 1u
-    %6:texture_storage_2d_array<rg32sint, read> = load %arg_0
-    %7:vec2<i32> = load %arg_1
-    %8:u32 = load %arg_2
-    %9:vec4<i32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<i32>, read_write> = var, %9
-    %11:vec4<i32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_9cf7df(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_9cf7df
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_9cf7df(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_9cf7df
-    ret
-  }
+kernel void compute_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_9cf7df(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_9cf7df
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/9d70e9.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/9d70e9.wgsl.expected.ir.msl
index 2b42333..c22f9e4 100644
--- a/test/tint/builtins/gen/var/textureLoad/9d70e9.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/9d70e9.wgsl.expected.ir.msl
@@ -1,49 +1,35 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<int, access::sample> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_2d_array<i32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_9d70e9(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  int arg_2 = 1;
+  uint arg_3 = 1u;
+  int const v = arg_2;
+  uint const v_1 = arg_3;
+  int4 res = tint_module_vars.arg_0.read(uint2(arg_1), v, v_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_9d70e9 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %arg_2:ptr<function, i32, read_write> = var, 1i
-    %arg_3:ptr<function, u32, read_write> = var, 1u
-    %7:texture_2d_array<i32> = load %arg_0
-    %8:vec2<i32> = load %arg_1
-    %9:i32 = load %arg_2
-    %10:u32 = load %arg_3
-    %11:vec4<i32> = textureLoad %7, %8, %9, %10
-    %res:ptr<function, vec4<i32>, read_write> = var, %11
-    %13:vec4<i32> = load %res
-    store %prevent_dce, %13
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_9d70e9(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %15:void = call %textureLoad_9d70e9
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_9d70e9(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %17:void = call %textureLoad_9d70e9
-    ret
-  }
+kernel void compute_main(texture2d_array<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_9d70e9(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %19:void = call %textureLoad_9d70e9
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/9de6f5.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/9de6f5.wgsl.expected.ir.msl
index 287934c..8354137 100644
--- a/test/tint/builtins/gen/var/textureLoad/9de6f5.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/9de6f5.wgsl.expected.ir.msl
@@ -1,47 +1,33 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba8snorm, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_9de6f5(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  uint arg_2 = 1u;
+  uint const v = arg_2;
+  float4 res = tint_module_vars.arg_0.read(uint2(arg_1), v);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_9de6f5 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %arg_2:ptr<function, u32, read_write> = var, 1u
-    %6:texture_storage_2d_array<rgba8snorm, read> = load %arg_0
-    %7:vec2<i32> = load %arg_1
-    %8:u32 = load %arg_2
-    %9:vec4<f32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<f32>, read_write> = var, %9
-    %11:vec4<f32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_9de6f5(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_9de6f5
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_9de6f5(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_9de6f5
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_9de6f5(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_9de6f5
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/9ed19e.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/9ed19e.wgsl.expected.ir.msl
index f2ff8a3..f974553 100644
--- a/test/tint/builtins/gen/var/textureLoad/9ed19e.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/9ed19e.wgsl.expected.ir.msl
@@ -1,47 +1,32 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  depth2d<float, access::sample> arg_0;
+  device float* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_depth_2d, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, f32, read_write> = var @binding_point(2, 0)
+void textureLoad_9ed19e(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  uint arg_2 = 1u;
+  float res = tint_module_vars.arg_0.read(arg_1, arg_2);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_9ed19e = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %arg_2:ptr<function, u32, read_write> = var, 1u
-    %6:texture_depth_2d = load %arg_0
-    %7:vec2<u32> = load %arg_1
-    %8:u32 = load %arg_2
-    %9:f32 = textureLoad %6, %7, %8
-    %res:ptr<function, f32, read_write> = var, %9
-    %11:f32 = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_9ed19e(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_9ed19e
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(depth2d<float, access::sample> arg_0 [[texture(0)]], device float* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_9ed19e(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_9ed19e
-    ret
-  }
+kernel void compute_main(depth2d<float, access::sample> arg_0 [[texture(0)]], device float* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_9ed19e(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_9ed19e
-    ret
-  }
+vertex vertex_main_outputs vertex_main(depth2d<float, access::sample> arg_0 [[texture(0)]], device float* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/9fa9fd.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/9fa9fd.wgsl.expected.ir.msl
index 2466663..5658993 100644
--- a/test/tint/builtins/gen/var/textureLoad/9fa9fd.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/9fa9fd.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<uint, access::read_write> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<rgba32uint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_9fa9fd(tint_module_vars_struct tint_module_vars) {
+  uint3 arg_1 = uint3(1u);
+  uint4 res = tint_module_vars.arg_0.read(arg_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_9fa9fd = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec3<u32>, read_write> = var, vec3<u32>(1u)
-    %5:texture_storage_3d<rgba32uint, read_write> = load %arg_0
-    %6:vec3<u32> = load %arg_1
-    %7:vec4<u32> = textureLoad %5, %6
-    %res:ptr<function, vec4<u32>, read_write> = var, %7
-    %9:vec4<u32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_9fa9fd(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_9fa9fd
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_9fa9fd(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_9fa9fd
-    ret
-  }
+kernel void compute_main(texture3d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_9fa9fd(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_9fa9fd
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/9fbfd9.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/9fbfd9.wgsl.expected.ir.msl
index 8458741..4829841 100644
--- a/test/tint/builtins/gen/var/textureLoad/9fbfd9.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/9fbfd9.wgsl.expected.ir.msl
@@ -1,49 +1,35 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<int, access::sample> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_2d_array<i32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_9fbfd9(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  uint arg_2 = 1u;
+  uint arg_3 = 1u;
+  uint const v = arg_2;
+  uint const v_1 = arg_3;
+  int4 res = tint_module_vars.arg_0.read(uint2(arg_1), v, v_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_9fbfd9 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %arg_2:ptr<function, u32, read_write> = var, 1u
-    %arg_3:ptr<function, u32, read_write> = var, 1u
-    %7:texture_2d_array<i32> = load %arg_0
-    %8:vec2<i32> = load %arg_1
-    %9:u32 = load %arg_2
-    %10:u32 = load %arg_3
-    %11:vec4<i32> = textureLoad %7, %8, %9, %10
-    %res:ptr<function, vec4<i32>, read_write> = var, %11
-    %13:vec4<i32> = load %res
-    store %prevent_dce, %13
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_9fbfd9(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %15:void = call %textureLoad_9fbfd9
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_9fbfd9(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %17:void = call %textureLoad_9fbfd9
-    ret
-  }
+kernel void compute_main(texture2d_array<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_9fbfd9(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %19:void = call %textureLoad_9fbfd9
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/9fd7be.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/9fd7be.wgsl.expected.ir.msl
index 9847543..1efef77 100644
--- a/test/tint/builtins/gen/var/textureLoad/9fd7be.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/9fd7be.wgsl.expected.ir.msl
@@ -1,47 +1,33 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<uint, access::read_write> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba32uint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_9fd7be(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  int arg_2 = 1;
+  int const v = arg_2;
+  uint4 res = tint_module_vars.arg_0.read(uint2(arg_1), v);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_9fd7be = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %arg_2:ptr<function, i32, read_write> = var, 1i
-    %6:texture_storage_2d_array<rgba32uint, read_write> = load %arg_0
-    %7:vec2<i32> = load %arg_1
-    %8:i32 = load %arg_2
-    %9:vec4<u32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<u32>, read_write> = var, %9
-    %11:vec4<u32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_9fd7be(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_9fd7be
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_9fd7be(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_9fd7be
-    ret
-  }
+kernel void compute_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_9fd7be(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_9fd7be
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/a03af1.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/a03af1.wgsl.expected.ir.msl
index eb3b0d5..737a1bf 100644
--- a/test/tint/builtins/gen/var/textureLoad/a03af1.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/a03af1.wgsl.expected.ir.msl
@@ -1,47 +1,33 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba8unorm, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_a03af1(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  uint arg_2 = 1u;
+  uint const v = arg_2;
+  float4 res = tint_module_vars.arg_0.read(uint2(arg_1), v);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_a03af1 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %arg_2:ptr<function, u32, read_write> = var, 1u
-    %6:texture_storage_2d_array<rgba8unorm, read> = load %arg_0
-    %7:vec2<i32> = load %arg_1
-    %8:u32 = load %arg_2
-    %9:vec4<f32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<f32>, read_write> = var, %9
-    %11:vec4<f32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_a03af1(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_a03af1
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_a03af1(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_a03af1
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_a03af1(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_a03af1
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/a24be1.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/a24be1.wgsl.expected.ir.msl
index 260dc40..d4ca526 100644
--- a/test/tint/builtins/gen/var/textureLoad/a24be1.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/a24be1.wgsl.expected.ir.msl
@@ -1,49 +1,33 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<uint, access::sample> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_2d_array<u32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_a24be1(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  int arg_2 = 1;
+  uint arg_3 = 1u;
+  uint4 res = tint_module_vars.arg_0.read(arg_1, arg_2, arg_3);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_a24be1 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %arg_2:ptr<function, i32, read_write> = var, 1i
-    %arg_3:ptr<function, u32, read_write> = var, 1u
-    %7:texture_2d_array<u32> = load %arg_0
-    %8:vec2<u32> = load %arg_1
-    %9:i32 = load %arg_2
-    %10:u32 = load %arg_3
-    %11:vec4<u32> = textureLoad %7, %8, %9, %10
-    %res:ptr<function, vec4<u32>, read_write> = var, %11
-    %13:vec4<u32> = load %res
-    store %prevent_dce, %13
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_a24be1(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %15:void = call %textureLoad_a24be1
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_a24be1(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %17:void = call %textureLoad_a24be1
-    ret
-  }
+kernel void compute_main(texture2d_array<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_a24be1(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %19:void = call %textureLoad_a24be1
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/a2b3f4.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/a2b3f4.wgsl.expected.ir.msl
index c001e1e..7599f62 100644
--- a/test/tint/builtins/gen/var/textureLoad/a2b3f4.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/a2b3f4.wgsl.expected.ir.msl
@@ -1,47 +1,32 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<uint, access::read_write> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba8uint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_a2b3f4(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  uint arg_2 = 1u;
+  uint4 res = tint_module_vars.arg_0.read(arg_1, arg_2);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_a2b3f4 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %arg_2:ptr<function, u32, read_write> = var, 1u
-    %6:texture_storage_2d_array<rgba8uint, read_write> = load %arg_0
-    %7:vec2<u32> = load %arg_1
-    %8:u32 = load %arg_2
-    %9:vec4<u32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<u32>, read_write> = var, %9
-    %11:vec4<u32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_a2b3f4(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_a2b3f4
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_a2b3f4(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_a2b3f4
-    ret
-  }
+kernel void compute_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_a2b3f4(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_a2b3f4
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/a3733f.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/a3733f.wgsl.expected.ir.msl
index 753ef45..c1b83c7 100644
--- a/test/tint/builtins/gen/var/textureLoad/a3733f.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/a3733f.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<uint, access::read_write> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<rgba16uint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_a3733f(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  uint4 res = tint_module_vars.arg_0.read(uint2(arg_1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_a3733f = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %5:texture_storage_2d<rgba16uint, read_write> = load %arg_0
-    %6:vec2<i32> = load %arg_1
-    %7:vec4<u32> = textureLoad %5, %6
-    %res:ptr<function, vec4<u32>, read_write> = var, %7
-    %9:vec4<u32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_a3733f(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_a3733f
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_a3733f(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_a3733f
-    ret
-  }
+kernel void compute_main(texture2d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_a3733f(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_a3733f
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/a3f122.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/a3f122.wgsl.expected.ir.msl
index ff4e250..a243d1c 100644
--- a/test/tint/builtins/gen/var/textureLoad/a3f122.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/a3f122.wgsl.expected.ir.msl
@@ -1,47 +1,32 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<uint, access::read_write> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba32uint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_a3f122(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  uint arg_2 = 1u;
+  uint4 res = tint_module_vars.arg_0.read(arg_1, arg_2);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_a3f122 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %arg_2:ptr<function, u32, read_write> = var, 1u
-    %6:texture_storage_2d_array<rgba32uint, read_write> = load %arg_0
-    %7:vec2<u32> = load %arg_1
-    %8:u32 = load %arg_2
-    %9:vec4<u32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<u32>, read_write> = var, %9
-    %11:vec4<u32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_a3f122(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_a3f122
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_a3f122(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_a3f122
-    ret
-  }
+kernel void compute_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_a3f122(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_a3f122
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/a548a8.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/a548a8.wgsl.expected.ir.msl
index 195d6a5..9d7d8a8 100644
--- a/test/tint/builtins/gen/var/textureLoad/a548a8.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/a548a8.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<uint, access::read_write> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<rgba8uint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_a548a8(tint_module_vars_struct tint_module_vars) {
+  int arg_1 = 1;
+  uint4 res = tint_module_vars.arg_0.read(uint(arg_1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_a548a8 = func():void {
-  $B2: {
-    %arg_1:ptr<function, i32, read_write> = var, 1i
-    %5:texture_storage_1d<rgba8uint, read_write> = load %arg_0
-    %6:i32 = load %arg_1
-    %7:vec4<u32> = textureLoad %5, %6
-    %res:ptr<function, vec4<u32>, read_write> = var, %7
-    %9:vec4<u32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_a548a8(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_a548a8
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_a548a8(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_a548a8
-    ret
-  }
+kernel void compute_main(texture1d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_a548a8(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_a548a8
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/a54e11.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/a54e11.wgsl.expected.ir.msl
index f21fdf5..ad608d7 100644
--- a/test/tint/builtins/gen/var/textureLoad/a54e11.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/a54e11.wgsl.expected.ir.msl
@@ -1,47 +1,33 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<int, access::read_write> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba8sint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_a54e11(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  uint arg_2 = 1u;
+  uint const v = arg_2;
+  int4 res = tint_module_vars.arg_0.read(uint2(arg_1), v);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_a54e11 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %arg_2:ptr<function, u32, read_write> = var, 1u
-    %6:texture_storage_2d_array<rgba8sint, read_write> = load %arg_0
-    %7:vec2<i32> = load %arg_1
-    %8:u32 = load %arg_2
-    %9:vec4<i32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<i32>, read_write> = var, %9
-    %11:vec4<i32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_a54e11(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_a54e11
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_a54e11(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_a54e11
-    ret
-  }
+kernel void compute_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_a54e11(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_a54e11
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/a583c9.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/a583c9.wgsl.expected.ir.msl
index b204085..b2d4b6e 100644
--- a/test/tint/builtins/gen/var/textureLoad/a583c9.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/a583c9.wgsl.expected.ir.msl
@@ -1,47 +1,33 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_ms<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_multisampled_2d<f32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_a583c9(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  int arg_2 = 1;
+  int const v = arg_2;
+  float4 res = tint_module_vars.arg_0.read(uint2(arg_1), v);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_a583c9 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %arg_2:ptr<function, i32, read_write> = var, 1i
-    %6:texture_multisampled_2d<f32> = load %arg_0
-    %7:vec2<i32> = load %arg_1
-    %8:i32 = load %arg_2
-    %9:vec4<f32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<f32>, read_write> = var, %9
-    %11:vec4<f32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_a583c9(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_a583c9
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_ms<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_a583c9(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_a583c9
-    ret
-  }
+kernel void compute_main(texture2d_ms<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_a583c9(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_a583c9
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_ms<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/a5c4e2.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/a5c4e2.wgsl.expected.ir.msl
index 67956bf..e674671 100644
--- a/test/tint/builtins/gen/var/textureLoad/a5c4e2.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/a5c4e2.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<uint, access::read_write> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<rg32uint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_a5c4e2(tint_module_vars_struct tint_module_vars) {
+  int arg_1 = 1;
+  uint4 res = tint_module_vars.arg_0.read(uint(arg_1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_a5c4e2 = func():void {
-  $B2: {
-    %arg_1:ptr<function, i32, read_write> = var, 1i
-    %5:texture_storage_1d<rg32uint, read_write> = load %arg_0
-    %6:i32 = load %arg_1
-    %7:vec4<u32> = textureLoad %5, %6
-    %res:ptr<function, vec4<u32>, read_write> = var, %7
-    %9:vec4<u32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_a5c4e2(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_a5c4e2
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_a5c4e2(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_a5c4e2
-    ret
-  }
+kernel void compute_main(texture1d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_a5c4e2(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_a5c4e2
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/a5e0a5.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/a5e0a5.wgsl.expected.ir.msl
index 8087106..ee59cee 100644
--- a/test/tint/builtins/gen/var/textureLoad/a5e0a5.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/a5e0a5.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<r32float, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_a5e0a5(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  float4 res = tint_module_vars.arg_0.read(arg_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_a5e0a5 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %5:texture_storage_2d<r32float, read_write> = load %arg_0
-    %6:vec2<u32> = load %arg_1
-    %7:vec4<f32> = textureLoad %5, %6
-    %res:ptr<function, vec4<f32>, read_write> = var, %7
-    %9:vec4<f32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_a5e0a5(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_a5e0a5
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_a5e0a5(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_a5e0a5
-    ret
-  }
+kernel void compute_main(texture2d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_a5e0a5(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_a5e0a5
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/a64b1d.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/a64b1d.wgsl.expected.ir.msl
index fa37dbd..d69e47c 100644
--- a/test/tint/builtins/gen/var/textureLoad/a64b1d.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/a64b1d.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<rgba8unorm, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_a64b1d(tint_module_vars_struct tint_module_vars) {
+  uint3 arg_1 = uint3(1u);
+  float4 res = tint_module_vars.arg_0.read(arg_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_a64b1d = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec3<u32>, read_write> = var, vec3<u32>(1u)
-    %5:texture_storage_3d<rgba8unorm, read_write> = load %arg_0
-    %6:vec3<u32> = load %arg_1
-    %7:vec4<f32> = textureLoad %5, %6
-    %res:ptr<function, vec4<f32>, read_write> = var, %7
-    %9:vec4<f32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_a64b1d(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_a64b1d
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_a64b1d(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_a64b1d
-    ret
-  }
+kernel void compute_main(texture3d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_a64b1d(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_a64b1d
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/a6a85a.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/a6a85a.wgsl.expected.ir.msl
index 52221b6..61d731b 100644
--- a/test/tint/builtins/gen/var/textureLoad/a6a85a.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/a6a85a.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<rgba8unorm, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_a6a85a(tint_module_vars_struct tint_module_vars) {
+  int3 arg_1 = int3(1);
+  float4 res = tint_module_vars.arg_0.read(uint3(arg_1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_a6a85a = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec3<i32>, read_write> = var, vec3<i32>(1i)
-    %5:texture_storage_3d<rgba8unorm, read> = load %arg_0
-    %6:vec3<i32> = load %arg_1
-    %7:vec4<f32> = textureLoad %5, %6
-    %res:ptr<function, vec4<f32>, read_write> = var, %7
-    %9:vec4<f32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_a6a85a(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_a6a85a
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_a6a85a(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_a6a85a
-    ret
-  }
+kernel void compute_main(texture3d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_a6a85a(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_a6a85a
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/a6b61d.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/a6b61d.wgsl.expected.ir.msl
index d3777d7..9466ce4 100644
--- a/test/tint/builtins/gen/var/textureLoad/a6b61d.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/a6b61d.wgsl.expected.ir.msl
@@ -1,47 +1,33 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<int, access::read> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba32sint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_a6b61d(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  int arg_2 = 1;
+  int const v = arg_2;
+  int4 res = tint_module_vars.arg_0.read(uint2(arg_1), v);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_a6b61d = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %arg_2:ptr<function, i32, read_write> = var, 1i
-    %6:texture_storage_2d_array<rgba32sint, read> = load %arg_0
-    %7:vec2<i32> = load %arg_1
-    %8:i32 = load %arg_2
-    %9:vec4<i32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<i32>, read_write> = var, %9
-    %11:vec4<i32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_a6b61d(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_a6b61d
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_a6b61d(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_a6b61d
-    ret
-  }
+kernel void compute_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_a6b61d(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_a6b61d
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/a7444c.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/a7444c.wgsl.expected.ir.msl
index 10a9447..fcdf9e6 100644
--- a/test/tint/builtins/gen/var/textureLoad/a7444c.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/a7444c.wgsl.expected.ir.msl
@@ -1,47 +1,32 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<uint, access::read> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba8uint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_a7444c(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  uint arg_2 = 1u;
+  uint4 res = tint_module_vars.arg_0.read(arg_1, arg_2);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_a7444c = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %arg_2:ptr<function, u32, read_write> = var, 1u
-    %6:texture_storage_2d_array<rgba8uint, read> = load %arg_0
-    %7:vec2<u32> = load %arg_1
-    %8:u32 = load %arg_2
-    %9:vec4<u32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<u32>, read_write> = var, %9
-    %11:vec4<u32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_a7444c(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_a7444c
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_a7444c(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_a7444c
-    ret
-  }
+kernel void compute_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_a7444c(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_a7444c
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/a7a3c3.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/a7a3c3.wgsl.expected.ir.msl
index fd6522a..9639999 100644
--- a/test/tint/builtins/gen/var/textureLoad/a7a3c3.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/a7a3c3.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<int, access::read> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<rgba16sint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_a7a3c3(tint_module_vars_struct tint_module_vars) {
+  int3 arg_1 = int3(1);
+  int4 res = tint_module_vars.arg_0.read(uint3(arg_1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_a7a3c3 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec3<i32>, read_write> = var, vec3<i32>(1i)
-    %5:texture_storage_3d<rgba16sint, read> = load %arg_0
-    %6:vec3<i32> = load %arg_1
-    %7:vec4<i32> = textureLoad %5, %6
-    %res:ptr<function, vec4<i32>, read_write> = var, %7
-    %9:vec4<i32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_a7a3c3(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_a7a3c3
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_a7a3c3(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_a7a3c3
-    ret
-  }
+kernel void compute_main(texture3d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_a7a3c3(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_a7a3c3
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/a7bcb4.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/a7bcb4.wgsl.expected.ir.msl
index 6b85d93..0cad771 100644
--- a/test/tint/builtins/gen/var/textureLoad/a7bcb4.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/a7bcb4.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<rgba8snorm, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_a7bcb4(tint_module_vars_struct tint_module_vars) {
+  uint arg_1 = 1u;
+  float4 res = tint_module_vars.arg_0.read(arg_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_a7bcb4 = func():void {
-  $B2: {
-    %arg_1:ptr<function, u32, read_write> = var, 1u
-    %5:texture_storage_1d<rgba8snorm, read_write> = load %arg_0
-    %6:u32 = load %arg_1
-    %7:vec4<f32> = textureLoad %5, %6
-    %res:ptr<function, vec4<f32>, read_write> = var, %7
-    %9:vec4<f32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_a7bcb4(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_a7bcb4
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_a7bcb4(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_a7bcb4
-    ret
-  }
+kernel void compute_main(texture1d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_a7bcb4(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_a7bcb4
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/a7c171.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/a7c171.wgsl.expected.ir.msl
index 01c1c2d..6640bca 100644
--- a/test/tint/builtins/gen/var/textureLoad/a7c171.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/a7c171.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<int, access::read_write> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<rgba16sint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_a7c171(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  int4 res = tint_module_vars.arg_0.read(arg_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_a7c171 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %5:texture_storage_2d<rgba16sint, read_write> = load %arg_0
-    %6:vec2<u32> = load %arg_1
-    %7:vec4<i32> = textureLoad %5, %6
-    %res:ptr<function, vec4<i32>, read_write> = var, %7
-    %9:vec4<i32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_a7c171(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_a7c171
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_a7c171(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_a7c171
-    ret
-  }
+kernel void compute_main(texture2d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_a7c171(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_a7c171
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/a8549b.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/a8549b.wgsl.expected.ir.msl
index 492a6d8..85498e9 100644
--- a/test/tint/builtins/gen/var/textureLoad/a8549b.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/a8549b.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<rgba32float, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_a8549b(tint_module_vars_struct tint_module_vars) {
+  uint3 arg_1 = uint3(1u);
+  float4 res = tint_module_vars.arg_0.read(arg_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_a8549b = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec3<u32>, read_write> = var, vec3<u32>(1u)
-    %5:texture_storage_3d<rgba32float, read> = load %arg_0
-    %6:vec3<u32> = load %arg_1
-    %7:vec4<f32> = textureLoad %5, %6
-    %res:ptr<function, vec4<f32>, read_write> = var, %7
-    %9:vec4<f32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_a8549b(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_a8549b
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_a8549b(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_a8549b
-    ret
-  }
+kernel void compute_main(texture3d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_a8549b(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_a8549b
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/a92b18.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/a92b18.wgsl.expected.ir.msl
index 4262762..ee3206f 100644
--- a/test/tint/builtins/gen/var/textureLoad/a92b18.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/a92b18.wgsl.expected.ir.msl
@@ -1,47 +1,32 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba32float, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_a92b18(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  int arg_2 = 1;
+  float4 res = tint_module_vars.arg_0.read(arg_1, arg_2);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_a92b18 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %arg_2:ptr<function, i32, read_write> = var, 1i
-    %6:texture_storage_2d_array<rgba32float, read_write> = load %arg_0
-    %7:vec2<u32> = load %arg_1
-    %8:i32 = load %arg_2
-    %9:vec4<f32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<f32>, read_write> = var, %9
-    %11:vec4<f32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_a92b18(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_a92b18
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_a92b18(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_a92b18
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_a92b18(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_a92b18
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/a9a9f5.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/a9a9f5.wgsl.expected.ir.msl
index 25ac913..0ecd0c0 100644
--- a/test/tint/builtins/gen/var/textureLoad/a9a9f5.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/a9a9f5.wgsl.expected.ir.msl
@@ -1,47 +1,33 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<uint, access::sample> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_3d<u32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_a9a9f5(tint_module_vars_struct tint_module_vars) {
+  int3 arg_1 = int3(1);
+  int arg_2 = 1;
+  int const v = arg_2;
+  uint4 res = tint_module_vars.arg_0.read(uint3(arg_1), v);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_a9a9f5 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec3<i32>, read_write> = var, vec3<i32>(1i)
-    %arg_2:ptr<function, i32, read_write> = var, 1i
-    %6:texture_3d<u32> = load %arg_0
-    %7:vec3<i32> = load %arg_1
-    %8:i32 = load %arg_2
-    %9:vec4<u32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<u32>, read_write> = var, %9
-    %11:vec4<u32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_a9a9f5(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_a9a9f5
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_a9a9f5(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_a9a9f5
-    ret
-  }
+kernel void compute_main(texture3d<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_a9a9f5(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_a9a9f5
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/aa2579.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/aa2579.wgsl.expected.ir.msl
index bd211b6..cc40de6 100644
--- a/test/tint/builtins/gen/var/textureLoad/aa2579.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/aa2579.wgsl.expected.ir.msl
@@ -1,47 +1,32 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<uint, access::read_write> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba32uint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_aa2579(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  int arg_2 = 1;
+  uint4 res = tint_module_vars.arg_0.read(arg_1, arg_2);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_aa2579 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %arg_2:ptr<function, i32, read_write> = var, 1i
-    %6:texture_storage_2d_array<rgba32uint, read_write> = load %arg_0
-    %7:vec2<u32> = load %arg_1
-    %8:i32 = load %arg_2
-    %9:vec4<u32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<u32>, read_write> = var, %9
-    %11:vec4<u32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_aa2579(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_aa2579
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_aa2579(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_aa2579
-    ret
-  }
+kernel void compute_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_aa2579(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_aa2579
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/aa6130.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/aa6130.wgsl.expected.ir.msl
index 62ac9db..30177bd 100644
--- a/test/tint/builtins/gen/var/textureLoad/aa6130.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/aa6130.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<int, access::read_write> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<rg32sint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_aa6130(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  int4 res = tint_module_vars.arg_0.read(uint2(arg_1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_aa6130 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %5:texture_storage_2d<rg32sint, read_write> = load %arg_0
-    %6:vec2<i32> = load %arg_1
-    %7:vec4<i32> = textureLoad %5, %6
-    %res:ptr<function, vec4<i32>, read_write> = var, %7
-    %9:vec4<i32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_aa6130(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_aa6130
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_aa6130(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_aa6130
-    ret
-  }
+kernel void compute_main(texture2d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_aa6130(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_aa6130
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/aa8a0d.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/aa8a0d.wgsl.expected.ir.msl
index 514d7c1..74e0595 100644
--- a/test/tint/builtins/gen/var/textureLoad/aa8a0d.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/aa8a0d.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<uint, access::read> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<rgba16uint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_aa8a0d(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  uint4 res = tint_module_vars.arg_0.read(arg_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_aa8a0d = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %5:texture_storage_2d<rgba16uint, read> = load %arg_0
-    %6:vec2<u32> = load %arg_1
-    %7:vec4<u32> = textureLoad %5, %6
-    %res:ptr<function, vec4<u32>, read_write> = var, %7
-    %9:vec4<u32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_aa8a0d(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_aa8a0d
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_aa8a0d(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_aa8a0d
-    ret
-  }
+kernel void compute_main(texture2d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_aa8a0d(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_aa8a0d
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/aae7f6.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/aae7f6.wgsl.expected.ir.msl
index 0fb1fa5..39d8a07 100644
--- a/test/tint/builtins/gen/var/textureLoad/aae7f6.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/aae7f6.wgsl.expected.ir.msl
@@ -1,47 +1,33 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<int, access::read> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<r32sint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_aae7f6(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  uint arg_2 = 1u;
+  uint const v = arg_2;
+  int4 res = tint_module_vars.arg_0.read(uint2(arg_1), v);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_aae7f6 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %arg_2:ptr<function, u32, read_write> = var, 1u
-    %6:texture_storage_2d_array<r32sint, read> = load %arg_0
-    %7:vec2<i32> = load %arg_1
-    %8:u32 = load %arg_2
-    %9:vec4<i32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<i32>, read_write> = var, %9
-    %11:vec4<i32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_aae7f6(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_aae7f6
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_aae7f6(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_aae7f6
-    ret
-  }
+kernel void compute_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_aae7f6(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_aae7f6
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/aae9c3.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/aae9c3.wgsl.expected.ir.msl
index 83b9e49..73b6f80 100644
--- a/test/tint/builtins/gen/var/textureLoad/aae9c3.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/aae9c3.wgsl.expected.ir.msl
@@ -1,47 +1,33 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba8snorm, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_aae9c3(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  uint arg_2 = 1u;
+  uint const v = arg_2;
+  float4 res = tint_module_vars.arg_0.read(uint2(arg_1), v);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_aae9c3 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %arg_2:ptr<function, u32, read_write> = var, 1u
-    %6:texture_storage_2d_array<rgba8snorm, read_write> = load %arg_0
-    %7:vec2<i32> = load %arg_1
-    %8:u32 = load %arg_2
-    %9:vec4<f32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<f32>, read_write> = var, %9
-    %11:vec4<f32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_aae9c3(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_aae9c3
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_aae9c3(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_aae9c3
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_aae9c3(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_aae9c3
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/ac64f7.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/ac64f7.wgsl.expected.ir.msl
index f491ce0..7702fbc 100644
--- a/test/tint/builtins/gen/var/textureLoad/ac64f7.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/ac64f7.wgsl.expected.ir.msl
@@ -1,47 +1,32 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<bgra8unorm, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_ac64f7(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  uint arg_2 = 1u;
+  float4 res = tint_module_vars.arg_0.read(arg_1, arg_2);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_ac64f7 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %arg_2:ptr<function, u32, read_write> = var, 1u
-    %6:texture_storage_2d_array<bgra8unorm, read> = load %arg_0
-    %7:vec2<u32> = load %arg_1
-    %8:u32 = load %arg_2
-    %9:vec4<f32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<f32>, read_write> = var, %9
-    %11:vec4<f32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_ac64f7(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_ac64f7
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_ac64f7(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_ac64f7
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_ac64f7(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_ac64f7
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/acf22f.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/acf22f.wgsl.expected.ir.msl
index 2e623a5..7c1b7e6 100644
--- a/test/tint/builtins/gen/var/textureLoad/acf22f.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/acf22f.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<rgba16float, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_acf22f(tint_module_vars_struct tint_module_vars) {
+  uint arg_1 = 1u;
+  float4 res = tint_module_vars.arg_0.read(arg_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_acf22f = func():void {
-  $B2: {
-    %arg_1:ptr<function, u32, read_write> = var, 1u
-    %5:texture_storage_1d<rgba16float, read_write> = load %arg_0
-    %6:u32 = load %arg_1
-    %7:vec4<f32> = textureLoad %5, %6
-    %res:ptr<function, vec4<f32>, read_write> = var, %7
-    %9:vec4<f32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_acf22f(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_acf22f
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_acf22f(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_acf22f
-    ret
-  }
+kernel void compute_main(texture1d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_acf22f(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_acf22f
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/ad551e.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/ad551e.wgsl.expected.ir.msl
index 1fb1bac..ad80824 100644
--- a/test/tint/builtins/gen/var/textureLoad/ad551e.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/ad551e.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<uint, access::read_write> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<r32uint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_ad551e(tint_module_vars_struct tint_module_vars) {
+  uint arg_1 = 1u;
+  uint4 res = tint_module_vars.arg_0.read(arg_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_ad551e = func():void {
-  $B2: {
-    %arg_1:ptr<function, u32, read_write> = var, 1u
-    %5:texture_storage_1d<r32uint, read_write> = load %arg_0
-    %6:u32 = load %arg_1
-    %7:vec4<u32> = textureLoad %5, %6
-    %res:ptr<function, vec4<u32>, read_write> = var, %7
-    %9:vec4<u32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_ad551e(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_ad551e
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_ad551e(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_ad551e
-    ret
-  }
+kernel void compute_main(texture1d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_ad551e(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_ad551e
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/aeae73.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/aeae73.wgsl.expected.ir.msl
index d7cf912..965fd08 100644
--- a/test/tint/builtins/gen/var/textureLoad/aeae73.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/aeae73.wgsl.expected.ir.msl
@@ -1,47 +1,32 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<uint, access::read> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<r32uint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_aeae73(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  int arg_2 = 1;
+  uint4 res = tint_module_vars.arg_0.read(arg_1, arg_2);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_aeae73 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %arg_2:ptr<function, i32, read_write> = var, 1i
-    %6:texture_storage_2d_array<r32uint, read> = load %arg_0
-    %7:vec2<u32> = load %arg_1
-    %8:i32 = load %arg_2
-    %9:vec4<u32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<u32>, read_write> = var, %9
-    %11:vec4<u32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_aeae73(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_aeae73
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_aeae73(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_aeae73
-    ret
-  }
+kernel void compute_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_aeae73(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_aeae73
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/aebc09.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/aebc09.wgsl.expected.ir.msl
index 3e5635e..4aadb33 100644
--- a/test/tint/builtins/gen/var/textureLoad/aebc09.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/aebc09.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<uint, access::read> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<rgba16uint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_aebc09(tint_module_vars_struct tint_module_vars) {
+  uint arg_1 = 1u;
+  uint4 res = tint_module_vars.arg_0.read(arg_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_aebc09 = func():void {
-  $B2: {
-    %arg_1:ptr<function, u32, read_write> = var, 1u
-    %5:texture_storage_1d<rgba16uint, read> = load %arg_0
-    %6:u32 = load %arg_1
-    %7:vec4<u32> = textureLoad %5, %6
-    %res:ptr<function, vec4<u32>, read_write> = var, %7
-    %9:vec4<u32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_aebc09(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_aebc09
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_aebc09(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_aebc09
-    ret
-  }
+kernel void compute_main(texture1d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_aebc09(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_aebc09
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/af0507.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/af0507.wgsl.expected.ir.msl
index 500c8c4..7da20e4 100644
--- a/test/tint/builtins/gen/var/textureLoad/af0507.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/af0507.wgsl.expected.ir.msl
@@ -1,47 +1,33 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rg32float, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_af0507(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  uint arg_2 = 1u;
+  uint const v = arg_2;
+  float4 res = tint_module_vars.arg_0.read(uint2(arg_1), v);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_af0507 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %arg_2:ptr<function, u32, read_write> = var, 1u
-    %6:texture_storage_2d_array<rg32float, read_write> = load %arg_0
-    %7:vec2<i32> = load %arg_1
-    %8:u32 = load %arg_2
-    %9:vec4<f32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<f32>, read_write> = var, %9
-    %11:vec4<f32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_af0507(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_af0507
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_af0507(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_af0507
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_af0507(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_af0507
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/b1bf79.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/b1bf79.wgsl.expected.ir.msl
index 55bbd47..2a209d7 100644
--- a/test/tint/builtins/gen/var/textureLoad/b1bf79.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/b1bf79.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<int, access::read> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<rgba32sint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_b1bf79(tint_module_vars_struct tint_module_vars) {
+  int3 arg_1 = int3(1);
+  int4 res = tint_module_vars.arg_0.read(uint3(arg_1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_b1bf79 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec3<i32>, read_write> = var, vec3<i32>(1i)
-    %5:texture_storage_3d<rgba32sint, read> = load %arg_0
-    %6:vec3<i32> = load %arg_1
-    %7:vec4<i32> = textureLoad %5, %6
-    %res:ptr<function, vec4<i32>, read_write> = var, %7
-    %9:vec4<i32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_b1bf79(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_b1bf79
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_b1bf79(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_b1bf79
-    ret
-  }
+kernel void compute_main(texture3d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_b1bf79(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_b1bf79
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/b1ca35.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/b1ca35.wgsl.expected.ir.msl
index 29673be..fbbe800 100644
--- a/test/tint/builtins/gen/var/textureLoad/b1ca35.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/b1ca35.wgsl.expected.ir.msl
@@ -1,47 +1,32 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<int, access::read_write> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rg32sint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_b1ca35(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  uint arg_2 = 1u;
+  int4 res = tint_module_vars.arg_0.read(arg_1, arg_2);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_b1ca35 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %arg_2:ptr<function, u32, read_write> = var, 1u
-    %6:texture_storage_2d_array<rg32sint, read_write> = load %arg_0
-    %7:vec2<u32> = load %arg_1
-    %8:u32 = load %arg_2
-    %9:vec4<i32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<i32>, read_write> = var, %9
-    %11:vec4<i32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_b1ca35(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_b1ca35
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_b1ca35(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_b1ca35
-    ret
-  }
+kernel void compute_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_b1ca35(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_b1ca35
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/b24d27.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/b24d27.wgsl.expected.ir.msl
index 5ded4ff..7797110 100644
--- a/test/tint/builtins/gen/var/textureLoad/b24d27.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/b24d27.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<int, access::read> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<rgba8sint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_b24d27(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  int4 res = tint_module_vars.arg_0.read(arg_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_b24d27 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %5:texture_storage_2d<rgba8sint, read> = load %arg_0
-    %6:vec2<u32> = load %arg_1
-    %7:vec4<i32> = textureLoad %5, %6
-    %res:ptr<function, vec4<i32>, read_write> = var, %7
-    %9:vec4<i32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_b24d27(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_b24d27
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_b24d27(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_b24d27
-    ret
-  }
+kernel void compute_main(texture2d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_b24d27(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_b24d27
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/b25644.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/b25644.wgsl.expected.ir.msl
index 07190e1..c73bfbe 100644
--- a/test/tint/builtins/gen/var/textureLoad/b25644.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/b25644.wgsl.expected.ir.msl
@@ -1,47 +1,33 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<uint, access::read_write> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<r32uint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_b25644(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  uint arg_2 = 1u;
+  uint const v = arg_2;
+  uint4 res = tint_module_vars.arg_0.read(uint2(arg_1), v);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_b25644 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %arg_2:ptr<function, u32, read_write> = var, 1u
-    %6:texture_storage_2d_array<r32uint, read_write> = load %arg_0
-    %7:vec2<i32> = load %arg_1
-    %8:u32 = load %arg_2
-    %9:vec4<u32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<u32>, read_write> = var, %9
-    %11:vec4<u32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_b25644(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_b25644
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_b25644(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_b25644
-    ret
-  }
+kernel void compute_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_b25644(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_b25644
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/b27c33.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/b27c33.wgsl.expected.ir.msl
index 9f00df9..a8c509e 100644
--- a/test/tint/builtins/gen/var/textureLoad/b27c33.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/b27c33.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<int, access::read_write> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<r32sint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_b27c33(tint_module_vars_struct tint_module_vars) {
+  int3 arg_1 = int3(1);
+  int4 res = tint_module_vars.arg_0.read(uint3(arg_1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_b27c33 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec3<i32>, read_write> = var, vec3<i32>(1i)
-    %5:texture_storage_3d<r32sint, read_write> = load %arg_0
-    %6:vec3<i32> = load %arg_1
-    %7:vec4<i32> = textureLoad %5, %6
-    %res:ptr<function, vec4<i32>, read_write> = var, %7
-    %9:vec4<i32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_b27c33(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_b27c33
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_b27c33(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_b27c33
-    ret
-  }
+kernel void compute_main(texture3d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_b27c33(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_b27c33
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/b29f71.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/b29f71.wgsl.expected.ir.msl
index d6c5a15..483e6f6 100644
--- a/test/tint/builtins/gen/var/textureLoad/b29f71.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/b29f71.wgsl.expected.ir.msl
@@ -1,49 +1,35 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<int, access::sample> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_2d_array<i32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_b29f71(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  uint arg_2 = 1u;
+  int arg_3 = 1;
+  uint const v = arg_2;
+  int const v_1 = arg_3;
+  int4 res = tint_module_vars.arg_0.read(uint2(arg_1), v, v_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_b29f71 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %arg_2:ptr<function, u32, read_write> = var, 1u
-    %arg_3:ptr<function, i32, read_write> = var, 1i
-    %7:texture_2d_array<i32> = load %arg_0
-    %8:vec2<i32> = load %arg_1
-    %9:u32 = load %arg_2
-    %10:i32 = load %arg_3
-    %11:vec4<i32> = textureLoad %7, %8, %9, %10
-    %res:ptr<function, vec4<i32>, read_write> = var, %11
-    %13:vec4<i32> = load %res
-    store %prevent_dce, %13
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_b29f71(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %15:void = call %textureLoad_b29f71
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_b29f71(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %17:void = call %textureLoad_b29f71
-    ret
-  }
+kernel void compute_main(texture2d_array<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_b29f71(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %19:void = call %textureLoad_b29f71
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/b4d6c4.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/b4d6c4.wgsl.expected.ir.msl
index 2a63f15..d782bb6 100644
--- a/test/tint/builtins/gen/var/textureLoad/b4d6c4.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/b4d6c4.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<rg32float, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_b4d6c4(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  float4 res = tint_module_vars.arg_0.read(arg_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_b4d6c4 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %5:texture_storage_2d<rg32float, read_write> = load %arg_0
-    %6:vec2<u32> = load %arg_1
-    %7:vec4<f32> = textureLoad %5, %6
-    %res:ptr<function, vec4<f32>, read_write> = var, %7
-    %9:vec4<f32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_b4d6c4(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_b4d6c4
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_b4d6c4(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_b4d6c4
-    ret
-  }
+kernel void compute_main(texture2d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_b4d6c4(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_b4d6c4
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/b58c6d.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/b58c6d.wgsl.expected.ir.msl
index 4c63ed9..8357042 100644
--- a/test/tint/builtins/gen/var/textureLoad/b58c6d.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/b58c6d.wgsl.expected.ir.msl
@@ -1,47 +1,33 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<r32float, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_b58c6d(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  int arg_2 = 1;
+  int const v = arg_2;
+  float4 res = tint_module_vars.arg_0.read(uint2(arg_1), v);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_b58c6d = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %arg_2:ptr<function, i32, read_write> = var, 1i
-    %6:texture_storage_2d_array<r32float, read> = load %arg_0
-    %7:vec2<i32> = load %arg_1
-    %8:i32 = load %arg_2
-    %9:vec4<f32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<f32>, read_write> = var, %9
-    %11:vec4<f32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_b58c6d(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_b58c6d
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_b58c6d(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_b58c6d
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_b58c6d(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_b58c6d
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/b60a86.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/b60a86.wgsl.expected.ir.msl
index 0fd499b..50fb915 100644
--- a/test/tint/builtins/gen/var/textureLoad/b60a86.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/b60a86.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<uint, access::read_write> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<rgba32uint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_b60a86(tint_module_vars_struct tint_module_vars) {
+  int arg_1 = 1;
+  uint4 res = tint_module_vars.arg_0.read(uint(arg_1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_b60a86 = func():void {
-  $B2: {
-    %arg_1:ptr<function, i32, read_write> = var, 1i
-    %5:texture_storage_1d<rgba32uint, read_write> = load %arg_0
-    %6:i32 = load %arg_1
-    %7:vec4<u32> = textureLoad %5, %6
-    %res:ptr<function, vec4<u32>, read_write> = var, %7
-    %9:vec4<u32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_b60a86(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_b60a86
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_b60a86(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_b60a86
-    ret
-  }
+kernel void compute_main(texture1d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_b60a86(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_b60a86
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/b60db7.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/b60db7.wgsl.expected.ir.msl
index 2bbf773..9bfd8dd 100644
--- a/test/tint/builtins/gen/var/textureLoad/b60db7.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/b60db7.wgsl.expected.ir.msl
@@ -1,47 +1,32 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<bgra8unorm, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_b60db7(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  uint arg_2 = 1u;
+  float4 res = tint_module_vars.arg_0.read(arg_1, arg_2);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_b60db7 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %arg_2:ptr<function, u32, read_write> = var, 1u
-    %6:texture_storage_2d_array<bgra8unorm, read_write> = load %arg_0
-    %7:vec2<u32> = load %arg_1
-    %8:u32 = load %arg_2
-    %9:vec4<f32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<f32>, read_write> = var, %9
-    %11:vec4<f32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_b60db7(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_b60db7
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_b60db7(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_b60db7
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_b60db7(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_b60db7
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/b6ba5d.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/b6ba5d.wgsl.expected.ir.msl
index 9c1e62f..1b4cefa 100644
--- a/test/tint/builtins/gen/var/textureLoad/b6ba5d.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/b6ba5d.wgsl.expected.ir.msl
@@ -1,49 +1,33 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  depth2d_array<float, access::sample> arg_0;
+  device float* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_depth_2d_array, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, f32, read_write> = var @binding_point(2, 0)
+void textureLoad_b6ba5d(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  int arg_2 = 1;
+  int arg_3 = 1;
+  float res = tint_module_vars.arg_0.read(arg_1, arg_2, arg_3);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_b6ba5d = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %arg_2:ptr<function, i32, read_write> = var, 1i
-    %arg_3:ptr<function, i32, read_write> = var, 1i
-    %7:texture_depth_2d_array = load %arg_0
-    %8:vec2<u32> = load %arg_1
-    %9:i32 = load %arg_2
-    %10:i32 = load %arg_3
-    %11:f32 = textureLoad %7, %8, %9, %10
-    %res:ptr<function, f32, read_write> = var, %11
-    %13:f32 = load %res
-    store %prevent_dce, %13
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_b6ba5d(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %15:void = call %textureLoad_b6ba5d
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(depth2d_array<float, access::sample> arg_0 [[texture(0)]], device float* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_b6ba5d(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %17:void = call %textureLoad_b6ba5d
-    ret
-  }
+kernel void compute_main(depth2d_array<float, access::sample> arg_0 [[texture(0)]], device float* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_b6ba5d(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %19:void = call %textureLoad_b6ba5d
-    ret
-  }
+vertex vertex_main_outputs vertex_main(depth2d_array<float, access::sample> arg_0 [[texture(0)]], device float* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/b6c458.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/b6c458.wgsl.expected.ir.msl
index d574d5a..92d6e42 100644
--- a/test/tint/builtins/gen/var/textureLoad/b6c458.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/b6c458.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<uint, access::read> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<rgba32uint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_b6c458(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  uint4 res = tint_module_vars.arg_0.read(uint2(arg_1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_b6c458 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %5:texture_storage_2d<rgba32uint, read> = load %arg_0
-    %6:vec2<i32> = load %arg_1
-    %7:vec4<u32> = textureLoad %5, %6
-    %res:ptr<function, vec4<u32>, read_write> = var, %7
-    %9:vec4<u32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_b6c458(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_b6c458
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_b6c458(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_b6c458
-    ret
-  }
+kernel void compute_main(texture2d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_b6c458(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_b6c458
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/b73f6b.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/b73f6b.wgsl.expected.ir.msl
index 6bee101..6fda9d8 100644
--- a/test/tint/builtins/gen/var/textureLoad/b73f6b.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/b73f6b.wgsl.expected.ir.msl
@@ -1,47 +1,32 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<uint, access::sample> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_2d<u32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_b73f6b(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  int arg_2 = 1;
+  uint4 res = tint_module_vars.arg_0.read(arg_1, arg_2);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_b73f6b = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %arg_2:ptr<function, i32, read_write> = var, 1i
-    %6:texture_2d<u32> = load %arg_0
-    %7:vec2<u32> = load %arg_1
-    %8:i32 = load %arg_2
-    %9:vec4<u32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<u32>, read_write> = var, %9
-    %11:vec4<u32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_b73f6b(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_b73f6b
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_b73f6b(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_b73f6b
-    ret
-  }
+kernel void compute_main(texture2d<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_b73f6b(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_b73f6b
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/b75c8f.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/b75c8f.wgsl.expected.ir.msl
index 4d5f8d6..0f60dd7 100644
--- a/test/tint/builtins/gen/var/textureLoad/b75c8f.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/b75c8f.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<int, access::read_write> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<r32sint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_b75c8f(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  int4 res = tint_module_vars.arg_0.read(arg_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_b75c8f = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %5:texture_storage_2d<r32sint, read_write> = load %arg_0
-    %6:vec2<u32> = load %arg_1
-    %7:vec4<i32> = textureLoad %5, %6
-    %res:ptr<function, vec4<i32>, read_write> = var, %7
-    %9:vec4<i32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_b75c8f(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_b75c8f
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_b75c8f(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_b75c8f
-    ret
-  }
+kernel void compute_main(texture2d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_b75c8f(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_b75c8f
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/b75d4a.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/b75d4a.wgsl.expected.ir.msl
index 2a38e81..5214d8b 100644
--- a/test/tint/builtins/gen/var/textureLoad/b75d4a.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/b75d4a.wgsl.expected.ir.msl
@@ -1,47 +1,33 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_ms<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_multisampled_2d<f32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_b75d4a(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  uint arg_2 = 1u;
+  uint const v = arg_2;
+  float4 res = tint_module_vars.arg_0.read(uint2(arg_1), v);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_b75d4a = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %arg_2:ptr<function, u32, read_write> = var, 1u
-    %6:texture_multisampled_2d<f32> = load %arg_0
-    %7:vec2<i32> = load %arg_1
-    %8:u32 = load %arg_2
-    %9:vec4<f32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<f32>, read_write> = var, %9
-    %11:vec4<f32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_b75d4a(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_b75d4a
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_ms<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_b75d4a(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_b75d4a
-    ret
-  }
+kernel void compute_main(texture2d_ms<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_b75d4a(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_b75d4a
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_ms<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/b7f74f.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/b7f74f.wgsl.expected.ir.msl
index 773975c..e0b5ed7 100644
--- a/test/tint/builtins/gen/var/textureLoad/b7f74f.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/b7f74f.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<bgra8unorm, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_b7f74f(tint_module_vars_struct tint_module_vars) {
+  uint arg_1 = 1u;
+  float4 res = tint_module_vars.arg_0.read(arg_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_b7f74f = func():void {
-  $B2: {
-    %arg_1:ptr<function, u32, read_write> = var, 1u
-    %5:texture_storage_1d<bgra8unorm, read> = load %arg_0
-    %6:u32 = load %arg_1
-    %7:vec4<f32> = textureLoad %5, %6
-    %res:ptr<function, vec4<f32>, read_write> = var, %7
-    %9:vec4<f32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_b7f74f(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_b7f74f
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_b7f74f(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_b7f74f
-    ret
-  }
+kernel void compute_main(texture1d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_b7f74f(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_b7f74f
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/b80e7e.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/b80e7e.wgsl.expected.ir.msl
index 8460602..308e5f5 100644
--- a/test/tint/builtins/gen/var/textureLoad/b80e7e.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/b80e7e.wgsl.expected.ir.msl
@@ -1,47 +1,32 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba16float, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_b80e7e(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  int arg_2 = 1;
+  float4 res = tint_module_vars.arg_0.read(arg_1, arg_2);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_b80e7e = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %arg_2:ptr<function, i32, read_write> = var, 1i
-    %6:texture_storage_2d_array<rgba16float, read> = load %arg_0
-    %7:vec2<u32> = load %arg_1
-    %8:i32 = load %arg_2
-    %9:vec4<f32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<f32>, read_write> = var, %9
-    %11:vec4<f32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_b80e7e(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_b80e7e
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_b80e7e(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_b80e7e
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_b80e7e(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_b80e7e
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/b94d15.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/b94d15.wgsl.expected.ir.msl
index ab28022..97a9955 100644
--- a/test/tint/builtins/gen/var/textureLoad/b94d15.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/b94d15.wgsl.expected.ir.msl
@@ -1,47 +1,33 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<uint, access::read> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba8uint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_b94d15(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  uint arg_2 = 1u;
+  uint const v = arg_2;
+  uint4 res = tint_module_vars.arg_0.read(uint2(arg_1), v);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_b94d15 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %arg_2:ptr<function, u32, read_write> = var, 1u
-    %6:texture_storage_2d_array<rgba8uint, read> = load %arg_0
-    %7:vec2<i32> = load %arg_1
-    %8:u32 = load %arg_2
-    %9:vec4<u32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<u32>, read_write> = var, %9
-    %11:vec4<u32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_b94d15(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_b94d15
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_b94d15(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_b94d15
-    ret
-  }
+kernel void compute_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_b94d15(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_b94d15
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/ba023a.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/ba023a.wgsl.expected.ir.msl
index 45263f4..0c08931 100644
--- a/test/tint/builtins/gen/var/textureLoad/ba023a.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/ba023a.wgsl.expected.ir.msl
@@ -1,47 +1,33 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<int, access::read_write> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<r32sint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_ba023a(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  int arg_2 = 1;
+  int const v = arg_2;
+  int4 res = tint_module_vars.arg_0.read(uint2(arg_1), v);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_ba023a = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %arg_2:ptr<function, i32, read_write> = var, 1i
-    %6:texture_storage_2d_array<r32sint, read_write> = load %arg_0
-    %7:vec2<i32> = load %arg_1
-    %8:i32 = load %arg_2
-    %9:vec4<i32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<i32>, read_write> = var, %9
-    %11:vec4<i32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_ba023a(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_ba023a
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_ba023a(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_ba023a
-    ret
-  }
+kernel void compute_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_ba023a(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_ba023a
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/ba74b2.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/ba74b2.wgsl.expected.ir.msl
index 6343376..d656cc2 100644
--- a/test/tint/builtins/gen/var/textureLoad/ba74b2.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/ba74b2.wgsl.expected.ir.msl
@@ -1,47 +1,33 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<int, access::read_write> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba32sint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_ba74b2(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  int arg_2 = 1;
+  int const v = arg_2;
+  int4 res = tint_module_vars.arg_0.read(uint2(arg_1), v);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_ba74b2 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %arg_2:ptr<function, i32, read_write> = var, 1i
-    %6:texture_storage_2d_array<rgba32sint, read_write> = load %arg_0
-    %7:vec2<i32> = load %arg_1
-    %8:i32 = load %arg_2
-    %9:vec4<i32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<i32>, read_write> = var, %9
-    %11:vec4<i32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_ba74b2(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_ba74b2
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_ba74b2(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_ba74b2
-    ret
-  }
+kernel void compute_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_ba74b2(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_ba74b2
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/babdf3.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/babdf3.wgsl.expected.ir.msl
index 6859935..a949d49 100644
--- a/test/tint/builtins/gen/var/textureLoad/babdf3.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/babdf3.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<uint, access::read_write> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<rgba16uint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_babdf3(tint_module_vars_struct tint_module_vars) {
+  uint arg_1 = 1u;
+  uint4 res = tint_module_vars.arg_0.read(arg_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_babdf3 = func():void {
-  $B2: {
-    %arg_1:ptr<function, u32, read_write> = var, 1u
-    %5:texture_storage_1d<rgba16uint, read_write> = load %arg_0
-    %6:u32 = load %arg_1
-    %7:vec4<u32> = textureLoad %5, %6
-    %res:ptr<function, vec4<u32>, read_write> = var, %7
-    %9:vec4<u32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_babdf3(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_babdf3
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_babdf3(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_babdf3
-    ret
-  }
+kernel void compute_main(texture1d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_babdf3(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_babdf3
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/bba04a.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/bba04a.wgsl.expected.ir.msl
index 54c5d35..926fab6 100644
--- a/test/tint/builtins/gen/var/textureLoad/bba04a.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/bba04a.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<uint, access::read_write> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<rg32uint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_bba04a(tint_module_vars_struct tint_module_vars) {
+  uint arg_1 = 1u;
+  uint4 res = tint_module_vars.arg_0.read(arg_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_bba04a = func():void {
-  $B2: {
-    %arg_1:ptr<function, u32, read_write> = var, 1u
-    %5:texture_storage_1d<rg32uint, read_write> = load %arg_0
-    %6:u32 = load %arg_1
-    %7:vec4<u32> = textureLoad %5, %6
-    %res:ptr<function, vec4<u32>, read_write> = var, %7
-    %9:vec4<u32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_bba04a(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_bba04a
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_bba04a(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_bba04a
-    ret
-  }
+kernel void compute_main(texture1d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_bba04a(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_bba04a
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/bbb762.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/bbb762.wgsl.expected.ir.msl
index e42cc5f..885eacc 100644
--- a/test/tint/builtins/gen/var/textureLoad/bbb762.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/bbb762.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<int, access::read_write> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<rgba32sint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_bbb762(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  int4 res = tint_module_vars.arg_0.read(arg_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_bbb762 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %5:texture_storage_2d<rgba32sint, read_write> = load %arg_0
-    %6:vec2<u32> = load %arg_1
-    %7:vec4<i32> = textureLoad %5, %6
-    %res:ptr<function, vec4<i32>, read_write> = var, %7
-    %9:vec4<i32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_bbb762(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_bbb762
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_bbb762(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_bbb762
-    ret
-  }
+kernel void compute_main(texture2d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_bbb762(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_bbb762
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/bc3201.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/bc3201.wgsl.expected.ir.msl
index f1ef492..1aa766a 100644
--- a/test/tint/builtins/gen/var/textureLoad/bc3201.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/bc3201.wgsl.expected.ir.msl
@@ -1,47 +1,32 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<uint, access::sample> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_1d<u32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_bc3201(tint_module_vars_struct tint_module_vars) {
+  uint arg_1 = 1u;
+  uint arg_2 = 1u;
+  uint4 res = tint_module_vars.arg_0.read(arg_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_bc3201 = func():void {
-  $B2: {
-    %arg_1:ptr<function, u32, read_write> = var, 1u
-    %arg_2:ptr<function, u32, read_write> = var, 1u
-    %6:texture_1d<u32> = load %arg_0
-    %7:u32 = load %arg_1
-    %8:u32 = load %arg_2
-    %9:vec4<u32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<u32>, read_write> = var, %9
-    %11:vec4<u32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_bc3201(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_bc3201
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_bc3201(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_bc3201
-    ret
-  }
+kernel void compute_main(texture1d<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_bc3201(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_bc3201
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/bc882d.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/bc882d.wgsl.expected.ir.msl
index 23ed61d..cf827e8 100644
--- a/test/tint/builtins/gen/var/textureLoad/bc882d.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/bc882d.wgsl.expected.ir.msl
@@ -1,47 +1,32 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<r8unorm, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_bc882d(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  int arg_2 = 1;
+  float4 res = tint_module_vars.arg_0.read(arg_1, arg_2);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_bc882d = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %arg_2:ptr<function, i32, read_write> = var, 1i
-    %6:texture_storage_2d_array<r8unorm, read_write> = load %arg_0
-    %7:vec2<u32> = load %arg_1
-    %8:i32 = load %arg_2
-    %9:vec4<f32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<f32>, read_write> = var, %9
-    %11:vec4<f32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_bc882d(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_bc882d
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_bc882d(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_bc882d
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_bc882d(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_bc882d
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/bcbb3c.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/bcbb3c.wgsl.expected.ir.msl
index 1aab06f..7f1b92b 100644
--- a/test/tint/builtins/gen/var/textureLoad/bcbb3c.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/bcbb3c.wgsl.expected.ir.msl
@@ -1,47 +1,32 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<float, access::sample> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_3d<f32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_bcbb3c(tint_module_vars_struct tint_module_vars) {
+  uint3 arg_1 = uint3(1u);
+  int arg_2 = 1;
+  float4 res = tint_module_vars.arg_0.read(arg_1, arg_2);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_bcbb3c = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec3<u32>, read_write> = var, vec3<u32>(1u)
-    %arg_2:ptr<function, i32, read_write> = var, 1i
-    %6:texture_3d<f32> = load %arg_0
-    %7:vec3<u32> = load %arg_1
-    %8:i32 = load %arg_2
-    %9:vec4<f32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<f32>, read_write> = var, %9
-    %11:vec4<f32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_bcbb3c(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_bcbb3c
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_bcbb3c(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_bcbb3c
-    ret
-  }
+kernel void compute_main(texture3d<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_bcbb3c(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_bcbb3c
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/bd990a.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/bd990a.wgsl.expected.ir.msl
index 69af03a..d537d01 100644
--- a/test/tint/builtins/gen/var/textureLoad/bd990a.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/bd990a.wgsl.expected.ir.msl
@@ -1,47 +1,32 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<uint, access::read_write> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba8uint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_bd990a(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  int arg_2 = 1;
+  uint4 res = tint_module_vars.arg_0.read(arg_1, arg_2);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_bd990a = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %arg_2:ptr<function, i32, read_write> = var, 1i
-    %6:texture_storage_2d_array<rgba8uint, read_write> = load %arg_0
-    %7:vec2<u32> = load %arg_1
-    %8:i32 = load %arg_2
-    %9:vec4<u32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<u32>, read_write> = var, %9
-    %11:vec4<u32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_bd990a(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_bd990a
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_bd990a(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_bd990a
-    ret
-  }
+kernel void compute_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_bd990a(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_bd990a
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/bdc67a.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/bdc67a.wgsl.expected.ir.msl
index eaabb36..c5111f0 100644
--- a/test/tint/builtins/gen/var/textureLoad/bdc67a.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/bdc67a.wgsl.expected.ir.msl
@@ -1,47 +1,32 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rg32float, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_bdc67a(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  int arg_2 = 1;
+  float4 res = tint_module_vars.arg_0.read(arg_1, arg_2);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_bdc67a = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %arg_2:ptr<function, i32, read_write> = var, 1i
-    %6:texture_storage_2d_array<rg32float, read_write> = load %arg_0
-    %7:vec2<u32> = load %arg_1
-    %8:i32 = load %arg_2
-    %9:vec4<f32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<f32>, read_write> = var, %9
-    %11:vec4<f32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_bdc67a(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_bdc67a
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_bdc67a(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_bdc67a
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_bdc67a(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_bdc67a
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/bfd154.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/bfd154.wgsl.expected.ir.msl
index 25f57b2..2c89729 100644
--- a/test/tint/builtins/gen/var/textureLoad/bfd154.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/bfd154.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<uint, access::read> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<r32uint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_bfd154(tint_module_vars_struct tint_module_vars) {
+  int3 arg_1 = int3(1);
+  uint4 res = tint_module_vars.arg_0.read(uint3(arg_1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_bfd154 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec3<i32>, read_write> = var, vec3<i32>(1i)
-    %5:texture_storage_3d<r32uint, read> = load %arg_0
-    %6:vec3<i32> = load %arg_1
-    %7:vec4<u32> = textureLoad %5, %6
-    %res:ptr<function, vec4<u32>, read_write> = var, %7
-    %9:vec4<u32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_bfd154(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_bfd154
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_bfd154(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_bfd154
-    ret
-  }
+kernel void compute_main(texture3d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_bfd154(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_bfd154
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/c02b74.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/c02b74.wgsl.expected.ir.msl
index 54adc0e..e85dcb4 100644
--- a/test/tint/builtins/gen/var/textureLoad/c02b74.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/c02b74.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<rgba16float, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_c02b74(tint_module_vars_struct tint_module_vars) {
+  int arg_1 = 1;
+  float4 res = tint_module_vars.arg_0.read(uint(arg_1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_c02b74 = func():void {
-  $B2: {
-    %arg_1:ptr<function, i32, read_write> = var, 1i
-    %5:texture_storage_1d<rgba16float, read> = load %arg_0
-    %6:i32 = load %arg_1
-    %7:vec4<f32> = textureLoad %5, %6
-    %res:ptr<function, vec4<f32>, read_write> = var, %7
-    %9:vec4<f32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_c02b74(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_c02b74
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_c02b74(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_c02b74
-    ret
-  }
+kernel void compute_main(texture1d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_c02b74(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_c02b74
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/c07013.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/c07013.wgsl.expected.ir.msl
index 1df9d3b..16c3ace 100644
--- a/test/tint/builtins/gen/var/textureLoad/c07013.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/c07013.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<r32float, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_c07013(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  float4 res = tint_module_vars.arg_0.read(uint2(arg_1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_c07013 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %5:texture_storage_2d<r32float, read> = load %arg_0
-    %6:vec2<i32> = load %arg_1
-    %7:vec4<f32> = textureLoad %5, %6
-    %res:ptr<function, vec4<f32>, read_write> = var, %7
-    %9:vec4<f32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_c07013(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_c07013
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_c07013(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_c07013
-    ret
-  }
+kernel void compute_main(texture2d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_c07013(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_c07013
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/c16e00.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/c16e00.wgsl.expected.ir.msl
index e227263..254650e 100644
--- a/test/tint/builtins/gen/var/textureLoad/c16e00.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/c16e00.wgsl.expected.ir.msl
@@ -1,49 +1,35 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  depth2d_array<float, access::sample> arg_0;
+  device float* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_depth_2d_array, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, f32, read_write> = var @binding_point(2, 0)
+void textureLoad_c16e00(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  uint arg_2 = 1u;
+  int arg_3 = 1;
+  uint const v = arg_2;
+  int const v_1 = arg_3;
+  float res = tint_module_vars.arg_0.read(uint2(arg_1), v, v_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_c16e00 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %arg_2:ptr<function, u32, read_write> = var, 1u
-    %arg_3:ptr<function, i32, read_write> = var, 1i
-    %7:texture_depth_2d_array = load %arg_0
-    %8:vec2<i32> = load %arg_1
-    %9:u32 = load %arg_2
-    %10:i32 = load %arg_3
-    %11:f32 = textureLoad %7, %8, %9, %10
-    %res:ptr<function, f32, read_write> = var, %11
-    %13:f32 = load %res
-    store %prevent_dce, %13
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_c16e00(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %15:void = call %textureLoad_c16e00
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(depth2d_array<float, access::sample> arg_0 [[texture(0)]], device float* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_c16e00(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %17:void = call %textureLoad_c16e00
-    ret
-  }
+kernel void compute_main(depth2d_array<float, access::sample> arg_0 [[texture(0)]], device float* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_c16e00(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %19:void = call %textureLoad_c16e00
-    ret
-  }
+vertex vertex_main_outputs vertex_main(depth2d_array<float, access::sample> arg_0 [[texture(0)]], device float* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/c21b33.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/c21b33.wgsl.expected.ir.msl
index 101bb89..a0a1c8b 100644
--- a/test/tint/builtins/gen/var/textureLoad/c21b33.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/c21b33.wgsl.expected.ir.msl
@@ -1,47 +1,32 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<uint, access::read> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba32uint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_c21b33(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  int arg_2 = 1;
+  uint4 res = tint_module_vars.arg_0.read(arg_1, arg_2);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_c21b33 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %arg_2:ptr<function, i32, read_write> = var, 1i
-    %6:texture_storage_2d_array<rgba32uint, read> = load %arg_0
-    %7:vec2<u32> = load %arg_1
-    %8:i32 = load %arg_2
-    %9:vec4<u32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<u32>, read_write> = var, %9
-    %11:vec4<u32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_c21b33(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_c21b33
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_c21b33(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_c21b33
-    ret
-  }
+kernel void compute_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_c21b33(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_c21b33
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/c2a480.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/c2a480.wgsl.expected.ir.msl
index 7740f66..0d90886 100644
--- a/test/tint/builtins/gen/var/textureLoad/c2a480.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/c2a480.wgsl.expected.ir.msl
@@ -1,47 +1,33 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<int, access::sample> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_2d<i32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_c2a480(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  int arg_2 = 1;
+  int const v = arg_2;
+  int4 res = tint_module_vars.arg_0.read(uint2(arg_1), v);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_c2a480 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %arg_2:ptr<function, i32, read_write> = var, 1i
-    %6:texture_2d<i32> = load %arg_0
-    %7:vec2<i32> = load %arg_1
-    %8:i32 = load %arg_2
-    %9:vec4<i32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<i32>, read_write> = var, %9
-    %11:vec4<i32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_c2a480(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_c2a480
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_c2a480(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_c2a480
-    ret
-  }
+kernel void compute_main(texture2d<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_c2a480(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_c2a480
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/c2d09a.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/c2d09a.wgsl.expected.ir.msl
index b95ee4f..7eb5c3b 100644
--- a/test/tint/builtins/gen/var/textureLoad/c2d09a.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/c2d09a.wgsl.expected.ir.msl
@@ -1,47 +1,32 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<uint, access::read_write> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<r32uint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_c2d09a(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  int arg_2 = 1;
+  uint4 res = tint_module_vars.arg_0.read(arg_1, arg_2);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_c2d09a = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %arg_2:ptr<function, i32, read_write> = var, 1i
-    %6:texture_storage_2d_array<r32uint, read_write> = load %arg_0
-    %7:vec2<u32> = load %arg_1
-    %8:i32 = load %arg_2
-    %9:vec4<u32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<u32>, read_write> = var, %9
-    %11:vec4<u32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_c2d09a(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_c2d09a
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_c2d09a(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_c2d09a
-    ret
-  }
+kernel void compute_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_c2d09a(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_c2d09a
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/c378ee.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/c378ee.wgsl.expected.ir.msl
index 31eafe6..9149d66 100644
--- a/test/tint/builtins/gen/var/textureLoad/c378ee.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/c378ee.wgsl.expected.ir.msl
@@ -1,47 +1,33 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_ms<uint, access::read> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_multisampled_2d<u32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_c378ee(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  int arg_2 = 1;
+  int const v = arg_2;
+  uint4 res = tint_module_vars.arg_0.read(uint2(arg_1), v);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_c378ee = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %arg_2:ptr<function, i32, read_write> = var, 1i
-    %6:texture_multisampled_2d<u32> = load %arg_0
-    %7:vec2<i32> = load %arg_1
-    %8:i32 = load %arg_2
-    %9:vec4<u32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<u32>, read_write> = var, %9
-    %11:vec4<u32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_c378ee(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_c378ee
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_ms<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_c378ee(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_c378ee
-    ret
-  }
+kernel void compute_main(texture2d_ms<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_c378ee(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_c378ee
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_ms<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/c40dcb.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/c40dcb.wgsl.expected.ir.msl
index ea46d64..3ae8e7f 100644
--- a/test/tint/builtins/gen/var/textureLoad/c40dcb.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/c40dcb.wgsl.expected.ir.msl
@@ -1,47 +1,33 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<uint, access::read> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba32uint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_c40dcb(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  int arg_2 = 1;
+  int const v = arg_2;
+  uint4 res = tint_module_vars.arg_0.read(uint2(arg_1), v);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_c40dcb = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %arg_2:ptr<function, i32, read_write> = var, 1i
-    %6:texture_storage_2d_array<rgba32uint, read> = load %arg_0
-    %7:vec2<i32> = load %arg_1
-    %8:i32 = load %arg_2
-    %9:vec4<u32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<u32>, read_write> = var, %9
-    %11:vec4<u32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_c40dcb(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_c40dcb
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_c40dcb(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_c40dcb
-    ret
-  }
+kernel void compute_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_c40dcb(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_c40dcb
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/c456bc.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/c456bc.wgsl.expected.ir.msl
index 7634a64..7d9e15f 100644
--- a/test/tint/builtins/gen/var/textureLoad/c456bc.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/c456bc.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<r32float, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_c456bc(tint_module_vars_struct tint_module_vars) {
+  int3 arg_1 = int3(1);
+  float4 res = tint_module_vars.arg_0.read(uint3(arg_1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_c456bc = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec3<i32>, read_write> = var, vec3<i32>(1i)
-    %5:texture_storage_3d<r32float, read> = load %arg_0
-    %6:vec3<i32> = load %arg_1
-    %7:vec4<f32> = textureLoad %5, %6
-    %res:ptr<function, vec4<f32>, read_write> = var, %7
-    %9:vec4<f32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_c456bc(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_c456bc
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_c456bc(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_c456bc
-    ret
-  }
+kernel void compute_main(texture3d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_c456bc(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_c456bc
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/c5791b.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/c5791b.wgsl.expected.ir.msl
index 20e4a6c..caad821 100644
--- a/test/tint/builtins/gen/var/textureLoad/c5791b.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/c5791b.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<int, access::read> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<rgba16sint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_c5791b(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  int4 res = tint_module_vars.arg_0.read(arg_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_c5791b = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %5:texture_storage_2d<rgba16sint, read> = load %arg_0
-    %6:vec2<u32> = load %arg_1
-    %7:vec4<i32> = textureLoad %5, %6
-    %res:ptr<function, vec4<i32>, read_write> = var, %7
-    %9:vec4<i32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_c5791b(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_c5791b
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_c5791b(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_c5791b
-    ret
-  }
+kernel void compute_main(texture2d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_c5791b(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_c5791b
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/c5c86d.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/c5c86d.wgsl.expected.ir.msl
index 49fbf15..25ec2e5 100644
--- a/test/tint/builtins/gen/var/textureLoad/c5c86d.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/c5c86d.wgsl.expected.ir.msl
@@ -1,47 +1,33 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<int, access::read_write> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba16sint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_c5c86d(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  int arg_2 = 1;
+  int const v = arg_2;
+  int4 res = tint_module_vars.arg_0.read(uint2(arg_1), v);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_c5c86d = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %arg_2:ptr<function, i32, read_write> = var, 1i
-    %6:texture_storage_2d_array<rgba16sint, read_write> = load %arg_0
-    %7:vec2<i32> = load %arg_1
-    %8:i32 = load %arg_2
-    %9:vec4<i32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<i32>, read_write> = var, %9
-    %11:vec4<i32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_c5c86d(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_c5c86d
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_c5c86d(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_c5c86d
-    ret
-  }
+kernel void compute_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_c5c86d(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_c5c86d
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/c66b20.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/c66b20.wgsl.expected.ir.msl
index fad3f79..2cc59f7 100644
--- a/test/tint/builtins/gen/var/textureLoad/c66b20.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/c66b20.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<int, access::read> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<r32sint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_c66b20(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  int4 res = tint_module_vars.arg_0.read(arg_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_c66b20 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %5:texture_storage_2d<r32sint, read> = load %arg_0
-    %6:vec2<u32> = load %arg_1
-    %7:vec4<i32> = textureLoad %5, %6
-    %res:ptr<function, vec4<i32>, read_write> = var, %7
-    %9:vec4<i32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_c66b20(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_c66b20
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_c66b20(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_c66b20
-    ret
-  }
+kernel void compute_main(texture2d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_c66b20(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_c66b20
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/c7cbed.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/c7cbed.wgsl.expected.ir.msl
index b2ec05b..ebc6621 100644
--- a/test/tint/builtins/gen/var/textureLoad/c7cbed.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/c7cbed.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<r32float, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_c7cbed(tint_module_vars_struct tint_module_vars) {
+  int arg_1 = 1;
+  float4 res = tint_module_vars.arg_0.read(uint(arg_1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_c7cbed = func():void {
-  $B2: {
-    %arg_1:ptr<function, i32, read_write> = var, 1i
-    %5:texture_storage_1d<r32float, read> = load %arg_0
-    %6:i32 = load %arg_1
-    %7:vec4<f32> = textureLoad %5, %6
-    %res:ptr<function, vec4<f32>, read_write> = var, %7
-    %9:vec4<f32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_c7cbed(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_c7cbed
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_c7cbed(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_c7cbed
-    ret
-  }
+kernel void compute_main(texture1d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_c7cbed(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_c7cbed
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/c7e313.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/c7e313.wgsl.expected.ir.msl
index eabe65c..53ab6a4 100644
--- a/test/tint/builtins/gen/var/textureLoad/c7e313.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/c7e313.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<uint, access::read_write> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<rgba32uint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_c7e313(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  uint4 res = tint_module_vars.arg_0.read(arg_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_c7e313 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %5:texture_storage_2d<rgba32uint, read_write> = load %arg_0
-    %6:vec2<u32> = load %arg_1
-    %7:vec4<u32> = textureLoad %5, %6
-    %res:ptr<function, vec4<u32>, read_write> = var, %7
-    %9:vec4<u32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_c7e313(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_c7e313
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_c7e313(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_c7e313
-    ret
-  }
+kernel void compute_main(texture2d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_c7e313(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_c7e313
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/c80691.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/c80691.wgsl.expected.ir.msl
index 479441c..474b9d0 100644
--- a/test/tint/builtins/gen/var/textureLoad/c80691.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/c80691.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<int, access::read_write> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<r32sint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_c80691(tint_module_vars_struct tint_module_vars) {
+  uint arg_1 = 1u;
+  int4 res = tint_module_vars.arg_0.read(arg_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_c80691 = func():void {
-  $B2: {
-    %arg_1:ptr<function, u32, read_write> = var, 1u
-    %5:texture_storage_1d<r32sint, read_write> = load %arg_0
-    %6:u32 = load %arg_1
-    %7:vec4<i32> = textureLoad %5, %6
-    %res:ptr<function, vec4<i32>, read_write> = var, %7
-    %9:vec4<i32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_c80691(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_c80691
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_c80691(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_c80691
-    ret
-  }
+kernel void compute_main(texture1d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_c80691(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_c80691
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/c8ed19.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/c8ed19.wgsl.expected.ir.msl
index 6a6cf44..8d01307 100644
--- a/test/tint/builtins/gen/var/textureLoad/c8ed19.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/c8ed19.wgsl.expected.ir.msl
@@ -1,47 +1,32 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<uint, access::read> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rg32uint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_c8ed19(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  uint arg_2 = 1u;
+  uint4 res = tint_module_vars.arg_0.read(arg_1, arg_2);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_c8ed19 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %arg_2:ptr<function, u32, read_write> = var, 1u
-    %6:texture_storage_2d_array<rg32uint, read> = load %arg_0
-    %7:vec2<u32> = load %arg_1
-    %8:u32 = load %arg_2
-    %9:vec4<u32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<u32>, read_write> = var, %9
-    %11:vec4<u32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_c8ed19(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_c8ed19
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_c8ed19(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_c8ed19
-    ret
-  }
+kernel void compute_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_c8ed19(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_c8ed19
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/c98bf4.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/c98bf4.wgsl.expected.ir.msl
index 9d4020f..9daa0c4 100644
--- a/test/tint/builtins/gen/var/textureLoad/c98bf4.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/c98bf4.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<rgba8snorm, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_c98bf4(tint_module_vars_struct tint_module_vars) {
+  int3 arg_1 = int3(1);
+  float4 res = tint_module_vars.arg_0.read(uint3(arg_1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_c98bf4 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec3<i32>, read_write> = var, vec3<i32>(1i)
-    %5:texture_storage_3d<rgba8snorm, read_write> = load %arg_0
-    %6:vec3<i32> = load %arg_1
-    %7:vec4<f32> = textureLoad %5, %6
-    %res:ptr<function, vec4<f32>, read_write> = var, %7
-    %9:vec4<f32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_c98bf4(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_c98bf4
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_c98bf4(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_c98bf4
-    ret
-  }
+kernel void compute_main(texture3d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_c98bf4(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_c98bf4
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/c9b083.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/c9b083.wgsl.expected.ir.msl
index aedda19..93179fe 100644
--- a/test/tint/builtins/gen/var/textureLoad/c9b083.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/c9b083.wgsl.expected.ir.msl
@@ -1,47 +1,33 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<int, access::read_write> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba16sint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_c9b083(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  uint arg_2 = 1u;
+  uint const v = arg_2;
+  int4 res = tint_module_vars.arg_0.read(uint2(arg_1), v);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_c9b083 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %arg_2:ptr<function, u32, read_write> = var, 1u
-    %6:texture_storage_2d_array<rgba16sint, read_write> = load %arg_0
-    %7:vec2<i32> = load %arg_1
-    %8:u32 = load %arg_2
-    %9:vec4<i32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<i32>, read_write> = var, %9
-    %11:vec4<i32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_c9b083(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_c9b083
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_c9b083(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_c9b083
-    ret
-  }
+kernel void compute_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_c9b083(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_c9b083
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/c9cc40.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/c9cc40.wgsl.expected.ir.msl
index 5ca9499..9d2b9a7 100644
--- a/test/tint/builtins/gen/var/textureLoad/c9cc40.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/c9cc40.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<int, access::read> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<rgba8sint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_c9cc40(tint_module_vars_struct tint_module_vars) {
+  int arg_1 = 1;
+  int4 res = tint_module_vars.arg_0.read(uint(arg_1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_c9cc40 = func():void {
-  $B2: {
-    %arg_1:ptr<function, i32, read_write> = var, 1i
-    %5:texture_storage_1d<rgba8sint, read> = load %arg_0
-    %6:i32 = load %arg_1
-    %7:vec4<i32> = textureLoad %5, %6
-    %res:ptr<function, vec4<i32>, read_write> = var, %7
-    %9:vec4<i32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_c9cc40(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_c9cc40
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_c9cc40(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_c9cc40
-    ret
-  }
+kernel void compute_main(texture1d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_c9cc40(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_c9cc40
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/c9f310.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/c9f310.wgsl.expected.ir.msl
index 07f6707..a7ce53d 100644
--- a/test/tint/builtins/gen/var/textureLoad/c9f310.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/c9f310.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<int, access::read_write> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<r32sint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_c9f310(tint_module_vars_struct tint_module_vars) {
+  int arg_1 = 1;
+  int4 res = tint_module_vars.arg_0.read(uint(arg_1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_c9f310 = func():void {
-  $B2: {
-    %arg_1:ptr<function, i32, read_write> = var, 1i
-    %5:texture_storage_1d<r32sint, read_write> = load %arg_0
-    %6:i32 = load %arg_1
-    %7:vec4<i32> = textureLoad %5, %6
-    %res:ptr<function, vec4<i32>, read_write> = var, %7
-    %9:vec4<i32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_c9f310(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_c9f310
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_c9f310(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_c9f310
-    ret
-  }
+kernel void compute_main(texture1d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_c9f310(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_c9f310
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/cac876.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/cac876.wgsl.expected.ir.msl
index 559f6ce..d5283d5 100644
--- a/test/tint/builtins/gen/var/textureLoad/cac876.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/cac876.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<int, access::read_write> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<rgba32sint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_cac876(tint_module_vars_struct tint_module_vars) {
+  uint arg_1 = 1u;
+  int4 res = tint_module_vars.arg_0.read(arg_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_cac876 = func():void {
-  $B2: {
-    %arg_1:ptr<function, u32, read_write> = var, 1u
-    %5:texture_storage_1d<rgba32sint, read_write> = load %arg_0
-    %6:u32 = load %arg_1
-    %7:vec4<i32> = textureLoad %5, %6
-    %res:ptr<function, vec4<i32>, read_write> = var, %7
-    %9:vec4<i32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_cac876(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_cac876
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_cac876(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_cac876
-    ret
-  }
+kernel void compute_main(texture1d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_cac876(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_cac876
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/cad5f2.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/cad5f2.wgsl.expected.ir.msl
index 113adbf..ad493f0 100644
--- a/test/tint/builtins/gen/var/textureLoad/cad5f2.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/cad5f2.wgsl.expected.ir.msl
@@ -1,47 +1,33 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_ms<uint, access::read> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_multisampled_2d<u32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_cad5f2(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  uint arg_2 = 1u;
+  uint const v = arg_2;
+  uint4 res = tint_module_vars.arg_0.read(uint2(arg_1), v);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_cad5f2 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %arg_2:ptr<function, u32, read_write> = var, 1u
-    %6:texture_multisampled_2d<u32> = load %arg_0
-    %7:vec2<i32> = load %arg_1
-    %8:u32 = load %arg_2
-    %9:vec4<u32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<u32>, read_write> = var, %9
-    %11:vec4<u32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_cad5f2(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_cad5f2
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_ms<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_cad5f2(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_cad5f2
-    ret
-  }
+kernel void compute_main(texture2d_ms<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_cad5f2(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_cad5f2
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_ms<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/cb57c2.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/cb57c2.wgsl.expected.ir.msl
index cdb18f3..2d90e3e 100644
--- a/test/tint/builtins/gen/var/textureLoad/cb57c2.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/cb57c2.wgsl.expected.ir.msl
@@ -1,49 +1,33 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  depth2d_array<float, access::sample> arg_0;
+  device float* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_depth_2d_array, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, f32, read_write> = var @binding_point(2, 0)
+void textureLoad_cb57c2(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  uint arg_2 = 1u;
+  int arg_3 = 1;
+  float res = tint_module_vars.arg_0.read(arg_1, arg_2, arg_3);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_cb57c2 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %arg_2:ptr<function, u32, read_write> = var, 1u
-    %arg_3:ptr<function, i32, read_write> = var, 1i
-    %7:texture_depth_2d_array = load %arg_0
-    %8:vec2<u32> = load %arg_1
-    %9:u32 = load %arg_2
-    %10:i32 = load %arg_3
-    %11:f32 = textureLoad %7, %8, %9, %10
-    %res:ptr<function, f32, read_write> = var, %11
-    %13:f32 = load %res
-    store %prevent_dce, %13
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_cb57c2(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %15:void = call %textureLoad_cb57c2
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(depth2d_array<float, access::sample> arg_0 [[texture(0)]], device float* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_cb57c2(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %17:void = call %textureLoad_cb57c2
-    ret
-  }
+kernel void compute_main(depth2d_array<float, access::sample> arg_0 [[texture(0)]], device float* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_cb57c2(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %19:void = call %textureLoad_cb57c2
-    ret
-  }
+vertex vertex_main_outputs vertex_main(depth2d_array<float, access::sample> arg_0 [[texture(0)]], device float* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/cdbcf6.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/cdbcf6.wgsl.expected.ir.msl
index 5362734..c8eedcb 100644
--- a/test/tint/builtins/gen/var/textureLoad/cdbcf6.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/cdbcf6.wgsl.expected.ir.msl
@@ -1,47 +1,32 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba8snorm, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_cdbcf6(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  uint arg_2 = 1u;
+  float4 res = tint_module_vars.arg_0.read(arg_1, arg_2);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_cdbcf6 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %arg_2:ptr<function, u32, read_write> = var, 1u
-    %6:texture_storage_2d_array<rgba8snorm, read_write> = load %arg_0
-    %7:vec2<u32> = load %arg_1
-    %8:u32 = load %arg_2
-    %9:vec4<f32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<f32>, read_write> = var, %9
-    %11:vec4<f32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_cdbcf6(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_cdbcf6
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_cdbcf6(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_cdbcf6
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_cdbcf6(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_cdbcf6
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/cdccd2.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/cdccd2.wgsl.expected.ir.msl
index 1457bd5..6e8cf66 100644
--- a/test/tint/builtins/gen/var/textureLoad/cdccd2.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/cdccd2.wgsl.expected.ir.msl
@@ -1,47 +1,33 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<uint, access::read_write> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rg32uint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_cdccd2(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  uint arg_2 = 1u;
+  uint const v = arg_2;
+  uint4 res = tint_module_vars.arg_0.read(uint2(arg_1), v);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_cdccd2 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %arg_2:ptr<function, u32, read_write> = var, 1u
-    %6:texture_storage_2d_array<rg32uint, read_write> = load %arg_0
-    %7:vec2<i32> = load %arg_1
-    %8:u32 = load %arg_2
-    %9:vec4<u32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<u32>, read_write> = var, %9
-    %11:vec4<u32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_cdccd2(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_cdccd2
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_cdccd2(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_cdccd2
-    ret
-  }
+kernel void compute_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_cdccd2(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_cdccd2
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/cdd343.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/cdd343.wgsl.expected.ir.msl
index d4c19e4..d188ace 100644
--- a/test/tint/builtins/gen/var/textureLoad/cdd343.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/cdd343.wgsl.expected.ir.msl
@@ -1,47 +1,33 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<uint, access::read> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba32uint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_cdd343(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  uint arg_2 = 1u;
+  uint const v = arg_2;
+  uint4 res = tint_module_vars.arg_0.read(uint2(arg_1), v);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_cdd343 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %arg_2:ptr<function, u32, read_write> = var, 1u
-    %6:texture_storage_2d_array<rgba32uint, read> = load %arg_0
-    %7:vec2<i32> = load %arg_1
-    %8:u32 = load %arg_2
-    %9:vec4<u32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<u32>, read_write> = var, %9
-    %11:vec4<u32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_cdd343(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_cdd343
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_cdd343(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_cdd343
-    ret
-  }
+kernel void compute_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_cdd343(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_cdd343
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/cddf6b.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/cddf6b.wgsl.expected.ir.msl
index 75b807c..fc09ef5 100644
--- a/test/tint/builtins/gen/var/textureLoad/cddf6b.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/cddf6b.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<rgba8unorm, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_cddf6b(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  float4 res = tint_module_vars.arg_0.read(arg_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_cddf6b = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %5:texture_storage_2d<rgba8unorm, read_write> = load %arg_0
-    %6:vec2<u32> = load %arg_1
-    %7:vec4<f32> = textureLoad %5, %6
-    %res:ptr<function, vec4<f32>, read_write> = var, %7
-    %9:vec4<f32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_cddf6b(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_cddf6b
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_cddf6b(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_cddf6b
-    ret
-  }
+kernel void compute_main(texture2d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_cddf6b(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_cddf6b
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/cec477.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/cec477.wgsl.expected.ir.msl
index 4fcff4c..083fff8 100644
--- a/test/tint/builtins/gen/var/textureLoad/cec477.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/cec477.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<int, access::read_write> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<r32sint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_cec477(tint_module_vars_struct tint_module_vars) {
+  uint3 arg_1 = uint3(1u);
+  int4 res = tint_module_vars.arg_0.read(arg_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_cec477 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec3<u32>, read_write> = var, vec3<u32>(1u)
-    %5:texture_storage_3d<r32sint, read_write> = load %arg_0
-    %6:vec3<u32> = load %arg_1
-    %7:vec4<i32> = textureLoad %5, %6
-    %res:ptr<function, vec4<i32>, read_write> = var, %7
-    %9:vec4<i32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_cec477(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_cec477
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_cec477(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_cec477
-    ret
-  }
+kernel void compute_main(texture3d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_cec477(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_cec477
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/cece6c.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/cece6c.wgsl.expected.ir.msl
index bf7321d..aadb9c2 100644
--- a/test/tint/builtins/gen/var/textureLoad/cece6c.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/cece6c.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<r8unorm, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_cece6c(tint_module_vars_struct tint_module_vars) {
+  int3 arg_1 = int3(1);
+  float4 res = tint_module_vars.arg_0.read(uint3(arg_1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_cece6c = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec3<i32>, read_write> = var, vec3<i32>(1i)
-    %5:texture_storage_3d<r8unorm, read> = load %arg_0
-    %6:vec3<i32> = load %arg_1
-    %7:vec4<f32> = textureLoad %5, %6
-    %res:ptr<function, vec4<f32>, read_write> = var, %7
-    %9:vec4<f32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_cece6c(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_cece6c
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_cece6c(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_cece6c
-    ret
-  }
+kernel void compute_main(texture3d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_cece6c(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_cece6c
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/d02afc.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/d02afc.wgsl.expected.ir.msl
index 48435c2..593d6fb 100644
--- a/test/tint/builtins/gen/var/textureLoad/d02afc.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/d02afc.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<int, access::read> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<rgba32sint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_d02afc(tint_module_vars_struct tint_module_vars) {
+  uint3 arg_1 = uint3(1u);
+  int4 res = tint_module_vars.arg_0.read(arg_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_d02afc = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec3<u32>, read_write> = var, vec3<u32>(1u)
-    %5:texture_storage_3d<rgba32sint, read> = load %arg_0
-    %6:vec3<u32> = load %arg_1
-    %7:vec4<i32> = textureLoad %5, %6
-    %res:ptr<function, vec4<i32>, read_write> = var, %7
-    %9:vec4<i32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_d02afc(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_d02afc
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_d02afc(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_d02afc
-    ret
-  }
+kernel void compute_main(texture3d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_d02afc(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_d02afc
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/d0e351.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/d0e351.wgsl.expected.ir.msl
index aea3df2..ef6851c 100644
--- a/test/tint/builtins/gen/var/textureLoad/d0e351.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/d0e351.wgsl.expected.ir.msl
@@ -1,47 +1,32 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<uint, access::read_write> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rg32uint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_d0e351(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  int arg_2 = 1;
+  uint4 res = tint_module_vars.arg_0.read(arg_1, arg_2);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_d0e351 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %arg_2:ptr<function, i32, read_write> = var, 1i
-    %6:texture_storage_2d_array<rg32uint, read_write> = load %arg_0
-    %7:vec2<u32> = load %arg_1
-    %8:i32 = load %arg_2
-    %9:vec4<u32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<u32>, read_write> = var, %9
-    %11:vec4<u32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_d0e351(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_d0e351
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_d0e351(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_d0e351
-    ret
-  }
+kernel void compute_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_d0e351(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_d0e351
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/d357bb.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/d357bb.wgsl.expected.ir.msl
index 686e9fd..91cacdf 100644
--- a/test/tint/builtins/gen/var/textureLoad/d357bb.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/d357bb.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<bgra8unorm, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_d357bb(tint_module_vars_struct tint_module_vars) {
+  int arg_1 = 1;
+  float4 res = tint_module_vars.arg_0.read(uint(arg_1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_d357bb = func():void {
-  $B2: {
-    %arg_1:ptr<function, i32, read_write> = var, 1i
-    %5:texture_storage_1d<bgra8unorm, read> = load %arg_0
-    %6:i32 = load %arg_1
-    %7:vec4<f32> = textureLoad %5, %6
-    %res:ptr<function, vec4<f32>, read_write> = var, %7
-    %9:vec4<f32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_d357bb(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_d357bb
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_d357bb(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_d357bb
-    ret
-  }
+kernel void compute_main(texture1d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_d357bb(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_d357bb
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/d37a08.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/d37a08.wgsl.expected.ir.msl
index 27fa1fc..b51a02b 100644
--- a/test/tint/builtins/gen/var/textureLoad/d37a08.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/d37a08.wgsl.expected.ir.msl
@@ -1,47 +1,33 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<uint, access::read_write> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba8uint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_d37a08(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  uint arg_2 = 1u;
+  uint const v = arg_2;
+  uint4 res = tint_module_vars.arg_0.read(uint2(arg_1), v);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_d37a08 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %arg_2:ptr<function, u32, read_write> = var, 1u
-    %6:texture_storage_2d_array<rgba8uint, read_write> = load %arg_0
-    %7:vec2<i32> = load %arg_1
-    %8:u32 = load %arg_2
-    %9:vec4<u32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<u32>, read_write> = var, %9
-    %11:vec4<u32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_d37a08(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_d37a08
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_d37a08(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_d37a08
-    ret
-  }
+kernel void compute_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_d37a08(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_d37a08
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/d3d8fc.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/d3d8fc.wgsl.expected.ir.msl
index d60134e..c0f468f 100644
--- a/test/tint/builtins/gen/var/textureLoad/d3d8fc.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/d3d8fc.wgsl.expected.ir.msl
@@ -1,47 +1,32 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<int, access::read_write> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba16sint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_d3d8fc(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  int arg_2 = 1;
+  int4 res = tint_module_vars.arg_0.read(arg_1, arg_2);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_d3d8fc = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %arg_2:ptr<function, i32, read_write> = var, 1i
-    %6:texture_storage_2d_array<rgba16sint, read_write> = load %arg_0
-    %7:vec2<u32> = load %arg_1
-    %8:i32 = load %arg_2
-    %9:vec4<i32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<i32>, read_write> = var, %9
-    %11:vec4<i32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_d3d8fc(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_d3d8fc
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_d3d8fc(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_d3d8fc
-    ret
-  }
+kernel void compute_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_d3d8fc(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_d3d8fc
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/d41c72.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/d41c72.wgsl.expected.ir.msl
index 506b6c2..1210251 100644
--- a/test/tint/builtins/gen/var/textureLoad/d41c72.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/d41c72.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<int, access::read_write> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<rg32sint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_d41c72(tint_module_vars_struct tint_module_vars) {
+  int3 arg_1 = int3(1);
+  int4 res = tint_module_vars.arg_0.read(uint3(arg_1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_d41c72 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec3<i32>, read_write> = var, vec3<i32>(1i)
-    %5:texture_storage_3d<rg32sint, read_write> = load %arg_0
-    %6:vec3<i32> = load %arg_1
-    %7:vec4<i32> = textureLoad %5, %6
-    %res:ptr<function, vec4<i32>, read_write> = var, %7
-    %9:vec4<i32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_d41c72(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_d41c72
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_d41c72(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_d41c72
-    ret
-  }
+kernel void compute_main(texture3d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_d41c72(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_d41c72
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/d4df19.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/d4df19.wgsl.expected.ir.msl
index c28b1a9..20e95db 100644
--- a/test/tint/builtins/gen/var/textureLoad/d4df19.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/d4df19.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<uint, access::read> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<r32uint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_d4df19(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  uint4 res = tint_module_vars.arg_0.read(arg_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_d4df19 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %5:texture_storage_2d<r32uint, read> = load %arg_0
-    %6:vec2<u32> = load %arg_1
-    %7:vec4<u32> = textureLoad %5, %6
-    %res:ptr<function, vec4<u32>, read_write> = var, %7
-    %9:vec4<u32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_d4df19(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_d4df19
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_d4df19(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_d4df19
-    ret
-  }
+kernel void compute_main(texture2d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_d4df19(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_d4df19
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/d5c48d.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/d5c48d.wgsl.expected.ir.msl
index 808f810..43ef8f2 100644
--- a/test/tint/builtins/gen/var/textureLoad/d5c48d.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/d5c48d.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<rgba32float, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_d5c48d(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  float4 res = tint_module_vars.arg_0.read(uint2(arg_1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_d5c48d = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %5:texture_storage_2d<rgba32float, read> = load %arg_0
-    %6:vec2<i32> = load %arg_1
-    %7:vec4<f32> = textureLoad %5, %6
-    %res:ptr<function, vec4<f32>, read_write> = var, %7
-    %9:vec4<f32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_d5c48d(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_d5c48d
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_d5c48d(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_d5c48d
-    ret
-  }
+kernel void compute_main(texture2d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_d5c48d(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_d5c48d
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/d72de9.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/d72de9.wgsl.expected.ir.msl
index c1d3360..0545f2d 100644
--- a/test/tint/builtins/gen/var/textureLoad/d72de9.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/d72de9.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<int, access::read_write> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<rgba8sint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_d72de9(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  int4 res = tint_module_vars.arg_0.read(uint2(arg_1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_d72de9 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %5:texture_storage_2d<rgba8sint, read_write> = load %arg_0
-    %6:vec2<i32> = load %arg_1
-    %7:vec4<i32> = textureLoad %5, %6
-    %res:ptr<function, vec4<i32>, read_write> = var, %7
-    %9:vec4<i32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_d72de9(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_d72de9
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_d72de9(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_d72de9
-    ret
-  }
+kernel void compute_main(texture2d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_d72de9(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_d72de9
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/d7996a.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/d7996a.wgsl.expected.ir.msl
index cd015fb..98399b4 100644
--- a/test/tint/builtins/gen/var/textureLoad/d7996a.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/d7996a.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<int, access::read_write> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<rgba32sint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_d7996a(tint_module_vars_struct tint_module_vars) {
+  int3 arg_1 = int3(1);
+  int4 res = tint_module_vars.arg_0.read(uint3(arg_1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_d7996a = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec3<i32>, read_write> = var, vec3<i32>(1i)
-    %5:texture_storage_3d<rgba32sint, read_write> = load %arg_0
-    %6:vec3<i32> = load %arg_1
-    %7:vec4<i32> = textureLoad %5, %6
-    %res:ptr<function, vec4<i32>, read_write> = var, %7
-    %9:vec4<i32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_d7996a(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_d7996a
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_d7996a(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_d7996a
-    ret
-  }
+kernel void compute_main(texture3d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_d7996a(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_d7996a
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/d79c5c.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/d79c5c.wgsl.expected.ir.msl
index 78179ba..d186aa3 100644
--- a/test/tint/builtins/gen/var/textureLoad/d79c5c.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/d79c5c.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<uint, access::read_write> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<rgba16uint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_d79c5c(tint_module_vars_struct tint_module_vars) {
+  int arg_1 = 1;
+  uint4 res = tint_module_vars.arg_0.read(uint(arg_1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_d79c5c = func():void {
-  $B2: {
-    %arg_1:ptr<function, i32, read_write> = var, 1i
-    %5:texture_storage_1d<rgba16uint, read_write> = load %arg_0
-    %6:i32 = load %arg_1
-    %7:vec4<u32> = textureLoad %5, %6
-    %res:ptr<function, vec4<u32>, read_write> = var, %7
-    %9:vec4<u32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_d79c5c(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_d79c5c
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_d79c5c(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_d79c5c
-    ret
-  }
+kernel void compute_main(texture1d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_d79c5c(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_d79c5c
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/d80ff3.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/d80ff3.wgsl.expected.ir.msl
index f87db72..a4e7914 100644
--- a/test/tint/builtins/gen/var/textureLoad/d80ff3.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/d80ff3.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<bgra8unorm, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_d80ff3(tint_module_vars_struct tint_module_vars) {
+  int arg_1 = 1;
+  float4 res = tint_module_vars.arg_0.read(uint(arg_1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_d80ff3 = func():void {
-  $B2: {
-    %arg_1:ptr<function, i32, read_write> = var, 1i
-    %5:texture_storage_1d<bgra8unorm, read_write> = load %arg_0
-    %6:i32 = load %arg_1
-    %7:vec4<f32> = textureLoad %5, %6
-    %res:ptr<function, vec4<f32>, read_write> = var, %7
-    %9:vec4<f32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_d80ff3(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_d80ff3
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_d80ff3(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_d80ff3
-    ret
-  }
+kernel void compute_main(texture1d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_d80ff3(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_d80ff3
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/d81c57.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/d81c57.wgsl.expected.ir.msl
index 27f3156..6838982 100644
--- a/test/tint/builtins/gen/var/textureLoad/d81c57.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/d81c57.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<rg32float, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_d81c57(tint_module_vars_struct tint_module_vars) {
+  int arg_1 = 1;
+  float4 res = tint_module_vars.arg_0.read(uint(arg_1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_d81c57 = func():void {
-  $B2: {
-    %arg_1:ptr<function, i32, read_write> = var, 1i
-    %5:texture_storage_1d<rg32float, read> = load %arg_0
-    %6:i32 = load %arg_1
-    %7:vec4<f32> = textureLoad %5, %6
-    %res:ptr<function, vec4<f32>, read_write> = var, %7
-    %9:vec4<f32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_d81c57(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_d81c57
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_d81c57(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_d81c57
-    ret
-  }
+kernel void compute_main(texture1d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_d81c57(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_d81c57
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/d85d61.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/d85d61.wgsl.expected.ir.msl
index fa8e6d4..1226560 100644
--- a/test/tint/builtins/gen/var/textureLoad/d85d61.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/d85d61.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<uint, access::read> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<rgba32uint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_d85d61(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  uint4 res = tint_module_vars.arg_0.read(arg_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_d85d61 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %5:texture_storage_2d<rgba32uint, read> = load %arg_0
-    %6:vec2<u32> = load %arg_1
-    %7:vec4<u32> = textureLoad %5, %6
-    %res:ptr<function, vec4<u32>, read_write> = var, %7
-    %9:vec4<u32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_d85d61(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_d85d61
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_d85d61(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_d85d61
-    ret
-  }
+kernel void compute_main(texture2d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_d85d61(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_d85d61
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/d8617f.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/d8617f.wgsl.expected.ir.msl
index 1d9e51f..8a9f622 100644
--- a/test/tint/builtins/gen/var/textureLoad/d8617f.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/d8617f.wgsl.expected.ir.msl
@@ -1,47 +1,33 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<int, access::read> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rg32sint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_d8617f(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  int arg_2 = 1;
+  int const v = arg_2;
+  int4 res = tint_module_vars.arg_0.read(uint2(arg_1), v);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_d8617f = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %arg_2:ptr<function, i32, read_write> = var, 1i
-    %6:texture_storage_2d_array<rg32sint, read> = load %arg_0
-    %7:vec2<i32> = load %arg_1
-    %8:i32 = load %arg_2
-    %9:vec4<i32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<i32>, read_write> = var, %9
-    %11:vec4<i32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_d8617f(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_d8617f
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_d8617f(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_d8617f
-    ret
-  }
+kernel void compute_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_d8617f(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_d8617f
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/d8be5a.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/d8be5a.wgsl.expected.ir.msl
index 485bfca..e1bf0b0 100644
--- a/test/tint/builtins/gen/var/textureLoad/d8be5a.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/d8be5a.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<int, access::read_write> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<rgba16sint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_d8be5a(tint_module_vars_struct tint_module_vars) {
+  int arg_1 = 1;
+  int4 res = tint_module_vars.arg_0.read(uint(arg_1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_d8be5a = func():void {
-  $B2: {
-    %arg_1:ptr<function, i32, read_write> = var, 1i
-    %5:texture_storage_1d<rgba16sint, read_write> = load %arg_0
-    %6:i32 = load %arg_1
-    %7:vec4<i32> = textureLoad %5, %6
-    %res:ptr<function, vec4<i32>, read_write> = var, %7
-    %9:vec4<i32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_d8be5a(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_d8be5a
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_d8be5a(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_d8be5a
-    ret
-  }
+kernel void compute_main(texture1d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_d8be5a(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_d8be5a
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/d91f37.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/d91f37.wgsl.expected.ir.msl
index 962c4ae..f42d091 100644
--- a/test/tint/builtins/gen/var/textureLoad/d91f37.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/d91f37.wgsl.expected.ir.msl
@@ -1,47 +1,33 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba8unorm, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_d91f37(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  uint arg_2 = 1u;
+  uint const v = arg_2;
+  float4 res = tint_module_vars.arg_0.read(uint2(arg_1), v);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_d91f37 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %arg_2:ptr<function, u32, read_write> = var, 1u
-    %6:texture_storage_2d_array<rgba8unorm, read_write> = load %arg_0
-    %7:vec2<i32> = load %arg_1
-    %8:u32 = load %arg_2
-    %9:vec4<f32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<f32>, read_write> = var, %9
-    %11:vec4<f32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_d91f37(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_d91f37
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_d91f37(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_d91f37
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_d91f37(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_d91f37
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/dab04f.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/dab04f.wgsl.expected.ir.msl
index 6c4e9b7..75bbe6f 100644
--- a/test/tint/builtins/gen/var/textureLoad/dab04f.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/dab04f.wgsl.expected.ir.msl
@@ -1,47 +1,33 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<bgra8unorm, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_dab04f(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  int arg_2 = 1;
+  int const v = arg_2;
+  float4 res = tint_module_vars.arg_0.read(uint2(arg_1), v);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_dab04f = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %arg_2:ptr<function, i32, read_write> = var, 1i
-    %6:texture_storage_2d_array<bgra8unorm, read_write> = load %arg_0
-    %7:vec2<i32> = load %arg_1
-    %8:i32 = load %arg_2
-    %9:vec4<f32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<f32>, read_write> = var, %9
-    %11:vec4<f32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_dab04f(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_dab04f
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_dab04f(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_dab04f
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_dab04f(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_dab04f
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/dbd554.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/dbd554.wgsl.expected.ir.msl
index fce81ec..7a6356d 100644
--- a/test/tint/builtins/gen/var/textureLoad/dbd554.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/dbd554.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<int, access::read> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<rgba32sint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_dbd554(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  int4 res = tint_module_vars.arg_0.read(uint2(arg_1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_dbd554 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %5:texture_storage_2d<rgba32sint, read> = load %arg_0
-    %6:vec2<i32> = load %arg_1
-    %7:vec4<i32> = textureLoad %5, %6
-    %res:ptr<function, vec4<i32>, read_write> = var, %7
-    %9:vec4<i32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_dbd554(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_dbd554
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_dbd554(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_dbd554
-    ret
-  }
+kernel void compute_main(texture2d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_dbd554(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_dbd554
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/dd5859.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/dd5859.wgsl.expected.ir.msl
index 9e694b4..8ae5139 100644
--- a/test/tint/builtins/gen/var/textureLoad/dd5859.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/dd5859.wgsl.expected.ir.msl
@@ -1,47 +1,33 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba16float, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_dd5859(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  int arg_2 = 1;
+  int const v = arg_2;
+  float4 res = tint_module_vars.arg_0.read(uint2(arg_1), v);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_dd5859 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %arg_2:ptr<function, i32, read_write> = var, 1i
-    %6:texture_storage_2d_array<rgba16float, read_write> = load %arg_0
-    %7:vec2<i32> = load %arg_1
-    %8:i32 = load %arg_2
-    %9:vec4<f32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<f32>, read_write> = var, %9
-    %11:vec4<f32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_dd5859(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_dd5859
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_dd5859(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_dd5859
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_dd5859(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_dd5859
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/dd8776.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/dd8776.wgsl.expected.ir.msl
index 7a702b8..46dba0c 100644
--- a/test/tint/builtins/gen/var/textureLoad/dd8776.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/dd8776.wgsl.expected.ir.msl
@@ -1,47 +1,32 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rg32float, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_dd8776(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  uint arg_2 = 1u;
+  float4 res = tint_module_vars.arg_0.read(arg_1, arg_2);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_dd8776 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %arg_2:ptr<function, u32, read_write> = var, 1u
-    %6:texture_storage_2d_array<rg32float, read> = load %arg_0
-    %7:vec2<u32> = load %arg_1
-    %8:u32 = load %arg_2
-    %9:vec4<f32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<f32>, read_write> = var, %9
-    %11:vec4<f32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_dd8776(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_dd8776
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_dd8776(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_dd8776
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_dd8776(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_dd8776
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/ddeed3.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/ddeed3.wgsl.expected.ir.msl
index 6fd3ed8..cd01f71 100644
--- a/test/tint/builtins/gen/var/textureLoad/ddeed3.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/ddeed3.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<int, access::read> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<rgba32sint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_ddeed3(tint_module_vars_struct tint_module_vars) {
+  int arg_1 = 1;
+  int4 res = tint_module_vars.arg_0.read(uint(arg_1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_ddeed3 = func():void {
-  $B2: {
-    %arg_1:ptr<function, i32, read_write> = var, 1i
-    %5:texture_storage_1d<rgba32sint, read> = load %arg_0
-    %6:i32 = load %arg_1
-    %7:vec4<i32> = textureLoad %5, %6
-    %res:ptr<function, vec4<i32>, read_write> = var, %7
-    %9:vec4<i32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_ddeed3(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_ddeed3
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_ddeed3(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_ddeed3
-    ret
-  }
+kernel void compute_main(texture1d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_ddeed3(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_ddeed3
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/de5a0e.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/de5a0e.wgsl.expected.ir.msl
index b51169f..6e256d8 100644
--- a/test/tint/builtins/gen/var/textureLoad/de5a0e.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/de5a0e.wgsl.expected.ir.msl
@@ -1,47 +1,32 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<int, access::read_write> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba8sint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_de5a0e(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  uint arg_2 = 1u;
+  int4 res = tint_module_vars.arg_0.read(arg_1, arg_2);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_de5a0e = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %arg_2:ptr<function, u32, read_write> = var, 1u
-    %6:texture_storage_2d_array<rgba8sint, read_write> = load %arg_0
-    %7:vec2<u32> = load %arg_1
-    %8:u32 = load %arg_2
-    %9:vec4<i32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<i32>, read_write> = var, %9
-    %11:vec4<i32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_de5a0e(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_de5a0e
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_de5a0e(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_de5a0e
-    ret
-  }
+kernel void compute_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_de5a0e(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_de5a0e
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/dee8e7.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/dee8e7.wgsl.expected.ir.msl
index f387280..cd55542 100644
--- a/test/tint/builtins/gen/var/textureLoad/dee8e7.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/dee8e7.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<int, access::read> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<rgba8sint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_dee8e7(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  int4 res = tint_module_vars.arg_0.read(uint2(arg_1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_dee8e7 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %5:texture_storage_2d<rgba8sint, read> = load %arg_0
-    %6:vec2<i32> = load %arg_1
-    %7:vec4<i32> = textureLoad %5, %6
-    %res:ptr<function, vec4<i32>, read_write> = var, %7
-    %9:vec4<i32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_dee8e7(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_dee8e7
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_dee8e7(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_dee8e7
-    ret
-  }
+kernel void compute_main(texture2d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_dee8e7(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_dee8e7
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/defd9a.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/defd9a.wgsl.expected.ir.msl
index caa579a..d18f7c5 100644
--- a/test/tint/builtins/gen/var/textureLoad/defd9a.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/defd9a.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<rg32float, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_defd9a(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  float4 res = tint_module_vars.arg_0.read(uint2(arg_1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_defd9a = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %5:texture_storage_2d<rg32float, read_write> = load %arg_0
-    %6:vec2<i32> = load %arg_1
-    %7:vec4<f32> = textureLoad %5, %6
-    %res:ptr<function, vec4<f32>, read_write> = var, %7
-    %9:vec4<f32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_defd9a(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_defd9a
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_defd9a(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_defd9a
-    ret
-  }
+kernel void compute_main(texture2d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_defd9a(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_defd9a
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/dfdf3b.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/dfdf3b.wgsl.expected.ir.msl
index 03f3405..20cbfde 100644
--- a/test/tint/builtins/gen/var/textureLoad/dfdf3b.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/dfdf3b.wgsl.expected.ir.msl
@@ -1,47 +1,32 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<int, access::read> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba8sint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_dfdf3b(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  uint arg_2 = 1u;
+  int4 res = tint_module_vars.arg_0.read(arg_1, arg_2);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_dfdf3b = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %arg_2:ptr<function, u32, read_write> = var, 1u
-    %6:texture_storage_2d_array<rgba8sint, read> = load %arg_0
-    %7:vec2<u32> = load %arg_1
-    %8:u32 = load %arg_2
-    %9:vec4<i32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<i32>, read_write> = var, %9
-    %11:vec4<i32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_dfdf3b(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_dfdf3b
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_dfdf3b(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_dfdf3b
-    ret
-  }
+kernel void compute_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_dfdf3b(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_dfdf3b
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/e1c3cf.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/e1c3cf.wgsl.expected.ir.msl
index ef26697..f6302d5 100644
--- a/test/tint/builtins/gen/var/textureLoad/e1c3cf.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/e1c3cf.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<rgba16float, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_e1c3cf(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  float4 res = tint_module_vars.arg_0.read(uint2(arg_1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_e1c3cf = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %5:texture_storage_2d<rgba16float, read_write> = load %arg_0
-    %6:vec2<i32> = load %arg_1
-    %7:vec4<f32> = textureLoad %5, %6
-    %res:ptr<function, vec4<f32>, read_write> = var, %7
-    %9:vec4<f32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_e1c3cf(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_e1c3cf
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_e1c3cf(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_e1c3cf
-    ret
-  }
+kernel void compute_main(texture2d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_e1c3cf(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_e1c3cf
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/e2292f.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/e2292f.wgsl.expected.ir.msl
index 5573478..7d1f321 100644
--- a/test/tint/builtins/gen/var/textureLoad/e2292f.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/e2292f.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<int, access::read> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<r32sint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_e2292f(tint_module_vars_struct tint_module_vars) {
+  uint arg_1 = 1u;
+  int4 res = tint_module_vars.arg_0.read(arg_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_e2292f = func():void {
-  $B2: {
-    %arg_1:ptr<function, u32, read_write> = var, 1u
-    %5:texture_storage_1d<r32sint, read> = load %arg_0
-    %6:u32 = load %arg_1
-    %7:vec4<i32> = textureLoad %5, %6
-    %res:ptr<function, vec4<i32>, read_write> = var, %7
-    %9:vec4<i32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_e2292f(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_e2292f
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_e2292f(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_e2292f
-    ret
-  }
+kernel void compute_main(texture1d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_e2292f(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_e2292f
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/e2b3a1.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/e2b3a1.wgsl.expected.ir.msl
index fa62d98..db54157 100644
--- a/test/tint/builtins/gen/var/textureLoad/e2b3a1.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/e2b3a1.wgsl.expected.ir.msl
@@ -1,47 +1,32 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<int, access::read_write> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rg32sint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_e2b3a1(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  int arg_2 = 1;
+  int4 res = tint_module_vars.arg_0.read(arg_1, arg_2);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_e2b3a1 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %arg_2:ptr<function, i32, read_write> = var, 1i
-    %6:texture_storage_2d_array<rg32sint, read_write> = load %arg_0
-    %7:vec2<u32> = load %arg_1
-    %8:i32 = load %arg_2
-    %9:vec4<i32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<i32>, read_write> = var, %9
-    %11:vec4<i32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_e2b3a1(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_e2b3a1
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_e2b3a1(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_e2b3a1
-    ret
-  }
+kernel void compute_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_e2b3a1(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_e2b3a1
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/e2d7da.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/e2d7da.wgsl.expected.ir.msl
index 9e4dd89..469a5a8 100644
--- a/test/tint/builtins/gen/var/textureLoad/e2d7da.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/e2d7da.wgsl.expected.ir.msl
@@ -1,47 +1,32 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba16float, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_e2d7da(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  int arg_2 = 1;
+  float4 res = tint_module_vars.arg_0.read(arg_1, arg_2);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_e2d7da = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %arg_2:ptr<function, i32, read_write> = var, 1i
-    %6:texture_storage_2d_array<rgba16float, read_write> = load %arg_0
-    %7:vec2<u32> = load %arg_1
-    %8:i32 = load %arg_2
-    %9:vec4<f32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<f32>, read_write> = var, %9
-    %11:vec4<f32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_e2d7da(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_e2d7da
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_e2d7da(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_e2d7da
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_e2d7da(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_e2d7da
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/e33285.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/e33285.wgsl.expected.ir.msl
index e700e9d..dc1f4c3 100644
--- a/test/tint/builtins/gen/var/textureLoad/e33285.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/e33285.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<int, access::read_write> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<rgba16sint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_e33285(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  int4 res = tint_module_vars.arg_0.read(uint2(arg_1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_e33285 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %5:texture_storage_2d<rgba16sint, read_write> = load %arg_0
-    %6:vec2<i32> = load %arg_1
-    %7:vec4<i32> = textureLoad %5, %6
-    %res:ptr<function, vec4<i32>, read_write> = var, %7
-    %9:vec4<i32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_e33285(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_e33285
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_e33285(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_e33285
-    ret
-  }
+kernel void compute_main(texture2d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_e33285(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_e33285
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/e35f72.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/e35f72.wgsl.expected.ir.msl
index e2865b4..722bb53 100644
--- a/test/tint/builtins/gen/var/textureLoad/e35f72.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/e35f72.wgsl.expected.ir.msl
@@ -1,47 +1,33 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<int, access::sample> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_3d<i32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_e35f72(tint_module_vars_struct tint_module_vars) {
+  int3 arg_1 = int3(1);
+  uint arg_2 = 1u;
+  uint const v = arg_2;
+  int4 res = tint_module_vars.arg_0.read(uint3(arg_1), v);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_e35f72 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec3<i32>, read_write> = var, vec3<i32>(1i)
-    %arg_2:ptr<function, u32, read_write> = var, 1u
-    %6:texture_3d<i32> = load %arg_0
-    %7:vec3<i32> = load %arg_1
-    %8:u32 = load %arg_2
-    %9:vec4<i32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<i32>, read_write> = var, %9
-    %11:vec4<i32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_e35f72(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_e35f72
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_e35f72(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_e35f72
-    ret
-  }
+kernel void compute_main(texture3d<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_e35f72(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_e35f72
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/e3b08b.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/e3b08b.wgsl.expected.ir.msl
index 4bc276f..2f79950 100644
--- a/test/tint/builtins/gen/var/textureLoad/e3b08b.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/e3b08b.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<r32float, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_e3b08b(tint_module_vars_struct tint_module_vars) {
+  uint3 arg_1 = uint3(1u);
+  float4 res = tint_module_vars.arg_0.read(arg_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_e3b08b = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec3<u32>, read_write> = var, vec3<u32>(1u)
-    %5:texture_storage_3d<r32float, read> = load %arg_0
-    %6:vec3<u32> = load %arg_1
-    %7:vec4<f32> = textureLoad %5, %6
-    %res:ptr<function, vec4<f32>, read_write> = var, %7
-    %9:vec4<f32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_e3b08b(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_e3b08b
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_e3b08b(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_e3b08b
-    ret
-  }
+kernel void compute_main(texture3d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_e3b08b(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_e3b08b
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/e3d2cc.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/e3d2cc.wgsl.expected.ir.msl
index 401481a..6bd11eb 100644
--- a/test/tint/builtins/gen/var/textureLoad/e3d2cc.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/e3d2cc.wgsl.expected.ir.msl
@@ -1,47 +1,33 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_ms<int, access::read> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_multisampled_2d<i32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_e3d2cc(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  int arg_2 = 1;
+  int const v = arg_2;
+  int4 res = tint_module_vars.arg_0.read(uint2(arg_1), v);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_e3d2cc = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %arg_2:ptr<function, i32, read_write> = var, 1i
-    %6:texture_multisampled_2d<i32> = load %arg_0
-    %7:vec2<i32> = load %arg_1
-    %8:i32 = load %arg_2
-    %9:vec4<i32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<i32>, read_write> = var, %9
-    %11:vec4<i32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_e3d2cc(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_e3d2cc
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_ms<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_e3d2cc(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_e3d2cc
-    ret
-  }
+kernel void compute_main(texture2d_ms<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_e3d2cc(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_e3d2cc
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_ms<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/e4051a.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/e4051a.wgsl.expected.ir.msl
index 8ae583b..b1c945e 100644
--- a/test/tint/builtins/gen/var/textureLoad/e4051a.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/e4051a.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<r8unorm, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_e4051a(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  float4 res = tint_module_vars.arg_0.read(arg_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_e4051a = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %5:texture_storage_2d<r8unorm, read_write> = load %arg_0
-    %6:vec2<u32> = load %arg_1
-    %7:vec4<f32> = textureLoad %5, %6
-    %res:ptr<function, vec4<f32>, read_write> = var, %7
-    %9:vec4<f32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_e4051a(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_e4051a
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_e4051a(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_e4051a
-    ret
-  }
+kernel void compute_main(texture2d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_e4051a(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_e4051a
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/e57e92.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/e57e92.wgsl.expected.ir.msl
index 048eb9c..b71aec8 100644
--- a/test/tint/builtins/gen/var/textureLoad/e57e92.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/e57e92.wgsl.expected.ir.msl
@@ -1,47 +1,32 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<bgra8unorm, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_e57e92(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  int arg_2 = 1;
+  float4 res = tint_module_vars.arg_0.read(arg_1, arg_2);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_e57e92 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %arg_2:ptr<function, i32, read_write> = var, 1i
-    %6:texture_storage_2d_array<bgra8unorm, read> = load %arg_0
-    %7:vec2<u32> = load %arg_1
-    %8:i32 = load %arg_2
-    %9:vec4<f32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<f32>, read_write> = var, %9
-    %11:vec4<f32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_e57e92(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_e57e92
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_e57e92(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_e57e92
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_e57e92(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_e57e92
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/e59fdf.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/e59fdf.wgsl.expected.ir.msl
index a5ed438..d901837 100644
--- a/test/tint/builtins/gen/var/textureLoad/e59fdf.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/e59fdf.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<uint, access::read> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<rg32uint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_e59fdf(tint_module_vars_struct tint_module_vars) {
+  uint3 arg_1 = uint3(1u);
+  uint4 res = tint_module_vars.arg_0.read(arg_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_e59fdf = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec3<u32>, read_write> = var, vec3<u32>(1u)
-    %5:texture_storage_3d<rg32uint, read> = load %arg_0
-    %6:vec3<u32> = load %arg_1
-    %7:vec4<u32> = textureLoad %5, %6
-    %res:ptr<function, vec4<u32>, read_write> = var, %7
-    %9:vec4<u32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_e59fdf(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_e59fdf
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_e59fdf(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_e59fdf
-    ret
-  }
+kernel void compute_main(texture3d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_e59fdf(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_e59fdf
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/e65916.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/e65916.wgsl.expected.ir.msl
index 234d806..9ece114 100644
--- a/test/tint/builtins/gen/var/textureLoad/e65916.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/e65916.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<int, access::read> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<rg32sint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_e65916(tint_module_vars_struct tint_module_vars) {
+  int3 arg_1 = int3(1);
+  int4 res = tint_module_vars.arg_0.read(uint3(arg_1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_e65916 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec3<i32>, read_write> = var, vec3<i32>(1i)
-    %5:texture_storage_3d<rg32sint, read> = load %arg_0
-    %6:vec3<i32> = load %arg_1
-    %7:vec4<i32> = textureLoad %5, %6
-    %res:ptr<function, vec4<i32>, read_write> = var, %7
-    %9:vec4<i32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_e65916(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_e65916
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_e65916(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_e65916
-    ret
-  }
+kernel void compute_main(texture3d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_e65916(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_e65916
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/e893d7.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/e893d7.wgsl.expected.ir.msl
index bfdda0a..a3b53fa 100644
--- a/test/tint/builtins/gen/var/textureLoad/e893d7.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/e893d7.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<rgba16float, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_e893d7(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  float4 res = tint_module_vars.arg_0.read(uint2(arg_1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_e893d7 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %5:texture_storage_2d<rgba16float, read> = load %arg_0
-    %6:vec2<i32> = load %arg_1
-    %7:vec4<f32> = textureLoad %5, %6
-    %res:ptr<function, vec4<f32>, read_write> = var, %7
-    %9:vec4<f32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_e893d7(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_e893d7
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_e893d7(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_e893d7
-    ret
-  }
+kernel void compute_main(texture2d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_e893d7(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_e893d7
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/e92dd0.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/e92dd0.wgsl.expected.ir.msl
index a892000..a98cdd7 100644
--- a/test/tint/builtins/gen/var/textureLoad/e92dd0.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/e92dd0.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<rgba8unorm, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_e92dd0(tint_module_vars_struct tint_module_vars) {
+  uint arg_1 = 1u;
+  float4 res = tint_module_vars.arg_0.read(arg_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_e92dd0 = func():void {
-  $B2: {
-    %arg_1:ptr<function, u32, read_write> = var, 1u
-    %5:texture_storage_1d<rgba8unorm, read> = load %arg_0
-    %6:u32 = load %arg_1
-    %7:vec4<f32> = textureLoad %5, %6
-    %res:ptr<function, vec4<f32>, read_write> = var, %7
-    %9:vec4<f32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_e92dd0(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_e92dd0
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_e92dd0(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_e92dd0
-    ret
-  }
+kernel void compute_main(texture1d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_e92dd0(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_e92dd0
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/e9eb65.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/e9eb65.wgsl.expected.ir.msl
index 472db5b..921e0a2 100644
--- a/test/tint/builtins/gen/var/textureLoad/e9eb65.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/e9eb65.wgsl.expected.ir.msl
@@ -1,47 +1,32 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<uint, access::read_write> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba16uint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_e9eb65(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  int arg_2 = 1;
+  uint4 res = tint_module_vars.arg_0.read(arg_1, arg_2);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_e9eb65 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %arg_2:ptr<function, i32, read_write> = var, 1i
-    %6:texture_storage_2d_array<rgba16uint, read_write> = load %arg_0
-    %7:vec2<u32> = load %arg_1
-    %8:i32 = load %arg_2
-    %9:vec4<u32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<u32>, read_write> = var, %9
-    %11:vec4<u32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_e9eb65(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_e9eb65
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_e9eb65(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_e9eb65
-    ret
-  }
+kernel void compute_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_e9eb65(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_e9eb65
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/ea2abd.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/ea2abd.wgsl.expected.ir.msl
index c2670fc..657c7c2 100644
--- a/test/tint/builtins/gen/var/textureLoad/ea2abd.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/ea2abd.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<rgba32float, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_ea2abd(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  float4 res = tint_module_vars.arg_0.read(arg_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_ea2abd = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %5:texture_storage_2d<rgba32float, read> = load %arg_0
-    %6:vec2<u32> = load %arg_1
-    %7:vec4<f32> = textureLoad %5, %6
-    %res:ptr<function, vec4<f32>, read_write> = var, %7
-    %9:vec4<f32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_ea2abd(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_ea2abd
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_ea2abd(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_ea2abd
-    ret
-  }
+kernel void compute_main(texture2d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_ea2abd(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_ea2abd
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/eb573b.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/eb573b.wgsl.expected.ir.msl
index e7347a7..8d387b8 100644
--- a/test/tint/builtins/gen/var/textureLoad/eb573b.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/eb573b.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<int, access::read> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<r32sint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_eb573b(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  int4 res = tint_module_vars.arg_0.read(uint2(arg_1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_eb573b = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %5:texture_storage_2d<r32sint, read> = load %arg_0
-    %6:vec2<i32> = load %arg_1
-    %7:vec4<i32> = textureLoad %5, %6
-    %res:ptr<function, vec4<i32>, read_write> = var, %7
-    %9:vec4<i32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_eb573b(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_eb573b
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_eb573b(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_eb573b
-    ret
-  }
+kernel void compute_main(texture2d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_eb573b(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_eb573b
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/ebfb92.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/ebfb92.wgsl.expected.ir.msl
index cf516cb..79fd247 100644
--- a/test/tint/builtins/gen/var/textureLoad/ebfb92.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/ebfb92.wgsl.expected.ir.msl
@@ -1,47 +1,33 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<uint, access::sample> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_2d<u32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_ebfb92(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  uint arg_2 = 1u;
+  uint const v = arg_2;
+  uint4 res = tint_module_vars.arg_0.read(uint2(arg_1), v);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_ebfb92 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %arg_2:ptr<function, u32, read_write> = var, 1u
-    %6:texture_2d<u32> = load %arg_0
-    %7:vec2<i32> = load %arg_1
-    %8:u32 = load %arg_2
-    %9:vec4<u32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<u32>, read_write> = var, %9
-    %11:vec4<u32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_ebfb92(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_ebfb92
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_ebfb92(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_ebfb92
-    ret
-  }
+kernel void compute_main(texture2d<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_ebfb92(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_ebfb92
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<uint, access::sample> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/ecc823.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/ecc823.wgsl.expected.ir.msl
index c849d86..e66d848 100644
--- a/test/tint/builtins/gen/var/textureLoad/ecc823.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/ecc823.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<uint, access::read> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<rgba16uint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_ecc823(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  uint4 res = tint_module_vars.arg_0.read(uint2(arg_1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_ecc823 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %5:texture_storage_2d<rgba16uint, read> = load %arg_0
-    %6:vec2<i32> = load %arg_1
-    %7:vec4<u32> = textureLoad %5, %6
-    %res:ptr<function, vec4<u32>, read_write> = var, %7
-    %9:vec4<u32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_ecc823(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_ecc823
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_ecc823(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_ecc823
-    ret
-  }
+kernel void compute_main(texture2d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_ecc823(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_ecc823
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/ed55a8.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/ed55a8.wgsl.expected.ir.msl
index 2385f1d..743832e 100644
--- a/test/tint/builtins/gen/var/textureLoad/ed55a8.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/ed55a8.wgsl.expected.ir.msl
@@ -1,47 +1,33 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<int, access::read_write> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rg32sint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_ed55a8(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  uint arg_2 = 1u;
+  uint const v = arg_2;
+  int4 res = tint_module_vars.arg_0.read(uint2(arg_1), v);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_ed55a8 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %arg_2:ptr<function, u32, read_write> = var, 1u
-    %6:texture_storage_2d_array<rg32sint, read_write> = load %arg_0
-    %7:vec2<i32> = load %arg_1
-    %8:u32 = load %arg_2
-    %9:vec4<i32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<i32>, read_write> = var, %9
-    %11:vec4<i32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_ed55a8(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_ed55a8
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_ed55a8(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_ed55a8
-    ret
-  }
+kernel void compute_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_ed55a8(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_ed55a8
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/ee33c5.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/ee33c5.wgsl.expected.ir.msl
index 0957634..5922dd8 100644
--- a/test/tint/builtins/gen/var/textureLoad/ee33c5.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/ee33c5.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<int, access::read> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<rgba16sint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_ee33c5(tint_module_vars_struct tint_module_vars) {
+  uint3 arg_1 = uint3(1u);
+  int4 res = tint_module_vars.arg_0.read(arg_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_ee33c5 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec3<u32>, read_write> = var, vec3<u32>(1u)
-    %5:texture_storage_3d<rgba16sint, read> = load %arg_0
-    %6:vec3<u32> = load %arg_1
-    %7:vec4<i32> = textureLoad %5, %6
-    %res:ptr<function, vec4<i32>, read_write> = var, %7
-    %9:vec4<i32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_ee33c5(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_ee33c5
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_ee33c5(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_ee33c5
-    ret
-  }
+kernel void compute_main(texture3d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_ee33c5(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_ee33c5
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/eecf7d.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/eecf7d.wgsl.expected.ir.msl
index c98de05..2c03762 100644
--- a/test/tint/builtins/gen/var/textureLoad/eecf7d.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/eecf7d.wgsl.expected.ir.msl
@@ -1,47 +1,33 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<uint, access::read> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rg32uint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_eecf7d(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  uint arg_2 = 1u;
+  uint const v = arg_2;
+  uint4 res = tint_module_vars.arg_0.read(uint2(arg_1), v);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_eecf7d = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %arg_2:ptr<function, u32, read_write> = var, 1u
-    %6:texture_storage_2d_array<rg32uint, read> = load %arg_0
-    %7:vec2<i32> = load %arg_1
-    %8:u32 = load %arg_2
-    %9:vec4<u32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<u32>, read_write> = var, %9
-    %11:vec4<u32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_eecf7d(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_eecf7d
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_eecf7d(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_eecf7d
-    ret
-  }
+kernel void compute_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_eecf7d(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_eecf7d
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/ef2ec3.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/ef2ec3.wgsl.expected.ir.msl
index b706fca..599666c 100644
--- a/test/tint/builtins/gen/var/textureLoad/ef2ec3.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/ef2ec3.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<int, access::read_write> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<rg32sint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_ef2ec3(tint_module_vars_struct tint_module_vars) {
+  uint arg_1 = 1u;
+  int4 res = tint_module_vars.arg_0.read(arg_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_ef2ec3 = func():void {
-  $B2: {
-    %arg_1:ptr<function, u32, read_write> = var, 1u
-    %5:texture_storage_1d<rg32sint, read_write> = load %arg_0
-    %6:u32 = load %arg_1
-    %7:vec4<i32> = textureLoad %5, %6
-    %res:ptr<function, vec4<i32>, read_write> = var, %7
-    %9:vec4<i32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_ef2ec3(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_ef2ec3
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_ef2ec3(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_ef2ec3
-    ret
-  }
+kernel void compute_main(texture1d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_ef2ec3(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_ef2ec3
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/ef5405.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/ef5405.wgsl.expected.ir.msl
index bfedc28..995cee0 100644
--- a/test/tint/builtins/gen/var/textureLoad/ef5405.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/ef5405.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<uint, access::read> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<rg32uint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_ef5405(tint_module_vars_struct tint_module_vars) {
+  int3 arg_1 = int3(1);
+  uint4 res = tint_module_vars.arg_0.read(uint3(arg_1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_ef5405 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec3<i32>, read_write> = var, vec3<i32>(1i)
-    %5:texture_storage_3d<rg32uint, read> = load %arg_0
-    %6:vec3<i32> = load %arg_1
-    %7:vec4<u32> = textureLoad %5, %6
-    %res:ptr<function, vec4<u32>, read_write> = var, %7
-    %9:vec4<u32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_ef5405(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_ef5405
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_ef5405(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_ef5405
-    ret
-  }
+kernel void compute_main(texture3d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_ef5405(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_ef5405
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/efa787.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/efa787.wgsl.expected.ir.msl
index 72c600f..fb5e2e6 100644
--- a/test/tint/builtins/gen/var/textureLoad/efa787.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/efa787.wgsl.expected.ir.msl
@@ -1,47 +1,32 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba8unorm, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_efa787(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  uint arg_2 = 1u;
+  float4 res = tint_module_vars.arg_0.read(arg_1, arg_2);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_efa787 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %arg_2:ptr<function, u32, read_write> = var, 1u
-    %6:texture_storage_2d_array<rgba8unorm, read> = load %arg_0
-    %7:vec2<u32> = load %arg_1
-    %8:u32 = load %arg_2
-    %9:vec4<f32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<f32>, read_write> = var, %9
-    %11:vec4<f32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_efa787(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_efa787
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_efa787(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_efa787
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_efa787(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_efa787
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/f0514a.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/f0514a.wgsl.expected.ir.msl
index c72eb33..f9949b0 100644
--- a/test/tint/builtins/gen/var/textureLoad/f0514a.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/f0514a.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<rgba32float, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_f0514a(tint_module_vars_struct tint_module_vars) {
+  int arg_1 = 1;
+  float4 res = tint_module_vars.arg_0.read(uint(arg_1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_f0514a = func():void {
-  $B2: {
-    %arg_1:ptr<function, i32, read_write> = var, 1i
-    %5:texture_storage_1d<rgba32float, read_write> = load %arg_0
-    %6:i32 = load %arg_1
-    %7:vec4<f32> = textureLoad %5, %6
-    %res:ptr<function, vec4<f32>, read_write> = var, %7
-    %9:vec4<f32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_f0514a(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_f0514a
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_f0514a(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_f0514a
-    ret
-  }
+kernel void compute_main(texture1d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_f0514a(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_f0514a
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/f06b69.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/f06b69.wgsl.expected.ir.msl
index d13fdab..008a9ee 100644
--- a/test/tint/builtins/gen/var/textureLoad/f06b69.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/f06b69.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<int, access::read> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<r32sint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_f06b69(tint_module_vars_struct tint_module_vars) {
+  int arg_1 = 1;
+  int4 res = tint_module_vars.arg_0.read(uint(arg_1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_f06b69 = func():void {
-  $B2: {
-    %arg_1:ptr<function, i32, read_write> = var, 1i
-    %5:texture_storage_1d<r32sint, read> = load %arg_0
-    %6:i32 = load %arg_1
-    %7:vec4<i32> = textureLoad %5, %6
-    %res:ptr<function, vec4<i32>, read_write> = var, %7
-    %9:vec4<i32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_f06b69(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_f06b69
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_f06b69(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_f06b69
-    ret
-  }
+kernel void compute_main(texture1d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_f06b69(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_f06b69
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/f0abad.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/f0abad.wgsl.expected.ir.msl
index ff4e4bb..4412830 100644
--- a/test/tint/builtins/gen/var/textureLoad/f0abad.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/f0abad.wgsl.expected.ir.msl
@@ -1,47 +1,32 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_ms<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_multisampled_2d<f32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_f0abad(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  int arg_2 = 1;
+  float4 res = tint_module_vars.arg_0.read(arg_1, arg_2);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_f0abad = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %arg_2:ptr<function, i32, read_write> = var, 1i
-    %6:texture_multisampled_2d<f32> = load %arg_0
-    %7:vec2<u32> = load %arg_1
-    %8:i32 = load %arg_2
-    %9:vec4<f32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<f32>, read_write> = var, %9
-    %11:vec4<f32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_f0abad(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_f0abad
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_ms<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_f0abad(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_f0abad
-    ret
-  }
+kernel void compute_main(texture2d_ms<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_f0abad(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_f0abad
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_ms<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/f1c549.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/f1c549.wgsl.expected.ir.msl
index ff63ef5..847392c 100644
--- a/test/tint/builtins/gen/var/textureLoad/f1c549.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/f1c549.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<r32float, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_f1c549(tint_module_vars_struct tint_module_vars) {
+  int3 arg_1 = int3(1);
+  float4 res = tint_module_vars.arg_0.read(uint3(arg_1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_f1c549 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec3<i32>, read_write> = var, vec3<i32>(1i)
-    %5:texture_storage_3d<r32float, read_write> = load %arg_0
-    %6:vec3<i32> = load %arg_1
-    %7:vec4<f32> = textureLoad %5, %6
-    %res:ptr<function, vec4<f32>, read_write> = var, %7
-    %9:vec4<f32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_f1c549(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_f1c549
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_f1c549(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_f1c549
-    ret
-  }
+kernel void compute_main(texture3d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_f1c549(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_f1c549
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/f2a7ff.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/f2a7ff.wgsl.expected.ir.msl
index 96a5ccb..bba2d97 100644
--- a/test/tint/builtins/gen/var/textureLoad/f2a7ff.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/f2a7ff.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<rgba8unorm, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_f2a7ff(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  float4 res = tint_module_vars.arg_0.read(arg_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_f2a7ff = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %5:texture_storage_2d<rgba8unorm, read> = load %arg_0
-    %6:vec2<u32> = load %arg_1
-    %7:vec4<f32> = textureLoad %5, %6
-    %res:ptr<function, vec4<f32>, read_write> = var, %7
-    %9:vec4<f32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_f2a7ff(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_f2a7ff
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_f2a7ff(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_f2a7ff
-    ret
-  }
+kernel void compute_main(texture2d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_f2a7ff(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_f2a7ff
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/f2bdd4.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/f2bdd4.wgsl.expected.ir.msl
index 1d01b14..715e34c 100644
--- a/test/tint/builtins/gen/var/textureLoad/f2bdd4.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/f2bdd4.wgsl.expected.ir.msl
@@ -1,47 +1,32 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<r8unorm, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_f2bdd4(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  uint arg_2 = 1u;
+  float4 res = tint_module_vars.arg_0.read(arg_1, arg_2);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_f2bdd4 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %arg_2:ptr<function, u32, read_write> = var, 1u
-    %6:texture_storage_2d_array<r8unorm, read_write> = load %arg_0
-    %7:vec2<u32> = load %arg_1
-    %8:u32 = load %arg_2
-    %9:vec4<f32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<f32>, read_write> = var, %9
-    %11:vec4<f32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_f2bdd4(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_f2bdd4
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_f2bdd4(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_f2bdd4
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_f2bdd4(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_f2bdd4
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/f2c311.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/f2c311.wgsl.expected.ir.msl
index 07381d1..f77f839 100644
--- a/test/tint/builtins/gen/var/textureLoad/f2c311.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/f2c311.wgsl.expected.ir.msl
@@ -1,47 +1,33 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<int, access::read_write> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba8sint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_f2c311(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  int arg_2 = 1;
+  int const v = arg_2;
+  int4 res = tint_module_vars.arg_0.read(uint2(arg_1), v);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_f2c311 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %arg_2:ptr<function, i32, read_write> = var, 1i
-    %6:texture_storage_2d_array<rgba8sint, read_write> = load %arg_0
-    %7:vec2<i32> = load %arg_1
-    %8:i32 = load %arg_2
-    %9:vec4<i32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<i32>, read_write> = var, %9
-    %11:vec4<i32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_f2c311(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_f2c311
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_f2c311(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_f2c311
-    ret
-  }
+kernel void compute_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_f2c311(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_f2c311
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/f348d9.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/f348d9.wgsl.expected.ir.msl
index 8493181..edacaab 100644
--- a/test/tint/builtins/gen/var/textureLoad/f348d9.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/f348d9.wgsl.expected.ir.msl
@@ -1,49 +1,33 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::sample> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_2d_array<f32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_f348d9(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  uint arg_2 = 1u;
+  int arg_3 = 1;
+  float4 res = tint_module_vars.arg_0.read(arg_1, arg_2, arg_3);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_f348d9 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %arg_2:ptr<function, u32, read_write> = var, 1u
-    %arg_3:ptr<function, i32, read_write> = var, 1i
-    %7:texture_2d_array<f32> = load %arg_0
-    %8:vec2<u32> = load %arg_1
-    %9:u32 = load %arg_2
-    %10:i32 = load %arg_3
-    %11:vec4<f32> = textureLoad %7, %8, %9, %10
-    %res:ptr<function, vec4<f32>, read_write> = var, %11
-    %13:vec4<f32> = load %res
-    store %prevent_dce, %13
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_f348d9(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %15:void = call %textureLoad_f348d9
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_f348d9(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %17:void = call %textureLoad_f348d9
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_f348d9(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %19:void = call %textureLoad_f348d9
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::sample> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/f35ac7.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/f35ac7.wgsl.expected.ir.msl
index 87d6a3a..f0ad678 100644
--- a/test/tint/builtins/gen/var/textureLoad/f35ac7.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/f35ac7.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<int, access::read> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<rgba8sint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_f35ac7(tint_module_vars_struct tint_module_vars) {
+  uint arg_1 = 1u;
+  int4 res = tint_module_vars.arg_0.read(arg_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_f35ac7 = func():void {
-  $B2: {
-    %arg_1:ptr<function, u32, read_write> = var, 1u
-    %5:texture_storage_1d<rgba8sint, read> = load %arg_0
-    %6:u32 = load %arg_1
-    %7:vec4<i32> = textureLoad %5, %6
-    %res:ptr<function, vec4<i32>, read_write> = var, %7
-    %9:vec4<i32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_f35ac7(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_f35ac7
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_f35ac7(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_f35ac7
-    ret
-  }
+kernel void compute_main(texture1d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_f35ac7(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_f35ac7
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/f379e2.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/f379e2.wgsl.expected.ir.msl
index d44374f..b8a7715 100644
--- a/test/tint/builtins/gen/var/textureLoad/f379e2.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/f379e2.wgsl.expected.ir.msl
@@ -1,47 +1,33 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba8unorm, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_f379e2(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  int arg_2 = 1;
+  int const v = arg_2;
+  float4 res = tint_module_vars.arg_0.read(uint2(arg_1), v);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_f379e2 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %arg_2:ptr<function, i32, read_write> = var, 1i
-    %6:texture_storage_2d_array<rgba8unorm, read> = load %arg_0
-    %7:vec2<i32> = load %arg_1
-    %8:i32 = load %arg_2
-    %9:vec4<f32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<f32>, read_write> = var, %9
-    %11:vec4<f32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_f379e2(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_f379e2
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_f379e2(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_f379e2
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_f379e2(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_f379e2
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/f56e6f.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/f56e6f.wgsl.expected.ir.msl
index bb5a4f4..a2788b0 100644
--- a/test/tint/builtins/gen/var/textureLoad/f56e6f.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/f56e6f.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<uint, access::read> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<rgba16uint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_f56e6f(tint_module_vars_struct tint_module_vars) {
+  int3 arg_1 = int3(1);
+  uint4 res = tint_module_vars.arg_0.read(uint3(arg_1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_f56e6f = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec3<i32>, read_write> = var, vec3<i32>(1i)
-    %5:texture_storage_3d<rgba16uint, read> = load %arg_0
-    %6:vec3<i32> = load %arg_1
-    %7:vec4<u32> = textureLoad %5, %6
-    %res:ptr<function, vec4<u32>, read_write> = var, %7
-    %9:vec4<u32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_f56e6f(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_f56e6f
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_f56e6f(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_f56e6f
-    ret
-  }
+kernel void compute_main(texture3d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_f56e6f(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_f56e6f
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/f5aee2.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/f5aee2.wgsl.expected.ir.msl
index 1fcd15f..0ed991a 100644
--- a/test/tint/builtins/gen/var/textureLoad/f5aee2.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/f5aee2.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<r8unorm, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_f5aee2(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  float4 res = tint_module_vars.arg_0.read(arg_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_f5aee2 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %5:texture_storage_2d<r8unorm, read> = load %arg_0
-    %6:vec2<u32> = load %arg_1
-    %7:vec4<f32> = textureLoad %5, %6
-    %res:ptr<function, vec4<f32>, read_write> = var, %7
-    %9:vec4<f32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_f5aee2(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_f5aee2
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_f5aee2(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_f5aee2
-    ret
-  }
+kernel void compute_main(texture2d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_f5aee2(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_f5aee2
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/f5fbc6.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/f5fbc6.wgsl.expected.ir.msl
index 847d2f6..9ec5cec 100644
--- a/test/tint/builtins/gen/var/textureLoad/f5fbc6.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/f5fbc6.wgsl.expected.ir.msl
@@ -1,47 +1,33 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba8snorm, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_f5fbc6(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  int arg_2 = 1;
+  int const v = arg_2;
+  float4 res = tint_module_vars.arg_0.read(uint2(arg_1), v);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_f5fbc6 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %arg_2:ptr<function, i32, read_write> = var, 1i
-    %6:texture_storage_2d_array<rgba8snorm, read_write> = load %arg_0
-    %7:vec2<i32> = load %arg_1
-    %8:i32 = load %arg_2
-    %9:vec4<f32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<f32>, read_write> = var, %9
-    %11:vec4<f32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_f5fbc6(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_f5fbc6
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_f5fbc6(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_f5fbc6
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_f5fbc6(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_f5fbc6
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/f74bd8.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/f74bd8.wgsl.expected.ir.msl
index c0379c2..9d1b3cc 100644
--- a/test/tint/builtins/gen/var/textureLoad/f74bd8.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/f74bd8.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<rg32float, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_f74bd8(tint_module_vars_struct tint_module_vars) {
+  int3 arg_1 = int3(1);
+  float4 res = tint_module_vars.arg_0.read(uint3(arg_1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_f74bd8 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec3<i32>, read_write> = var, vec3<i32>(1i)
-    %5:texture_storage_3d<rg32float, read> = load %arg_0
-    %6:vec3<i32> = load %arg_1
-    %7:vec4<f32> = textureLoad %5, %6
-    %res:ptr<function, vec4<f32>, read_write> = var, %7
-    %9:vec4<f32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_f74bd8(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_f74bd8
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_f74bd8(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_f74bd8
-    ret
-  }
+kernel void compute_main(texture3d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_f74bd8(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_f74bd8
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/f7f3bc.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/f7f3bc.wgsl.expected.ir.msl
index 95bb81d..5cd620a 100644
--- a/test/tint/builtins/gen/var/textureLoad/f7f3bc.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/f7f3bc.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<rgba8snorm, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_f7f3bc(tint_module_vars_struct tint_module_vars) {
+  int arg_1 = 1;
+  float4 res = tint_module_vars.arg_0.read(uint(arg_1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_f7f3bc = func():void {
-  $B2: {
-    %arg_1:ptr<function, i32, read_write> = var, 1i
-    %5:texture_storage_1d<rgba8snorm, read_write> = load %arg_0
-    %6:i32 = load %arg_1
-    %7:vec4<f32> = textureLoad %5, %6
-    %res:ptr<function, vec4<f32>, read_write> = var, %7
-    %9:vec4<f32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_f7f3bc(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_f7f3bc
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_f7f3bc(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_f7f3bc
-    ret
-  }
+kernel void compute_main(texture1d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_f7f3bc(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_f7f3bc
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/f7f936.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/f7f936.wgsl.expected.ir.msl
index 538e6e7..a11390f 100644
--- a/test/tint/builtins/gen/var/textureLoad/f7f936.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/f7f936.wgsl.expected.ir.msl
@@ -1,47 +1,32 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba8snorm, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_f7f936(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  uint arg_2 = 1u;
+  float4 res = tint_module_vars.arg_0.read(arg_1, arg_2);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_f7f936 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %arg_2:ptr<function, u32, read_write> = var, 1u
-    %6:texture_storage_2d_array<rgba8snorm, read> = load %arg_0
-    %7:vec2<u32> = load %arg_1
-    %8:u32 = load %arg_2
-    %9:vec4<f32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<f32>, read_write> = var, %9
-    %11:vec4<f32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_f7f936(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_f7f936
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_f7f936(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_f7f936
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_f7f936(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_f7f936
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/f81792.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/f81792.wgsl.expected.ir.msl
index cea8440..777e0ab 100644
--- a/test/tint/builtins/gen/var/textureLoad/f81792.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/f81792.wgsl.expected.ir.msl
@@ -1,47 +1,33 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<r32float, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_f81792(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  int arg_2 = 1;
+  int const v = arg_2;
+  float4 res = tint_module_vars.arg_0.read(uint2(arg_1), v);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_f81792 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %arg_2:ptr<function, i32, read_write> = var, 1i
-    %6:texture_storage_2d_array<r32float, read_write> = load %arg_0
-    %7:vec2<i32> = load %arg_1
-    %8:i32 = load %arg_2
-    %9:vec4<f32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<f32>, read_write> = var, %9
-    %11:vec4<f32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_f81792(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_f81792
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_f81792(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_f81792
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_f81792(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_f81792
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/f82eb2.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/f82eb2.wgsl.expected.ir.msl
index 66f2493..eb0a6b9 100644
--- a/test/tint/builtins/gen/var/textureLoad/f82eb2.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/f82eb2.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<rgba32float, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_f82eb2(tint_module_vars_struct tint_module_vars) {
+  uint arg_1 = 1u;
+  float4 res = tint_module_vars.arg_0.read(arg_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_f82eb2 = func():void {
-  $B2: {
-    %arg_1:ptr<function, u32, read_write> = var, 1u
-    %5:texture_storage_1d<rgba32float, read_write> = load %arg_0
-    %6:u32 = load %arg_1
-    %7:vec4<f32> = textureLoad %5, %6
-    %res:ptr<function, vec4<f32>, read_write> = var, %7
-    %9:vec4<f32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_f82eb2(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_f82eb2
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_f82eb2(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_f82eb2
-    ret
-  }
+kernel void compute_main(texture1d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_f82eb2(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_f82eb2
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/f85291.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/f85291.wgsl.expected.ir.msl
index 78bff90..e4aeed9 100644
--- a/test/tint/builtins/gen/var/textureLoad/f85291.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/f85291.wgsl.expected.ir.msl
@@ -1,47 +1,33 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<int, access::sample> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_2d<i32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_f85291(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  uint arg_2 = 1u;
+  uint const v = arg_2;
+  int4 res = tint_module_vars.arg_0.read(uint2(arg_1), v);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_f85291 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %arg_2:ptr<function, u32, read_write> = var, 1u
-    %6:texture_2d<i32> = load %arg_0
-    %7:vec2<i32> = load %arg_1
-    %8:u32 = load %arg_2
-    %9:vec4<i32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<i32>, read_write> = var, %9
-    %11:vec4<i32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_f85291(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_f85291
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_f85291(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_f85291
-    ret
-  }
+kernel void compute_main(texture2d<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_f85291(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_f85291
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<int, access::sample> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/f8a2e8.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/f8a2e8.wgsl.expected.ir.msl
index 10129f1..6f7a947 100644
--- a/test/tint/builtins/gen/var/textureLoad/f8a2e8.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/f8a2e8.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<bgra8unorm, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_f8a2e8(tint_module_vars_struct tint_module_vars) {
+  int3 arg_1 = int3(1);
+  float4 res = tint_module_vars.arg_0.read(uint3(arg_1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_f8a2e8 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec3<i32>, read_write> = var, vec3<i32>(1i)
-    %5:texture_storage_3d<bgra8unorm, read> = load %arg_0
-    %6:vec3<i32> = load %arg_1
-    %7:vec4<f32> = textureLoad %5, %6
-    %res:ptr<function, vec4<f32>, read_write> = var, %7
-    %9:vec4<f32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_f8a2e8(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_f8a2e8
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_f8a2e8(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_f8a2e8
-    ret
-  }
+kernel void compute_main(texture3d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_f8a2e8(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_f8a2e8
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/f92c2d.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/f92c2d.wgsl.expected.ir.msl
index d847959..93aefc8 100644
--- a/test/tint/builtins/gen/var/textureLoad/f92c2d.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/f92c2d.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<r32float, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_f92c2d(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  float4 res = tint_module_vars.arg_0.read(uint2(arg_1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_f92c2d = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %5:texture_storage_2d<r32float, read_write> = load %arg_0
-    %6:vec2<i32> = load %arg_1
-    %7:vec4<f32> = textureLoad %5, %6
-    %res:ptr<function, vec4<f32>, read_write> = var, %7
-    %9:vec4<f32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_f92c2d(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_f92c2d
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_f92c2d(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_f92c2d
-    ret
-  }
+kernel void compute_main(texture2d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_f92c2d(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_f92c2d
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/f9eaaf.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/f9eaaf.wgsl.expected.ir.msl
index 4a754b3..b616ef2 100644
--- a/test/tint/builtins/gen/var/textureLoad/f9eaaf.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/f9eaaf.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<int, access::read> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<rgba16sint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_f9eaaf(tint_module_vars_struct tint_module_vars) {
+  uint arg_1 = 1u;
+  int4 res = tint_module_vars.arg_0.read(arg_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_f9eaaf = func():void {
-  $B2: {
-    %arg_1:ptr<function, u32, read_write> = var, 1u
-    %5:texture_storage_1d<rgba16sint, read> = load %arg_0
-    %6:u32 = load %arg_1
-    %7:vec4<i32> = textureLoad %5, %6
-    %res:ptr<function, vec4<i32>, read_write> = var, %7
-    %9:vec4<i32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_f9eaaf(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_f9eaaf
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_f9eaaf(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_f9eaaf
-    ret
-  }
+kernel void compute_main(texture1d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_f9eaaf(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_f9eaaf
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/fc47ff.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/fc47ff.wgsl.expected.ir.msl
index a9928a8..4999266 100644
--- a/test/tint/builtins/gen/var/textureLoad/fc47ff.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/fc47ff.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<int, access::read_write> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<rgba8sint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_fc47ff(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  int4 res = tint_module_vars.arg_0.read(arg_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_fc47ff = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %5:texture_storage_2d<rgba8sint, read_write> = load %arg_0
-    %6:vec2<u32> = load %arg_1
-    %7:vec4<i32> = textureLoad %5, %6
-    %res:ptr<function, vec4<i32>, read_write> = var, %7
-    %9:vec4<i32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_fc47ff(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_fc47ff
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_fc47ff(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_fc47ff
-    ret
-  }
+kernel void compute_main(texture2d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_fc47ff(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_fc47ff
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<int, access::read_write> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/fc6d36.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/fc6d36.wgsl.expected.ir.msl
index c9c8500..5d1ed75 100644
--- a/test/tint/builtins/gen/var/textureLoad/fc6d36.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/fc6d36.wgsl.expected.ir.msl
@@ -1,47 +1,33 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<int, access::read> arg_0;
+  device int4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba16sint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<i32>, read_write> = var @binding_point(2, 0)
+void textureLoad_fc6d36(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  int arg_2 = 1;
+  int const v = arg_2;
+  int4 res = tint_module_vars.arg_0.read(uint2(arg_1), v);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_fc6d36 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %arg_2:ptr<function, i32, read_write> = var, 1i
-    %6:texture_storage_2d_array<rgba16sint, read> = load %arg_0
-    %7:vec2<i32> = load %arg_1
-    %8:i32 = load %arg_2
-    %9:vec4<i32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<i32>, read_write> = var, %9
-    %11:vec4<i32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_fc6d36(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_fc6d36
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_fc6d36(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_fc6d36
-    ret
-  }
+kernel void compute_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_fc6d36(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_fc6d36
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<int, access::read> arg_0 [[texture(0)]], device int4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/fcd23d.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/fcd23d.wgsl.expected.ir.msl
index 3a75af4..07debf5 100644
--- a/test/tint/builtins/gen/var/textureLoad/fcd23d.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/fcd23d.wgsl.expected.ir.msl
@@ -1,47 +1,32 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  depth2d_ms<float, access::read> arg_0;
+  device float* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_depth_multisampled_2d, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, f32, read_write> = var @binding_point(2, 0)
+void textureLoad_fcd23d(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  int arg_2 = 1;
+  float res = tint_module_vars.arg_0.read(arg_1, arg_2);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_fcd23d = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %arg_2:ptr<function, i32, read_write> = var, 1i
-    %6:texture_depth_multisampled_2d = load %arg_0
-    %7:vec2<u32> = load %arg_1
-    %8:i32 = load %arg_2
-    %9:f32 = textureLoad %6, %7, %8
-    %res:ptr<function, f32, read_write> = var, %9
-    %11:f32 = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_fcd23d(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_fcd23d
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(depth2d_ms<float, access::read> arg_0 [[texture(0)]], device float* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_fcd23d(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_fcd23d
-    ret
-  }
+kernel void compute_main(depth2d_ms<float, access::read> arg_0 [[texture(0)]], device float* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_fcd23d(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_fcd23d
-    ret
-  }
+vertex vertex_main_outputs vertex_main(depth2d_ms<float, access::read> arg_0 [[texture(0)]], device float* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/fd6442.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/fd6442.wgsl.expected.ir.msl
index 07459d5..3514ae4 100644
--- a/test/tint/builtins/gen/var/textureLoad/fd6442.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/fd6442.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<uint, access::read> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d<rgba8uint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_fd6442(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  uint4 res = tint_module_vars.arg_0.read(arg_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_fd6442 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %5:texture_storage_2d<rgba8uint, read> = load %arg_0
-    %6:vec2<u32> = load %arg_1
-    %7:vec4<u32> = textureLoad %5, %6
-    %res:ptr<function, vec4<u32>, read_write> = var, %7
-    %9:vec4<u32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_fd6442(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_fd6442
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_fd6442(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_fd6442
-    ret
-  }
+kernel void compute_main(texture2d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_fd6442(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_fd6442
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/fd9606.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/fd9606.wgsl.expected.ir.msl
index c3aaff8..f4cae85 100644
--- a/test/tint/builtins/gen/var/textureLoad/fd9606.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/fd9606.wgsl.expected.ir.msl
@@ -1,47 +1,32 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<float, access::read_write> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba8snorm, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_fd9606(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  int arg_2 = 1;
+  float4 res = tint_module_vars.arg_0.read(arg_1, arg_2);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_fd9606 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %arg_2:ptr<function, i32, read_write> = var, 1i
-    %6:texture_storage_2d_array<rgba8snorm, read_write> = load %arg_0
-    %7:vec2<u32> = load %arg_1
-    %8:i32 = load %arg_2
-    %9:vec4<f32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<f32>, read_write> = var, %9
-    %11:vec4<f32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_fd9606(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_fd9606
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_fd9606(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_fd9606
-    ret
-  }
+kernel void compute_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_fd9606(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_fd9606
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/fdebd0.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/fdebd0.wgsl.expected.ir.msl
index 5050a7c..0c719d9 100644
--- a/test/tint/builtins/gen/var/textureLoad/fdebd0.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/fdebd0.wgsl.expected.ir.msl
@@ -1,47 +1,33 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<uint, access::read> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba8uint, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_fdebd0(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  int arg_2 = 1;
+  int const v = arg_2;
+  uint4 res = tint_module_vars.arg_0.read(uint2(arg_1), v);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_fdebd0 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %arg_2:ptr<function, i32, read_write> = var, 1i
-    %6:texture_storage_2d_array<rgba8uint, read> = load %arg_0
-    %7:vec2<i32> = load %arg_1
-    %8:i32 = load %arg_2
-    %9:vec4<u32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<u32>, read_write> = var, %9
-    %11:vec4<u32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_fdebd0(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_fdebd0
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_fdebd0(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_fdebd0
-    ret
-  }
+kernel void compute_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_fdebd0(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_fdebd0
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/fe0565.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/fe0565.wgsl.expected.ir.msl
index 498b3f5..dc2ae7c 100644
--- a/test/tint/builtins/gen/var/textureLoad/fe0565.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/fe0565.wgsl.expected.ir.msl
@@ -1,47 +1,32 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_ms<uint, access::read> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_multisampled_2d<u32>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_fe0565(tint_module_vars_struct tint_module_vars) {
+  uint2 arg_1 = uint2(1u);
+  int arg_2 = 1;
+  uint4 res = tint_module_vars.arg_0.read(arg_1, arg_2);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_fe0565 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<u32>, read_write> = var, vec2<u32>(1u)
-    %arg_2:ptr<function, i32, read_write> = var, 1i
-    %6:texture_multisampled_2d<u32> = load %arg_0
-    %7:vec2<u32> = load %arg_1
-    %8:i32 = load %arg_2
-    %9:vec4<u32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<u32>, read_write> = var, %9
-    %11:vec4<u32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_fe0565(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_fe0565
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_ms<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_fe0565(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_fe0565
-    ret
-  }
+kernel void compute_main(texture2d_ms<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_fe0565(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_fe0565
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_ms<uint, access::read> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/fe222a.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/fe222a.wgsl.expected.ir.msl
index 11b2e44..0f78556 100644
--- a/test/tint/builtins/gen/var/textureLoad/fe222a.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/fe222a.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture1d<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_1d<rgba8snorm, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_fe222a(tint_module_vars_struct tint_module_vars) {
+  int arg_1 = 1;
+  float4 res = tint_module_vars.arg_0.read(uint(arg_1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_fe222a = func():void {
-  $B2: {
-    %arg_1:ptr<function, i32, read_write> = var, 1i
-    %5:texture_storage_1d<rgba8snorm, read> = load %arg_0
-    %6:i32 = load %arg_1
-    %7:vec4<f32> = textureLoad %5, %6
-    %res:ptr<function, vec4<f32>, read_write> = var, %7
-    %9:vec4<f32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_fe222a(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_fe222a
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture1d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_fe222a(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_fe222a
-    ret
-  }
+kernel void compute_main(texture1d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_fe222a(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_fe222a
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture1d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/fe2c1b.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/fe2c1b.wgsl.expected.ir.msl
index e9a98c6..80da2ed 100644
--- a/test/tint/builtins/gen/var/textureLoad/fe2c1b.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/fe2c1b.wgsl.expected.ir.msl
@@ -1,47 +1,33 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d_array<uint, access::read_write> arg_0;
+  device uint4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:1164 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_2d_array<rgba32uint, read_write>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<u32>, read_write> = var @binding_point(2, 0)
+void textureLoad_fe2c1b(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  uint arg_2 = 1u;
+  uint const v = arg_2;
+  uint4 res = tint_module_vars.arg_0.read(uint2(arg_1), v);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_fe2c1b = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %arg_2:ptr<function, u32, read_write> = var, 1u
-    %6:texture_storage_2d_array<rgba32uint, read_write> = load %arg_0
-    %7:vec2<i32> = load %arg_1
-    %8:u32 = load %arg_2
-    %9:vec4<u32> = textureLoad %6, %7, %8
-    %res:ptr<function, vec4<u32>, read_write> = var, %9
-    %11:vec4<u32> = load %res
-    store %prevent_dce, %11
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_fe2c1b(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %13:void = call %textureLoad_fe2c1b
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_fe2c1b(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %15:void = call %textureLoad_fe2c1b
-    ret
-  }
+kernel void compute_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_fe2c1b(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %17:void = call %textureLoad_fe2c1b
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture2d_array<uint, access::read_write> arg_0 [[texture(0)]], device uint4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-invalid access control for storage texture
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/feab99.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/feab99.wgsl.expected.ir.msl
index ba0c9ec..3aa006b 100644
--- a/test/tint/builtins/gen/var/textureLoad/feab99.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/feab99.wgsl.expected.ir.msl
@@ -1,45 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture3d<float, access::read> arg_0;
+  device float4* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_storage_3d<rgba16float, read>, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, vec4<f32>, read_write> = var @binding_point(2, 0)
+void textureLoad_feab99(tint_module_vars_struct tint_module_vars) {
+  int3 arg_1 = int3(1);
+  float4 res = tint_module_vars.arg_0.read(uint3(arg_1));
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_feab99 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec3<i32>, read_write> = var, vec3<i32>(1i)
-    %5:texture_storage_3d<rgba16float, read> = load %arg_0
-    %6:vec3<i32> = load %arg_1
-    %7:vec4<f32> = textureLoad %5, %6
-    %res:ptr<function, vec4<f32>, read_write> = var, %7
-    %9:vec4<f32> = load %res
-    store %prevent_dce, %9
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_feab99(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %11:void = call %textureLoad_feab99
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(texture3d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_feab99(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %13:void = call %textureLoad_feab99
-    ret
-  }
+kernel void compute_main(texture3d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_feab99(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %15:void = call %textureLoad_feab99
-    ret
-  }
+vertex vertex_main_outputs vertex_main(texture3d<float, access::read> arg_0 [[texture(0)]], device float4* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/gen/var/textureLoad/ff1119.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureLoad/ff1119.wgsl.expected.ir.msl
index 33a7cfe..9a55c4b 100644
--- a/test/tint/builtins/gen/var/textureLoad/ff1119.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureLoad/ff1119.wgsl.expected.ir.msl
@@ -1,49 +1,35 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  depth2d_array<float, access::sample> arg_0;
+  device float* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %arg_0:ptr<handle, texture_depth_2d_array, read> = var @binding_point(1, 0)
-  %prevent_dce:ptr<storage, f32, read_write> = var @binding_point(2, 0)
+void textureLoad_ff1119(tint_module_vars_struct tint_module_vars) {
+  int2 arg_1 = int2(1);
+  int arg_2 = 1;
+  uint arg_3 = 1u;
+  int const v = arg_2;
+  uint const v_1 = arg_3;
+  float res = tint_module_vars.arg_0.read(uint2(arg_1), v, v_1);
+  (*tint_module_vars.prevent_dce) = res;
 }
-
-%textureLoad_ff1119 = func():void {
-  $B2: {
-    %arg_1:ptr<function, vec2<i32>, read_write> = var, vec2<i32>(1i)
-    %arg_2:ptr<function, i32, read_write> = var, 1i
-    %arg_3:ptr<function, u32, read_write> = var, 1u
-    %7:texture_depth_2d_array = load %arg_0
-    %8:vec2<i32> = load %arg_1
-    %9:i32 = load %arg_2
-    %10:u32 = load %arg_3
-    %11:f32 = textureLoad %7, %8, %9, %10
-    %res:ptr<function, f32, read_write> = var, %11
-    %13:f32 = load %res
-    store %prevent_dce, %13
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  textureLoad_ff1119(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %15:void = call %textureLoad_ff1119
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(depth2d_array<float, access::sample> arg_0 [[texture(0)]], device float* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_ff1119(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %17:void = call %textureLoad_ff1119
-    ret
-  }
+kernel void compute_main(depth2d_array<float, access::sample> arg_0 [[texture(0)]], device float* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  textureLoad_ff1119(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %19:void = call %textureLoad_ff1119
-    ret
-  }
+vertex vertex_main_outputs vertex_main(depth2d_array<float, access::sample> arg_0 [[texture(0)]], device float* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0, .prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/builtins/textureLoad/texture_param.wgsl.expected.ir.msl b/test/tint/builtins/textureLoad/texture_param.wgsl.expected.ir.msl
index ee65b2d..f188cf9 100644
--- a/test/tint/builtins/textureLoad/texture_param.wgsl.expected.ir.msl
+++ b/test/tint/builtins/textureLoad/texture_param.wgsl.expected.ir.msl
@@ -1,9 +1,31 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  texture2d<int, access::sample> arg_0;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol_1 [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:924 internal compiler error: TINT_UNREACHABLE unhandled: textureLoad
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
+int4 textureLoad2d(texture2d<int, access::sample> tint_symbol, int2 coords, int level) {
+  return tint_symbol.read(uint2(coords), level);
+}
+void doTextureLoad(tint_module_vars_struct tint_module_vars) {
+  int4 res = textureLoad2d(tint_module_vars.arg_0, int2(0), 0);
+}
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  doTextureLoad(tint_module_vars);
+  return float4(0.0f);
+}
+fragment void fragment_main(texture2d<int, access::sample> arg_0 [[texture(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0};
+  doTextureLoad(tint_module_vars);
+}
+kernel void compute_main(texture2d<int, access::sample> arg_0 [[texture(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0};
+  doTextureLoad(tint_module_vars);
+}
+vertex vertex_main_outputs vertex_main(texture2d<int, access::sample> arg_0 [[texture(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0};
+  return vertex_main_outputs{.tint_symbol_1=vertex_main_inner(tint_module_vars)};
+}
diff --git a/test/tint/unittest/reader/spirv/ImageFetch_DepthMultisampled_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.ir.msl b/test/tint/unittest/reader/spirv/ImageFetch_DepthMultisampled_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.ir.msl
deleted file mode 100644
index ee65b2d..0000000
--- a/test/tint/unittest/reader/spirv/ImageFetch_DepthMultisampled_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.ir.msl
+++ /dev/null
@@ -1,9 +0,0 @@
-SKIP: FAILED
-
-../../src/tint/lang/msl/writer/printer/printer.cc:924 internal compiler error: TINT_UNREACHABLE unhandled: textureLoad
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/unittest/reader/spirv/ImageFetch_Depth_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.ir.msl b/test/tint/unittest/reader/spirv/ImageFetch_Depth_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.ir.msl
deleted file mode 100644
index ee65b2d..0000000
--- a/test/tint/unittest/reader/spirv/ImageFetch_Depth_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.ir.msl
+++ /dev/null
@@ -1,9 +0,0 @@
-SKIP: FAILED
-
-../../src/tint/lang/msl/writer/printer/printer.cc:924 internal compiler error: TINT_UNREACHABLE unhandled: textureLoad
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/unittest/reader/spirv/ImageFetch_Multisampled_ConvertSampleOperand_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.ir.msl b/test/tint/unittest/reader/spirv/ImageFetch_Multisampled_ConvertSampleOperand_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.ir.msl
deleted file mode 100644
index ee65b2d..0000000
--- a/test/tint/unittest/reader/spirv/ImageFetch_Multisampled_ConvertSampleOperand_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.ir.msl
+++ /dev/null
@@ -1,9 +0,0 @@
-SKIP: FAILED
-
-../../src/tint/lang/msl/writer/printer/printer.cc:924 internal compiler error: TINT_UNREACHABLE unhandled: textureLoad
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/unittest/reader/spirv/ImageFetch_Multisampled_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.ir.msl b/test/tint/unittest/reader/spirv/ImageFetch_Multisampled_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.ir.msl
deleted file mode 100644
index ee65b2d..0000000
--- a/test/tint/unittest/reader/spirv/ImageFetch_Multisampled_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.ir.msl
+++ /dev/null
@@ -1,9 +0,0 @@
-SKIP: FAILED
-
-../../src/tint/lang/msl/writer/printer/printer.cc:924 internal compiler error: TINT_UNREACHABLE unhandled: textureLoad
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/unittest/reader/spirv/ImageFetch_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.ir.msl b/test/tint/unittest/reader/spirv/ImageFetch_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.ir.msl
deleted file mode 100644
index ee65b2d..0000000
--- a/test/tint/unittest/reader/spirv/ImageFetch_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.ir.msl
+++ /dev/null
@@ -1,9 +0,0 @@
-SKIP: FAILED
-
-../../src/tint/lang/msl/writer/printer/printer.cc:924 internal compiler error: TINT_UNREACHABLE unhandled: textureLoad
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/unittest/reader/spirv/ImageFetch_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_1.spvasm.expected.ir.msl b/test/tint/unittest/reader/spirv/ImageFetch_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_1.spvasm.expected.ir.msl
deleted file mode 100644
index ee65b2d..0000000
--- a/test/tint/unittest/reader/spirv/ImageFetch_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_1.spvasm.expected.ir.msl
+++ /dev/null
@@ -1,9 +0,0 @@
-SKIP: FAILED
-
-../../src/tint/lang/msl/writer/printer/printer.cc:924 internal compiler error: TINT_UNREACHABLE unhandled: textureLoad
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/unittest/reader/spirv/ImageFetch_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_2.spvasm.expected.ir.msl b/test/tint/unittest/reader/spirv/ImageFetch_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_2.spvasm.expected.ir.msl
deleted file mode 100644
index ee65b2d..0000000
--- a/test/tint/unittest/reader/spirv/ImageFetch_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_2.spvasm.expected.ir.msl
+++ /dev/null
@@ -1,9 +0,0 @@
-SKIP: FAILED
-
-../../src/tint/lang/msl/writer/printer/printer.cc:924 internal compiler error: TINT_UNREACHABLE unhandled: textureLoad
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/unittest/reader/spirv/ImageFetch_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_3.spvasm.expected.ir.msl b/test/tint/unittest/reader/spirv/ImageFetch_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_3.spvasm.expected.ir.msl
deleted file mode 100644
index ee65b2d..0000000
--- a/test/tint/unittest/reader/spirv/ImageFetch_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_3.spvasm.expected.ir.msl
+++ /dev/null
@@ -1,9 +0,0 @@
-SKIP: FAILED
-
-../../src/tint/lang/msl/writer/printer/printer.cc:924 internal compiler error: TINT_UNREACHABLE unhandled: textureLoad
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/unittest/reader/spirv/ImageRead_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.ir.msl b/test/tint/unittest/reader/spirv/ImageRead_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.ir.msl
deleted file mode 100644
index ee65b2d..0000000
--- a/test/tint/unittest/reader/spirv/ImageRead_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.ir.msl
+++ /dev/null
@@ -1,9 +0,0 @@
-SKIP: FAILED
-
-../../src/tint/lang/msl/writer/printer/printer.cc:924 internal compiler error: TINT_UNREACHABLE unhandled: textureLoad
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_0.spvasm.expected.ir.msl b/test/tint/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_0.spvasm.expected.ir.msl
deleted file mode 100644
index ee65b2d..0000000
--- a/test/tint/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_0.spvasm.expected.ir.msl
+++ /dev/null
@@ -1,9 +0,0 @@
-SKIP: FAILED
-
-../../src/tint/lang/msl/writer/printer/printer.cc:924 internal compiler error: TINT_UNREACHABLE unhandled: textureLoad
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_2.spvasm.expected.ir.msl b/test/tint/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_2.spvasm.expected.ir.msl
deleted file mode 100644
index ee65b2d..0000000
--- a/test/tint/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_2.spvasm.expected.ir.msl
+++ /dev/null
@@ -1,9 +0,0 @@
-SKIP: FAILED
-
-../../src/tint/lang/msl/writer/printer/printer.cc:924 internal compiler error: TINT_UNREACHABLE unhandled: textureLoad
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/vk-gl-cts/rasterization/line_continuity/line-strip/1.spvasm.expected.ir.msl b/test/tint/vk-gl-cts/rasterization/line_continuity/line-strip/1.spvasm.expected.ir.msl
deleted file mode 100644
index ee65b2d..0000000
--- a/test/tint/vk-gl-cts/rasterization/line_continuity/line-strip/1.spvasm.expected.ir.msl
+++ /dev/null
@@ -1,9 +0,0 @@
-SKIP: FAILED
-
-../../src/tint/lang/msl/writer/printer/printer.cc:924 internal compiler error: TINT_UNREACHABLE unhandled: textureLoad
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
diff --git a/test/tint/vk-gl-cts/rasterization/line_continuity/line-strip/1.wgsl.expected.ir.msl b/test/tint/vk-gl-cts/rasterization/line_continuity/line-strip/1.wgsl.expected.ir.msl
deleted file mode 100644
index ee65b2d..0000000
--- a/test/tint/vk-gl-cts/rasterization/line_continuity/line-strip/1.wgsl.expected.ir.msl
+++ /dev/null
@@ -1,9 +0,0 @@
-SKIP: FAILED
-
-../../src/tint/lang/msl/writer/printer/printer.cc:924 internal compiler error: TINT_UNREACHABLE unhandled: textureLoad
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************