[msl] Use the output of FlattenBindings

We were using the original AST program instead of this, which meant
that non-zero binding groups were being used. This fixes many E2E
tests.

Bug: 42251016
Change-Id: I360e21ddf2bd4b7b27ea1f34d6c9c74ff2c0bf00
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/192000
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Auto-Submit: James Price <jrprice@google.com>
diff --git a/test/tint/builtins/gen/var/any/0e3e58.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/any/0e3e58.wgsl.expected.ir.msl
index 4eb3003..f8b55b9 100644
--- a/test/tint/builtins/gen/var/any/0e3e58.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/any/0e3e58.wgsl.expected.ir.msl
@@ -1,46 +1,30 @@
-SKIP: FAILED
+#include <metal_stdlib>
+using namespace metal;
+struct tint_module_vars_struct {
+  device int* prevent_dce;
+};
+struct vertex_main_outputs {
+  float4 tint_symbol [[position]];
+};
 
-../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: $B1: {  # root
-  %prevent_dce:ptr<storage, i32, read_write> = var @binding_point(2, 0)
+void any_0e3e58(tint_module_vars_struct tint_module_vars) {
+  bool2 arg_0 = bool2(true);
+  bool res = any(arg_0);
+  (*tint_module_vars.prevent_dce) = select(0, 1, all(!(res)));
 }
-
-%any_0e3e58 = func():void {
-  $B2: {
-    %arg_0:ptr<function, vec2<bool>, read_write> = var, vec2<bool>(true)
-    %4:vec2<bool> = load %arg_0
-    %5:bool = any %4
-    %res:ptr<function, bool, read_write> = var, %5
-    %7:bool = load %res
-    %8:bool = eq %7, false
-    %9:bool = all %8
-    %10:i32 = select 0i, 1i, %9
-    store %prevent_dce, %10
-    ret
-  }
+float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
+  any_0e3e58(tint_module_vars);
+  return float4(0.0f);
 }
-%vertex_main = @vertex func():vec4<f32> [@position] {
-  $B3: {
-    %12:void = call %any_0e3e58
-    ret vec4<f32>(0.0f)
-  }
+fragment void fragment_main(device int* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.prevent_dce=prevent_dce};
+  any_0e3e58(tint_module_vars);
 }
-%fragment_main = @fragment func():void {
-  $B4: {
-    %14:void = call %any_0e3e58
-    ret
-  }
+kernel void compute_main(device int* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.prevent_dce=prevent_dce};
+  any_0e3e58(tint_module_vars);
 }
-%compute_main = @compute @workgroup_size(1, 1, 1) func():void {
-  $B5: {
-    %16:void = call %any_0e3e58
-    ret
-  }
+vertex vertex_main_outputs vertex_main(device int* prevent_dce [[buffer(0)]]) {
+  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.prevent_dce=prevent_dce};
+  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
 }
-
-unhandled variable address space
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************