[ir] Disallow access with no indices

Update various unit tests to avoid doing this.

Fixed: 370743660
Change-Id: I2ef8617287e9ddff7e880f29fb483b558f115b81
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/211098
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: James Price <jrprice@google.com>
diff --git a/src/tint/lang/core/ir/access.h b/src/tint/lang/core/ir/access.h
index 8522878..54b16c6 100644
--- a/src/tint/lang/core/ir/access.h
+++ b/src/tint/lang/core/ir/access.h
@@ -48,7 +48,7 @@
     static constexpr size_t kNumResults = 1;
 
     /// The minimum number of operands used by this instruction
-    static constexpr size_t kMinNumOperands = 1;
+    static constexpr size_t kMinNumOperands = 2;
 
     /// Constructor (no results, no operands)
     /// @param id the instruction id
diff --git a/src/tint/lang/core/ir/transform/array_length_from_uniform_test.cc b/src/tint/lang/core/ir/transform/array_length_from_uniform_test.cc
index c6abd33..b219a41 100644
--- a/src/tint/lang/core/ir/transform/array_length_from_uniform_test.cc
+++ b/src/tint/lang/core/ir/transform/array_length_from_uniform_test.cc
@@ -238,59 +238,6 @@
     EXPECT_EQ(expect, str());
 }
 
