tint/transform: PromoteInitializersToLet

Rename PromoteInitializersToConstVar to PromoteInitializersToLet, and
implement promotion of 'const' variables that resolve to array types.

This is required, as the backends will inline variables that resolve to
'const' variables, and so we need to promote any 'const' values that
would emit an array constructor.

Bug: tint:1580
Change-Id: I1b7f5459512b0043385ba741d644ec776c912899
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/94684
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
diff --git a/src/tint/writer/hlsl/generator_impl.cc b/src/tint/writer/hlsl/generator_impl.cc
index c2a03b8..8139e6b 100644
--- a/src/tint/writer/hlsl/generator_impl.cc
+++ b/src/tint/writer/hlsl/generator_impl.cc
@@ -60,7 +60,7 @@
 #include "src/tint/transform/loop_to_for_loop.h"
 #include "src/tint/transform/manager.h"
 #include "src/tint/transform/num_workgroups_from_uniform.h"
-#include "src/tint/transform/promote_initializers_to_const_var.h"
+#include "src/tint/transform/promote_initializers_to_let.h"
 #include "src/tint/transform/promote_side_effects_to_decl.h"
 #include "src/tint/transform/remove_continue_in_switch.h"
 #include "src/tint/transform/remove_phonies.h"
@@ -231,7 +231,7 @@
     // DecomposeMemoryAccess special-cases the arrayLength() intrinsic, which
     // will be transformed by CalculateArrayLength
     manager.Add<transform::CalculateArrayLength>();
-    manager.Add<transform::PromoteInitializersToConstVar>();
+    manager.Add<transform::PromoteInitializersToLet>();
 
     manager.Add<transform::RemoveContinueInSwitch>();
 
@@ -2618,7 +2618,7 @@
             // to a shader-creation time constant value, and this can be removed.
             if (auto constant = sem->ConstantValue()) {
                 // We do not want to inline array constants, as this will undo the work of
-                // PromoteInitializersToConstVar, which ensures that arrays are declarated in 'let's
+                // PromoteInitializersToLet, which ensures that arrays are declarated in 'let's
                 // before their usage.
                 if (!constant.Type()->Is<sem::Array>()) {
                     return EmitConstant(out, constant);