-TEST_F(IR_ArrayLengthFromUniformTest, ViaAccess) {
-    auto* arr = ty.array<i32>();
-    auto* arr_ptr = ty.ptr<storage>(arr);
-
-    auto* buffer = b.Var("buffer", arr_ptr);
-    buffer->SetBindingPoint(0, 0);
-    mod.root_block->Append(buffer);
-
-    auto* func = b.Function("foo", ty.u32());
-    b.Append(func->Block(), [&] {
-        auto* len = b.Call<u32>(BuiltinFn::kArrayLength, b.Access(arr_ptr, buffer));
-        b.Return(func, len);
-    });
-
-    auto* src = R"(
-$B1: {  # root
-  %buffer:ptr<storage, array<i32>, read_write> = var @binding_point(0, 0)
-}
-
-%foo = func():u32 {
-  $B2: {
-    %3:ptr<storage, array<i32>, read_write> = access %buffer
-    %4:u32 = arrayLength %3
-    ret %4
-  }
-}
-)";
-    EXPECT_EQ(src, str());
-
-    auto* expect = R"(
-$B1: {  # root
-  %buffer:ptr<storage, array<i32>, read_write> = var @binding_point(0, 0)
-  %tint_storage_buffer_sizes:ptr<uniform, array<vec4<u32>, 1>, read> = var @binding_point(1, 2)
-}
-
-%foo = func():u32 {
-  $B2: {
-    %4:ptr<storage, array<i32>, read_write> = access %buffer
-    %5:ptr<uniform, vec4<u32>, read> = access %tint_storage_buffer_sizes, 0u
-    %6:u32 = load_vector_element %5, 0u
-    %7:u32 = div %6, 4u
-    ret %7
-  }
-}
-)";
-
-    std::unordered_map<BindingPoint, uint32_t> bindpoint_to_index;
-    bindpoint_to_index[{0, 0}] = 0;
-    Run(ArrayLengthFromUniform, BindingPoint{1, 2}, bindpoint_to_index);
-
-    EXPECT_EQ(expect, str());
-}
-
 TEST_F(IR_ArrayLengthFromUniformTest, ViaAccess_StructMember) {
     auto* arr = ty.array<i32>();
     auto* structure = ty.Struct(mod.symbols.New("MyStruct"), {
@@ -907,9 +854,9 @@
     auto* param = b.FunctionParam("param", arr_ptr);
     bar->SetParams({param});
     b.Append(bar->Block(), [&] {
-        auto* access = b.Access(arr_ptr, param);
-        auto* let = b.Let("let", access);
-        auto* len = b.Call<u32>(BuiltinFn::kArrayLength, let);
+        auto* let1 = b.Let("let1", param);
+        auto* let2 = b.Let("let2", let1);
+        auto* len = b.Call<u32>(BuiltinFn::kArrayLength, let2);
         b.Return(bar, len);
     });
 
@@ -933,17 +880,17 @@
 
 %bar = func(%param:ptr<storage, array<i32>, read_write>):u32 {
   $B2: {
-    %4:ptr<storage, array<i32>, read_write> = access %param
-    %let:ptr<storage, array<i32>, read_write> = let %4
-    %6:u32 = arrayLength %let
+    %let1:ptr<storage, array<i32>, read_write> = let %param
+    %let2:ptr<storage, array<i32>, read_write> = let %let1
+    %6:u32 = arrayLength %let2
     ret %6
   }
 }
 %foo = func():u32 {
   $B3: {
     %8:ptr<storage, array<i32>, read_write> = access %buffer, 1u
-    %let_1:ptr<storage, array<i32>, read_write> = let %8  # %let_1: 'let'
-    %10:u32 = call %bar, %let_1
+    %let:ptr<storage, array<i32>, read_write> = let %8
+    %10:u32 = call %bar, %let
     ret %10
   }
 }
@@ -963,20 +910,20 @@
 
 %bar = func(%param:ptr<storage, array<i32>, read_write>, %tint_array_length:u32):u32 {
   $B2: {
-    %6:ptr<storage, array<i32>, read_write> = access %param
-    %let:ptr<storage, array<i32>, read_write> = let %6
+    %let1:ptr<storage, array<i32>, read_write> = let %param
+    %let2:ptr<storage, array<i32>, read_write> = let %let1
     ret %tint_array_length
   }
 }
 %foo = func():u32 {
   $B3: {
     %9:ptr<storage, array<i32>, read_write> = access %buffer, 1u
-    %let_1:ptr<storage, array<i32>, read_write> = let %9  # %let_1: 'let'
+    %let:ptr<storage, array<i32>, read_write> = let %9
     %11:ptr<uniform, vec4<u32>, read> = access %tint_storage_buffer_sizes, 0u
     %12:u32 = load_vector_element %11, 0u
     %13:u32 = sub %12, 4u
     %14:u32 = div %13, 4u
-    %15:u32 = call %bar, %let_1, %14
+    %15:u32 = call %bar, %let, %14
     ret %15
   }
 }
diff --git a/src/tint/lang/core/ir/transform/combine_access_instructions_test.cc b/src/tint/lang/core/ir/transform/combine_access_instructions_test.cc
index 404b94b..7137da6 100644
--- a/src/tint/lang/core/ir/transform/combine_access_instructions_test.cc
+++ b/src/tint/lang/core/ir/transform/combine_access_instructions_test.cc
@@ -53,9 +53,6 @@
 
     auto* func = b.Function("foo", ty.void_());
     b.Append(func->Block(), [&] {
-        auto* access_root = b.Access(ty.ptr(uniform, structure), buffer);
-        b.Load(access_root);
-
         auto* access_arr = b.Access(ty.ptr(uniform, arr), buffer, 0_u);
         b.Load(access_arr);
 
@@ -79,14 +76,12 @@
 
 %foo = func():void {
   $B2: {
-    %3:ptr<uniform, MyStruct, read> = access %buffer
-    %4:MyStruct = load %3
-    %5:ptr<uniform, array<mat3x3<f32>, 4>, read> = access %buffer, 0u
-    %6:array<mat3x3<f32>, 4> = load %5
-    %7:ptr<uniform, mat3x3<f32>, read> = access %buffer, 0u, 1u
-    %8:mat3x3<f32> = load %7
-    %9:ptr<uniform, vec3<f32>, read> = access %buffer, 0u, 1u, 2u
-    %10:vec3<f32> = load %9
+    %3:ptr<uniform, array<mat3x3<f32>, 4>, read> = access %buffer, 0u
+    %4:array<mat3x3<f32>, 4> = load %3
+    %5:ptr<uniform, mat3x3<f32>, read> = access %buffer, 0u, 1u
+    %6:mat3x3<f32> = load %5
+    %7:ptr<uniform, vec3<f32>, read> = access %buffer, 0u, 1u, 2u
+    %8:vec3<f32> = load %7
     ret
   }
 }
@@ -166,199 +161,6 @@
     EXPECT_EQ(expect, str());
 }
 
-TEST_F(IR_CombineAccessInstructionsTest, NoIndices_Root) {
-    auto* mat = ty.mat3x3<f32>();
-    auto* arr = ty.array(mat, 4);
-    auto* structure = ty.Struct(mod.symbols.New("MyStruct"), {
-                                                                 {mod.symbols.New("a"), arr},
-                                                             });
-
-    auto* buffer = b.Var("buffer", ty.ptr(uniform, structure));
-    buffer->SetBindingPoint(0, 0);
-    mod.root_block->Append(buffer);
-
-    auto* func = b.Function("foo", ty.void_());
-    b.Append(func->Block(), [&] {
-        auto* access_root = b.Access(ty.ptr(uniform, structure), buffer);
-        auto* access_arr = b.Access(ty.ptr(uniform, arr), access_root, 0_u);
-        b.Load(access_arr);
-
-        b.Return(func);
-    });
-
-    auto* src = R"(
-MyStruct = struct @align(16) {
-  a:array<mat3x3<f32>, 4> @offset(0)
-}
-
-$B1: {  # root
-  %buffer:ptr<uniform, MyStruct, read> = var @binding_point(0, 0)
-}
-
-%foo = func():void {
-  $B2: {
-    %3:ptr<uniform, MyStruct, read> = access %buffer
-    %4:ptr<uniform, array<mat3x3<f32>, 4>, read> = access %3, 0u
-    %5:array<mat3x3<f32>, 4> = load %4
-    ret
-  }
-}
-)";
-    EXPECT_EQ(src, str());
-
-    auto* expect = R"(
-MyStruct = struct @align(16) {
-  a:array<mat3x3<f32>, 4> @offset(0)
-}
-
-$B1: {  # root
-  %buffer:ptr<uniform, MyStruct, read> = var @binding_point(0, 0)
-}
-
-%foo = func():void {
-  $B2: {
-    %3:ptr<uniform, array<mat3x3<f32>, 4>, read> = access %buffer, 0u
-    %4:array<mat3x3<f32>, 4> = load %3
-    ret
-  }
-}
-)";
-
-    Run(CombineAccessInstructions);
-
-    EXPECT_EQ(expect, str());
-}
-
-TEST_F(IR_CombineAccessInstructionsTest, NoIndices_Middle) {
-    auto* mat = ty.mat3x3<f32>();
-    auto* arr = ty.array(mat, 4);
-    auto* structure = ty.Struct(mod.symbols.New("MyStruct"), {
-                                                                 {mod.symbols.New("a"), arr},
-                                                             });
-
-    auto* buffer = b.Var("buffer", ty.ptr(uniform, structure));
-    buffer->SetBindingPoint(0, 0);
-    mod.root_block->Append(buffer);
-
-    auto* func = b.Function("foo", ty.void_());
-    b.Append(func->Block(), [&] {
-        auto* access_arr = b.Access(ty.ptr(uniform, arr), buffer, 0_u);
-        auto* access_copy = b.Access(ty.ptr(uniform, arr), access_arr);
-        auto* access_mat = b.Access(ty.ptr(uniform, mat), access_copy, 1_u);
-        b.Load(access_mat);
-
-        b.Return(func);
-    });
-
-    auto* src = R"(
-MyStruct = struct @align(16) {
-  a:array<mat3x3<f32>, 4> @offset(0)
-}
-
-$B1: {  # root
-  %buffer:ptr<uniform, MyStruct, read> = var @binding_point(0, 0)
-}
-
-%foo = func():void {
-  $B2: {
-    %3:ptr<uniform, array<mat3x3<f32>, 4>, read> = access %buffer, 0u
-    %4:ptr<uniform, array<mat3x3<f32>, 4>, read> = access %3
-    %5:ptr<uniform, mat3x3<f32>, read> = access %4, 1u
-    %6:mat3x3<f32> = load %5
-    ret
-  }
-}
-)";
-    EXPECT_EQ(src, str());
-
-    auto* expect = R"(
-MyStruct = struct @align(16) {
-  a:array<mat3x3<f32>, 4> @offset(0)
-}
-
-$B1: {  # root
-  %buffer:ptr<uniform, MyStruct, read> = var @binding_point(0, 0)
-}
-
-%foo = func():void {
-  $B2: {
-    %3:ptr<uniform, mat3x3<f32>, read> = access %buffer, 0u, 1u
-    %4:mat3x3<f32> = load %3
-    ret
-  }
-}
-)";
-
-    Run(CombineAccessInstructions);
-
-    EXPECT_EQ(expect, str());
-}
-
-TEST_F(IR_CombineAccessInstructionsTest, NoIndices_End) {
-    auto* mat = ty.mat3x3<f32>();
-    auto* arr = ty.array(mat, 4);
-    auto* structure = ty.Struct(mod.symbols.New("MyStruct"), {
-                                                                 {mod.symbols.New("a"), arr},
-                                                             });
-
-    auto* buffer = b.Var("buffer", ty.ptr(uniform, structure));
-    buffer->SetBindingPoint(0, 0);
-    mod.root_block->Append(buffer);
-
-    auto* func = b.Function("foo", ty.void_());
-    b.Append(func->Block(), [&] {
-        auto* access_arr = b.Access(ty.ptr(uniform, arr), buffer, 0_u);
-        auto* access_mat = b.Access(ty.ptr(uniform, mat), access_arr, 1_u);
-        auto* access_copy = b.Access(ty.ptr(uniform, mat), access_mat);
-        b.Load(access_copy);
-
-        b.Return(func);
-    });
-
-    auto* src = R"(
-MyStruct = struct @align(16) {
-  a:array<mat3x3<f32>, 4> @offset(0)
-}
-
-$B1: {  # root
-  %buffer:ptr<uniform, MyStruct, read> = var @binding_point(0, 0)
-}
-
-%foo = func():void {
-  $B2: {
-    %3:ptr<uniform, array<mat3x3<f32>, 4>, read> = access %buffer, 0u
-    %4:ptr<uniform, mat3x3<f32>, read> = access %3, 1u
-    %5:ptr<uniform, mat3x3<f32>, read> = access %4
-    %6:mat3x3<f32> = load %5
-    ret
-  }
-}
-)";
-    EXPECT_EQ(src, str());
-
-    auto* expect = R"(
-MyStruct = struct @align(16) {
-  a:array<mat3x3<f32>, 4> @offset(0)
-}
-
-$B1: {  # root
-  %buffer:ptr<uniform, MyStruct, read> = var @binding_point(0, 0)
-}
-
-%foo = func():void {
-  $B2: {
-    %3:ptr<uniform, mat3x3<f32>, read> = access %buffer, 0u, 1u
-    %4:mat3x3<f32> = load %3
-    ret
-  }
-}
-)";
-
-    Run(CombineAccessInstructions);
-
-    EXPECT_EQ(expect, str());
-}
-
 TEST_F(IR_CombineAccessInstructionsTest, MutipleChains_FromRoot) {
     auto* vec = ty.vec3<f32>();
     auto* mat = ty.mat3x3<f32>();
diff --git a/src/tint/lang/core/ir/validator_test.cc b/src/tint/lang/core/ir/validator_test.cc
index 226cfe4..d9724b3 100644
--- a/src/tint/lang/core/ir/validator_test.cc
+++ b/src/tint/lang/core/ir/validator_test.cc
@@ -2318,7 +2318,7 @@
     auto res = ir::Validate(mod);
     ASSERT_NE(res, Success);
     EXPECT_EQ(res.Failure().reason.Str(),
-              R"(:3:14 error: access: expected at least 1 operands, got 0
+              R"(:3:14 error: access: expected at least 2 operands, got 0
     %3:f32 = access
              ^^^^^^
 
@@ -2336,6 +2336,37 @@
 )");
 }
 
+TEST_F(IR_ValidatorTest, Access_NoIndices) {
+    auto* f = b.Function("my_func", ty.void_());
+    auto* obj = b.FunctionParam(ty.vec3<f32>());
+    f->SetParams({obj});
+
+    b.Append(f->Block(), [&] {
+        b.Access(ty.f32(), obj);
+        b.Return(f);
+    });
+
+    auto res = ir::Validate(mod);
+    ASSERT_NE(res, Success);
+    EXPECT_EQ(res.Failure().reason.Str(),
+              R"(:3:14 error: access: expected at least 2 operands, got 1
+    %3:f32 = access %2
+             ^^^^^^
+
+:2:3 note: in block
+  $B1: {
+  ^^^
+
+note: # Disassembly
+%my_func = func(%2:vec3<f32>):void {
+  $B1: {
+    %3:f32 = access %2
+    ret
+  }
+}
+)");
+}
+
 TEST_F(IR_ValidatorTest, Access_NoResults) {
     auto* f = b.Function("my_func", ty.void_());
     auto* obj = b.FunctionParam(ty.vec3<f32>());
@@ -2371,7 +2402,7 @@
 TEST_F(IR_ValidatorTest, Access_NullObject) {
     auto* f = b.Function("my_func", ty.void_());
     b.Append(f->Block(), [&] {
-        b.Access(ty.f32(), nullptr);
+        b.Access(ty.f32(), nullptr, 0_u);
         b.Return(f);
     });
 
@@ -2379,7 +2410,7 @@
     ASSERT_NE(res, Success);
     EXPECT_EQ(res.Failure().reason.Str(),
               R"(:3:21 error: access: operand is undefined
-    %2:f32 = access undef
+    %2:f32 = access undef, 0u
                     ^^^^^
 
 :2:3 note: in block
@@ -2389,7 +2420,7 @@
 note: # Disassembly
 %my_func = func():void {
   $B1: {
-    %2:f32 = access undef
+    %2:f32 = access undef, 0u
     ret
   }
 }
diff --git a/src/tint/lang/glsl/writer/access_test.cc b/src/tint/lang/glsl/writer/access_test.cc
index fd5d660..70e583f 100644
--- a/src/tint/lang/glsl/writer/access_test.cc
+++ b/src/tint/lang/glsl/writer/access_test.cc
@@ -575,13 +575,13 @@
                                                     {mod.symbols.New("b"), Inner},
                                                 });
 
-    auto* var = b.Var("v", storage, sb, core::Access::kReadWrite);
+    auto* var = b.Var("v", storage, ty.array(sb, 4), core::Access::kReadWrite);
     var->SetBindingPoint(0, 0);
     b.ir.root_block->Append(var);
 
     auto* func = b.Function("foo", ty.void_(), core::ir::Function::PipelineStage::kFragment);
     b.Append(func->Block(), [&] {
-        auto* x = b.Access(ty.ptr(storage, sb, core::Access::kReadWrite), var);
+        auto* x = b.Access(ty.ptr(storage, sb, core::Access::kReadWrite), var, 2_u);
         auto* y = b.Access(ty.ptr(storage, Inner, core::Access::kReadWrite), x->Result(0), 1_u);
         b.Let("b", b.Load(b.Access(ty.ptr(storage, ty.u32(), core::Access::kReadWrite),
                                    y->Result(0), 1_u)));
@@ -605,10 +605,10 @@
 
 layout(binding = 0, std430)
 buffer v_block_1_ssbo {
-  SB inner;
+  SB inner[4];
 } v_1;
 void main() {
-  uint b = v_1.inner.b.d;
+  uint b = v_1.inner[2u].b.d;
 }
 )");
 }
@@ -734,13 +734,13 @@
                                                   Inner->Size(), core::IOAttributes{}));
     auto* sb = ty.Struct(mod.symbols.New("SB"), members);
 
-    auto* var = b.Var("v", uniform, sb, core::Access::kRead);
+    auto* var = b.Var("v", uniform, ty.array(sb, 4), core::Access::kRead);
     var->SetBindingPoint(0, 0);
     b.ir.root_block->Append(var);
 
     auto* func = b.Function("foo", ty.void_(), core::ir::Function::PipelineStage::kFragment);
     b.Append(func->Block(), [&] {
-        auto* x = b.Access(ty.ptr(uniform, sb, core::Access::kRead), var);
+        auto* x = b.Access(ty.ptr(uniform, sb, core::Access::kRead), var, 2_u);
         auto* y = b.Access(ty.ptr(uniform, Inner, core::Access::kRead), x->Result(0), 1_u);
         b.Let("b",
               b.Load(b.Access(ty.ptr(uniform, ty.u32(), core::Access::kRead), y->Result(0), 1_u)));
@@ -767,10 +767,10 @@
 
 layout(binding = 0, std140)
 uniform v_block_1_ubo {
-  SB inner;
+  SB inner[4];
 } v_1;
 void main() {
-  uint b = v_1.inner.b.d;
+  uint b = v_1.inner[2u].b.d;
 }
 )");
 }
@@ -1377,7 +1377,7 @@
     b.ir.root_block->Append(var);
     auto* func = b.Function("foo", ty.void_(), core::ir::Function::PipelineStage::kFragment);
     b.Append(func->Block(), [&] {
-        b.Store(b.Access(ty.ptr<storage, f32, core::Access::kReadWrite>(), var), 2_f);
+        b.Store(var, 2_f);
         b.Return(func);
     });
 
@@ -1402,7 +1402,7 @@
     b.ir.root_block->Append(var);
     auto* func = b.Function("foo", ty.void_(), core::ir::Function::PipelineStage::kFragment);
     b.Append(func->Block(), [&] {
-        b.Store(b.Access(ty.ptr<storage, f16, core::Access::kReadWrite>(), var), 2_h);
+        b.Store(var, 2_h);
         b.Return(func);
     });
 
@@ -1428,8 +1428,7 @@
     b.ir.root_block->Append(var);
     auto* func = b.Function("foo", ty.void_(), core::ir::Function::PipelineStage::kFragment);
     b.Append(func->Block(), [&] {
-        b.StoreVectorElement(b.Access(ty.ptr<storage, vec3<f32>, core::Access::kReadWrite>(), var),
-                             1_u, 2_f);
+        b.StoreVectorElement(var, 1_u, 2_f);
         b.Return(func);
     });
 
@@ -1454,8 +1453,7 @@
     b.ir.root_block->Append(var);
     auto* func = b.Function("foo", ty.void_(), core::ir::Function::PipelineStage::kFragment);
     b.Append(func->Block(), [&] {
-        b.StoreVectorElement(b.Access(ty.ptr<storage, vec3<f16>, core::Access::kReadWrite>(), var),
-                             1_u, 2_h);
+        b.StoreVectorElement(var, 1_u, 2_h);
         b.Return(func);
     });
 
@@ -1481,8 +1479,7 @@
     b.ir.root_block->Append(var);
     auto* func = b.Function("foo", ty.void_(), core::ir::Function::PipelineStage::kFragment);
     b.Append(func->Block(), [&] {
-        b.Store(b.Access(ty.ptr<storage, vec3<f32>, core::Access::kReadWrite>(), var),
-                b.Composite(ty.vec3<f32>(), 2_f, 3_f, 4_f));
+        b.Store(var, b.Composite(ty.vec3<f32>(), 2_f, 3_f, 4_f));
         b.Return(func);
     });
 
@@ -1507,8 +1504,7 @@
     b.ir.root_block->Append(var);
     auto* func = b.Function("foo", ty.void_(), core::ir::Function::PipelineStage::kFragment);
     b.Append(func->Block(), [&] {
-        b.Store(b.Access(ty.ptr<storage, vec3<f16>, core::Access::kReadWrite>(), var),
-                b.Composite(ty.vec3<f16>(), 2_h, 3_h, 4_h));
+        b.Store(var, b.Composite(ty.vec3<f16>(), 2_h, 3_h, 4_h));
         b.Return(func);
     });
 
diff --git a/src/tint/lang/hlsl/writer/access_test.cc b/src/tint/lang/hlsl/writer/access_test.cc
index c13a520..698f8e8 100644
--- a/src/tint/lang/hlsl/writer/access_test.cc
+++ b/src/tint/lang/hlsl/writer/access_test.cc
@@ -629,13 +629,13 @@
                                                     {mod.symbols.New("b"), Inner},
                                                 });
 
-    auto* var = b.Var("v", storage, sb, core::Access::kReadWrite);
+    auto* var = b.Var("v", storage, ty.array(sb, 4), core::Access::kReadWrite);
     var->SetBindingPoint(0, 0);
     b.ir.root_block->Append(var);
 
     auto* func = b.Function("foo", ty.void_(), core::ir::Function::PipelineStage::kFragment);
     b.Append(func->Block(), [&] {
-        auto* x = b.Access(ty.ptr(storage, sb, core::Access::kReadWrite), var);
+        auto* x = b.Access(ty.ptr(storage, sb, core::Access::kReadWrite), var, 2_u);
         auto* y = b.Access(ty.ptr(storage, Inner, core::Access::kReadWrite), x->Result(0), 1_u);
         b.Let("b", b.Load(b.Access(ty.ptr(storage, ty.u32(), core::Access::kReadWrite),
                                    y->Result(0), 1_u)));
@@ -646,7 +646,7 @@
     EXPECT_EQ(output_.hlsl, R"(
 RWByteAddressBuffer v : register(u0);
 void foo() {
-  uint b = v.Load(8u);
+  uint b = v.Load(32u);
 }
 
 )");
@@ -802,13 +802,13 @@
                                                   Inner->Size(), core::IOAttributes{}));
     auto* sb = ty.Struct(mod.symbols.New("SB"), members);
 
-    auto* var = b.Var("v", uniform, sb, core::Access::kRead);
+    auto* var = b.Var("v", uniform, ty.array(sb, 4), core::Access::kRead);
     var->SetBindingPoint(0, 0);
     b.ir.root_block->Append(var);
 
     auto* func = b.Function("foo", ty.void_(), core::ir::Function::PipelineStage::kFragment);
     b.Append(func->Block(), [&] {
-        auto* x = b.Access(ty.ptr(uniform, sb, core::Access::kRead), var);
+        auto* x = b.Access(ty.ptr(uniform, sb, core::Access::kRead), var, 2_u);
         auto* y = b.Access(ty.ptr(uniform, Inner, core::Access::kRead), x->Result(0), 1_u);
         b.Let("b",
               b.Load(b.Access(ty.ptr(uniform, ty.u32(), core::Access::kRead), y->Result(0), 1_u)));
@@ -818,10 +818,10 @@
     ASSERT_TRUE(Generate()) << err_ << output_.hlsl;
     EXPECT_EQ(output_.hlsl, R"(
 cbuffer cbuffer_v : register(b0) {
-  uint4 v[2];
+  uint4 v[8];
 };
 void foo() {
-  uint b = v[1u].y;
+  uint b = v[5u].y;
 }
 
 )");
@@ -1564,7 +1564,7 @@
     b.ir.root_block->Append(var);
     auto* func = b.Function("foo", ty.void_(), core::ir::Function::PipelineStage::kFragment);
     b.Append(func->Block(), [&] {
-        b.Store(b.Access(ty.ptr<storage, f32, core::Access::kReadWrite>(), var), 2_f);
+        b.Store(var, 2_f);
         b.Return(func);
     });
 
@@ -1585,7 +1585,7 @@
     b.ir.root_block->Append(var);
     auto* func = b.Function("foo", ty.void_(), core::ir::Function::PipelineStage::kFragment);
     b.Append(func->Block(), [&] {
-        b.Store(b.Access(ty.ptr<storage, f16, core::Access::kReadWrite>(), var), 2_h);
+        b.Store(var, 2_h);
         b.Return(func);
     });
 
@@ -1606,8 +1606,7 @@
     b.ir.root_block->Append(var);
     auto* func = b.Function("foo", ty.void_(), core::ir::Function::PipelineStage::kFragment);
     b.Append(func->Block(), [&] {
-        b.StoreVectorElement(b.Access(ty.ptr<storage, vec3<f32>, core::Access::kReadWrite>(), var),
-                             1_u, 2_f);
+        b.StoreVectorElement(var, 1_u, 2_f);
         b.Return(func);
     });
 
@@ -1628,8 +1627,7 @@
     b.ir.root_block->Append(var);
     auto* func = b.Function("foo", ty.void_(), core::ir::Function::PipelineStage::kFragment);
     b.Append(func->Block(), [&] {
-        b.StoreVectorElement(b.Access(ty.ptr<storage, vec3<f16>, core::Access::kReadWrite>(), var),
-                             1_u, 2_h);
+        b.StoreVectorElement(var, 1_u, 2_h);
         b.Return(func);
     });
 
@@ -1650,8 +1648,7 @@
     b.ir.root_block->Append(var);
     auto* func = b.Function("foo", ty.void_(), core::ir::Function::PipelineStage::kFragment);
     b.Append(func->Block(), [&] {
-        b.Store(b.Access(ty.ptr<storage, vec3<f32>, core::Access::kReadWrite>(), var),
-                b.Composite(ty.vec3<f32>(), 2_f, 3_f, 4_f));
+        b.Store(var, b.Composite(ty.vec3<f32>(), 2_f, 3_f, 4_f));
         b.Return(func);
     });
 
@@ -1672,8 +1669,7 @@
     b.ir.root_block->Append(var);
     auto* func = b.Function("foo", ty.void_(), core::ir::Function::PipelineStage::kFragment);
     b.Append(func->Block(), [&] {
-        b.Store(b.Access(ty.ptr<storage, vec3<f16>, core::Access::kReadWrite>(), var),
-                b.Composite(ty.vec3<f16>(), 2_h, 3_h, 4_h));
+        b.Store(var, b.Composite(ty.vec3<f16>(), 2_h, 3_h, 4_h));
         b.Return(func);
     });
 
diff --git a/src/tint/lang/hlsl/writer/raise/decompose_storage_access_test.cc b/src/tint/lang/hlsl/writer/raise/decompose_storage_access_test.cc
index c7c90eb..5b647f0 100644
--- a/src/tint/lang/hlsl/writer/raise/decompose_storage_access_test.cc
+++ b/src/tint/lang/hlsl/writer/raise/decompose_storage_access_test.cc
@@ -74,13 +74,13 @@
                                                     {mod.symbols.New("b"), Inner},
                                                 });
 
-    auto* var = b.Var("v", storage, sb, core::Access::kReadWrite);
+    auto* var = b.Var("v", storage, ty.array(sb, 4), core::Access::kReadWrite);
     var->SetBindingPoint(0, 0);
     b.ir.root_block->Append(var);
 
     auto* func = b.Function("foo", ty.void_(), core::ir::Function::PipelineStage::kFragment);
     b.Append(func->Block(), [&] {
-        auto* x = b.Access(ty.ptr(storage, sb, core::Access::kReadWrite), var);
+        auto* x = b.Access(ty.ptr(storage, sb, core::Access::kReadWrite), var, 2_u);
         auto* y = b.Access(ty.ptr(storage, Inner, core::Access::kReadWrite), x->Result(0), 1_u);
         b.Let("b", b.Load(b.Access(ty.ptr(storage, ty.u32(), core::Access::kReadWrite),
                                    y->Result(0), 1_u)));
@@ -99,12 +99,12 @@
 }
 
 $B1: {  # root
-  %v:ptr<storage, SB, read_write> = var @binding_point(0, 0)
+  %v:ptr<storage, array<SB, 4>, read_write> = var @binding_point(0, 0)
 }
 
 %foo = @fragment func():void {
   $B2: {
-    %3:ptr<storage, SB, read_write> = access %v
+    %3:ptr<storage, SB, read_write> = access %v, 2u
     %4:ptr<storage, Inner, read_write> = access %3, 1u
     %5:ptr<storage, u32, read_write> = access %4, 1u
     %6:u32 = load %5
@@ -132,7 +132,7 @@
 
 %foo = @fragment func():void {
   $B2: {
-    %3:u32 = %v.Load 8u
+    %3:u32 = %v.Load 32u
     %4:u32 = bitcast %3
     %b:u32 = let %4
     ret
@@ -1994,7 +1994,7 @@
     b.ir.root_block->Append(var);
     auto* func = b.Function("foo", ty.void_(), core::ir::Function::PipelineStage::kFragment);
     b.Append(func->Block(), [&] {
-        b.Store(b.Access(ty.ptr<storage, f32, core::Access::kReadWrite>(), var), 2_f);
+        b.Store(var, 2_f);
         b.Return(func);
     });
 
@@ -2005,8 +2005,7 @@
 
 %foo = @fragment func():void {
   $B2: {
-    %3:ptr<storage, f32, read_write> = access %v
-    store %3, 2.0f
+    store %v, 2.0f
     ret
   }
 }
@@ -2037,7 +2036,7 @@
     b.ir.root_block->Append(var);
     auto* func = b.Function("foo", ty.void_(), core::ir::Function::PipelineStage::kFragment);
     b.Append(func->Block(), [&] {
-        b.Store(b.Access(ty.ptr<storage, f16, core::Access::kReadWrite>(), var), 2_h);
+        b.Store(var, 2_h);
         b.Return(func);
     });
 
@@ -2048,8 +2047,7 @@
 
 %foo = @fragment func():void {
   $B2: {
-    %3:ptr<storage, f16, read_write> = access %v
-    store %3, 2.0h
+    store %v, 2.0h
     ret
   }
 }
@@ -2162,8 +2160,7 @@
     b.ir.root_block->Append(var);
     auto* func = b.Function("foo", ty.void_(), core::ir::Function::PipelineStage::kFragment);
     b.Append(func->Block(), [&] {
-        b.Store(b.Access(ty.ptr<storage, vec3<f32>, core::Access::kReadWrite>(), var),
-                b.Composite(ty.vec3<f32>(), 2_f, 3_f, 4_f));
+        b.Store(var, b.Composite(ty.vec3<f32>(), 2_f, 3_f, 4_f));
         b.Return(func);
     });
 
@@ -2174,8 +2171,7 @@
 
 %foo = @fragment func():void {
   $B2: {
-    %3:ptr<storage, vec3<f32>, read_write> = access %v
-    store %3, vec3<f32>(2.0f, 3.0f, 4.0f)
+    store %v, vec3<f32>(2.0f, 3.0f, 4.0f)
     ret
   }
 }
@@ -2206,8 +2202,7 @@
     b.ir.root_block->Append(var);
     auto* func = b.Function("foo", ty.void_(), core::ir::Function::PipelineStage::kFragment);
     b.Append(func->Block(), [&] {
-        b.Store(b.Access(ty.ptr<storage, vec3<f16>, core::Access::kReadWrite>(), var),
-                b.Composite(ty.vec3<f16>(), 2_h, 3_h, 4_h));
+        b.Store(var, b.Composite(ty.vec3<f16>(), 2_h, 3_h, 4_h));
 
         b.Return(func);
     });
@@ -2219,8 +2214,7 @@
 
 %foo = @fragment func():void {
   $B2: {
-    %3:ptr<storage, vec3<f16>, read_write> = access %v
-    store %3, vec3<f16>(2.0h, 3.0h, 4.0h)
+    store %v, vec3<f16>(2.0h, 3.0h, 4.0h)
     ret
   }
 }
diff --git a/src/tint/lang/hlsl/writer/raise/decompose_uniform_access_test.cc b/src/tint/lang/hlsl/writer/raise/decompose_uniform_access_test.cc
index 57df733..837601a 100644
--- a/src/tint/lang/hlsl/writer/raise/decompose_uniform_access_test.cc
+++ b/src/tint/lang/hlsl/writer/raise/decompose_uniform_access_test.cc
@@ -74,13 +74,13 @@
                                                   Inner->Size(), core::IOAttributes{}));
     auto* sb = ty.Struct(mod.symbols.New("SB"), members);
 
-    auto* var = b.Var("v", uniform, sb, core::Access::kRead);
+    auto* var = b.Var("v", uniform, ty.array(sb, 4), core::Access::kRead);
     var->SetBindingPoint(0, 0);
     b.ir.root_block->Append(var);
 
     auto* func = b.Function("foo", ty.void_(), core::ir::Function::PipelineStage::kFragment);
     b.Append(func->Block(), [&] {
-        auto* x = b.Access(ty.ptr(uniform, sb, core::Access::kRead), var);
+        auto* x = b.Access(ty.ptr(uniform, sb, core::Access::kRead), var, 2_u);
         auto* y = b.Access(ty.ptr(uniform, Inner, core::Access::kRead), x->Result(0), 1_u);
         b.Let("b",
               b.Load(b.Access(ty.ptr(uniform, ty.u32(), core::Access::kRead), y->Result(0), 1_u)));
@@ -99,12 +99,12 @@
 }
 
 $B1: {  # root
-  %v:ptr<uniform, SB, read> = var @binding_point(0, 0)
+  %v:ptr<uniform, array<SB, 4>, read> = var @binding_point(0, 0)
 }
 
 %foo = @fragment func():void {
   $B2: {
-    %3:ptr<uniform, SB, read> = access %v
+    %3:ptr<uniform, SB, read> = access %v, 2u
     %4:ptr<uniform, Inner, read> = access %3, 1u
     %5:ptr<uniform, u32, read> = access %4, 1u
     %6:u32 = load %5
@@ -127,12 +127,12 @@
 }
 
 $B1: {  # root
-  %v:ptr<uniform, array<vec4<u32>, 2>, read> = var @binding_point(0, 0)
+  %v:ptr<uniform, array<vec4<u32>, 8>, read> = var @binding_point(0, 0)
 }
 
 %foo = @fragment func():void {
   $B2: {
-    %3:ptr<uniform, vec4<u32>, read> = access %v, 1u
+    %3:ptr<uniform, vec4<u32>, read> = access %v, 5u
     %4:u32 = load_vector_element %3, 1u
     %5:u32 = bitcast %4
     %b:u32 = let %5
diff --git a/src/tint/lang/msl/writer/raise/packed_vec3_test.cc b/src/tint/lang/msl/writer/raise/packed_vec3_test.cc
index 081e5d0..a230647 100644
--- a/src/tint/lang/msl/writer/raise/packed_vec3_test.cc
+++ b/src/tint/lang/msl/writer/raise/packed_vec3_test.cc
@@ -3187,69 +3187,6 @@
     EXPECT_EQ(expect, str());
 }
 
-TEST_F(MslWriter_PackedVec3Test, StorageVar_ViaAccessWithNoIndices) {
-    auto* var = b.Var<storage, mat4x3<f32>>("v");
-    var->SetBindingPoint(0, 0);
-    mod.root_block->Append(var);
-
-    auto* func = b.Function("foo", ty.void_());
-    b.Append(func->Block(), [&] {  //
-        auto* mat_ptr = b.Access(ty.ptr<storage, mat4x3<f32>>(), var);
-        auto* col_ptr = b.Access(ty.ptr<storage, vec3<f32>>(),
-                                 b.Access(ty.ptr<storage, vec3<f32>>(), mat_ptr, 1_u));
-        auto* col = b.Load(col_ptr);
-        b.Store(b.Access(ty.ptr<storage, vec3<f32>>(), mat_ptr, 2_u), col);
-        b.Return(func);
-    });
-
-    auto* src = R"(
-$B1: {  # root
-  %v:ptr<storage, mat4x3<f32>, read_write> = var @binding_point(0, 0)
-}
-
-%foo = func():void {
-  $B2: {
-    %3:ptr<storage, mat4x3<f32>, read_write> = access %v
-    %4:ptr<storage, vec3<f32>, read_write> = access %3, 1u
-    %5:ptr<storage, vec3<f32>, read_write> = access %4
-    %6:vec3<f32> = load %5
-    %7:ptr<storage, vec3<f32>, read_write> = access %3, 2u
-    store %7, %6
-    ret
-  }
-}
-)";
-    EXPECT_EQ(src, str());
-
-    auto* expect = R"(
-tint_packed_vec3_f32_array_element = struct @align(16) {
-  packed:__packed_vec3<f32> @offset(0)
-}
-
-$B1: {  # root
-  %v:ptr<storage, array<tint_packed_vec3_f32_array_element, 4>, read_write> = var @binding_point(0, 0)
-}
-
-%foo = func():void {
-  $B2: {
-    %3:ptr<storage, array<tint_packed_vec3_f32_array_element, 4>, read_write> = access %v
-    %4:ptr<storage, __packed_vec3<f32>, read_write> = access %3, 1u, 0u
-    %5:ptr<storage, __packed_vec3<f32>, read_write> = access %4
-    %6:__packed_vec3<f32> = load %5
-    %7:vec3<f32> = convert %6
-    %8:ptr<storage, __packed_vec3<f32>, read_write> = access %3, 2u, 0u
-    %9:__packed_vec3<f32> = convert %7
-    store %8, %9
-    ret
-  }
-}
-)";
-
-    Run(PackedVec3);
-
-    EXPECT_EQ(expect, str());
-}
-
 TEST_F(MslWriter_PackedVec3Test, StorageVar_ArrayLengthBuiltinCall) {
     auto* var = b.Var<storage, array<vec3<f32>>>("v");
     var->SetBindingPoint(0, 0);