Import Tint changes from Dawn

Changes:
  - 8700be5806505dc847811993f27b17febcfe7197 Convert std::endl to newlines. by dan sinclair <dsinclair@chromium.org>
  - df0810dfbc3c3a27501237bf4ea8fe3640fcc0aa [tint][fuzz] Use renamer transform if running HLSL output... by Ben Clayton <bclayton@google.com>
  - 38bef55da1e7d76de7634b16e96892117f3fc1be [ir] Fix consecutive calls in dependency scanner by James Price <jrprice@google.com>
  - 3aaa0a3729913277e6651299973f7a70cdb4a50f Roll partition_alloc and build dependencies. by Arthur Sonzogni <arthursonzogni@chromium.org>
GitOrigin-RevId: 8700be5806505dc847811993f27b17febcfe7197
Change-Id: I789fe5e0d38d6f519d05006fa8c0bc01adefc1b1
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/191300
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: James Price <jrprice@google.com>
diff --git a/src/tint/BUILD.gn b/src/tint/BUILD.gn
index 2544db7..13973d3 100644
--- a/src/tint/BUILD.gn
+++ b/src/tint/BUILD.gn
@@ -50,6 +50,13 @@
     "${tint_root_dir}",
     "${tint_gen_dir}",
   ]
+
+  # Some versions of MSVC ignores the [[noreturn]] on ~InternalCompilerError(),
+  # triggering a warning if it is the last statement on a function that has a
+  # return value.
+  if (!is_clang && is_win) {
+    cflags = [ "/wd4715" ]
+  }
 }
 
 config("tint_public_config") {
diff --git a/src/tint/CMakeLists.txt b/src/tint/CMakeLists.txt
index d09432f..3a5c5dd 100644
--- a/src/tint/CMakeLists.txt
+++ b/src/tint/CMakeLists.txt
@@ -154,7 +154,7 @@
     endif()
 
     # Some versions of MSVC ignores the [[noreturn]] on ~InternalCompilerError(), triggering a
-    # warning if its the last statement on a function that has a return value.
+    # warning if it is the last statement on a function that has a return value.
     target_compile_options(${TARGET} PRIVATE
       /wd4715 # not all control paths return a value
     )
diff --git a/src/tint/cmd/bench/bench.cc b/src/tint/cmd/bench/bench.cc
index f8736e1..5114ada 100644
--- a/src/tint/cmd/bench/bench.cc
+++ b/src/tint/cmd/bench/bench.cc
@@ -116,7 +116,7 @@
 
 bool Initialize() {
     if (!FindBenchmarkInputDir()) {
-        std::cerr << "failed to locate benchmark input files" << std::endl;
+        std::cerr << "failed to locate benchmark input files\n";
         return false;
     }
     return true;
diff --git a/src/tint/cmd/common/helper.cc b/src/tint/cmd/common/helper.cc
index 606dd69..498865e 100644
--- a/src/tint/cmd/common/helper.cc
+++ b/src/tint/cmd/common/helper.cc
@@ -96,20 +96,15 @@
 void PrintBindings(tint::inspector::Inspector& inspector, const std::string& ep_name) {
     auto bindings = inspector.GetResourceBindings(ep_name);
     if (!inspector.error().empty()) {
-        std::cerr << "Failed to get bindings from Inspector: " << inspector.error() << std::endl;
+        std::cerr << "Failed to get bindings from Inspector: " << inspector.error() << "\n";
         exit(1);
     }
     for (auto& binding : bindings) {
-        std::cout << "\t[" << binding.bind_group << "][" << binding.binding << "]:" << std::endl;
-        std::cout << "\t\t resource_type = " << ResourceTypeToString(binding.resource_type)
-                  << std::endl;
-        std::cout << "\t\t dim = " << TextureDimensionToString(binding.dim) << std::endl;
-        std::cout << "\t\t sampled_kind = " << SampledKindToString(binding.sampled_kind)
-                  << std::endl;
-        std::cout << "\t\t image_format = " << TexelFormatToString(binding.image_format)
-                  << std::endl;
-
-        std::cout << std::endl;
+        std::cout << "\t[" << binding.bind_group << "][" << binding.binding << "]:\n"
+                  << "\t\t resource_type = " << ResourceTypeToString(binding.resource_type) << "\n"
+                  << "\t\t dim = " << TextureDimensionToString(binding.dim) << "\n"
+                  << "\t\t sampled_kind = " << SampledKindToString(binding.sampled_kind) << "\n"
+                  << "\t\t image_format = " << TexelFormatToString(binding.image_format) << "\n\n";
     }
 }
 
@@ -138,7 +133,7 @@
 
         return prog_result.Move();
 #else
-        std::cerr << "Tint not built with the WGSL writer enabled" << std::endl;
+        std::cerr << "Tint not built with the WGSL writer enabled\n";
         exit(1);
 #endif  // TINT_BUILD_WGSL_READER
     } else {
@@ -169,9 +164,9 @@
     tint::wgsl::writer::Options options;
     auto result = tint::wgsl::writer::Generate(program, options);
     if (result == Success) {
-        out << std::endl << result->wgsl << std::endl;
+        out << "\n" << result->wgsl << "\n";
     } else {
-        out << result.Failure() << std::endl;
+        out << result.Failure() << "\n";
     }
 #else
     (void)out;
@@ -205,7 +200,7 @@
                     /* source_file */ std::move(file),
                 };
 #else
-                std::cerr << "Tint not built with the WGSL reader enabled" << std::endl;
+                std::cerr << "Tint not built with the WGSL reader enabled\n";
                 exit(1);
 #endif  // TINT_BUILD_WGSL_READER
             }
@@ -221,7 +216,7 @@
                     /* source_file */ nullptr,
                 };
 #else
-                std::cerr << "Tint not built with the SPIR-V reader enabled" << std::endl;
+                std::cerr << "Tint not built with the SPIR-V reader enabled\n";
                 exit(1);
 #endif  // TINT_BUILD_SPV_READER
             }
@@ -235,8 +230,7 @@
                 spvtools::SpirvTools tools(SPV_ENV_VULKAN_1_1);
                 tools.SetMessageConsumer([](spv_message_level_t, const char*,
                                             const spv_position_t& pos, const char* msg) {
-                    std::cerr << (pos.line + 1) << ":" << (pos.column + 1) << ": " << msg
-                              << std::endl;
+                    std::cerr << (pos.line + 1) << ":" << (pos.column + 1) << ": " << msg << "\n";
                 });
                 std::vector<uint32_t> data;
                 if (!tools.Assemble(text.data(), text.size(), &data,
@@ -252,13 +246,13 @@
                     /* source_file */ std::move(file),
                 };
 #else
-                std::cerr << "Tint not built with the SPIR-V reader enabled" << std::endl;
+                std::cerr << "Tint not built with the SPIR-V reader enabled\n";
                 exit(1);
 #endif  // TINT_BUILD_SPV_READER
             }
         }
 
-        std::cerr << "Unknown input format: " << input_format << std::endl;
+        std::cerr << "Unknown input format: " << input_format << "\n";
         exit(1);
     };
 
@@ -293,23 +287,22 @@
 void PrintInspectorData(tint::inspector::Inspector& inspector) {
     auto entry_points = inspector.GetEntryPoints();
     if (!inspector.error().empty()) {
-        std::cerr << "Failed to get entry points from Inspector: " << inspector.error()
-                  << std::endl;
+        std::cerr << "Failed to get entry points from Inspector: " << inspector.error() << "\n";
         exit(1);
     }
 
     for (auto& entry_point : entry_points) {
         std::cout << "Entry Point = " << entry_point.name << " ("
-                  << EntryPointStageToString(entry_point.stage) << ")" << std::endl;
+                  << EntryPointStageToString(entry_point.stage) << ")\n";
 
         if (entry_point.workgroup_size) {
             std::cout << "  Workgroup Size (" << entry_point.workgroup_size->x << ", "
                       << entry_point.workgroup_size->y << ", " << entry_point.workgroup_size->z
-                      << ")" << std::endl;
+                      << ")\n";
         }
 
         if (!entry_point.input_variables.empty()) {
-            std::cout << "  Input Variables:" << std::endl;
+            std::cout << "  Input Variables:\n";
 
             for (const auto& var : entry_point.input_variables) {
                 std::cout << "\t";
@@ -321,11 +314,11 @@
                 if (auto color = var.attributes.color) {
                     std::cout << "@color(" << color.value() << ") ";
                 }
-                std::cout << var.name << std::endl;
+                std::cout << var.name << "\n";
             }
         }
         if (!entry_point.output_variables.empty()) {
-            std::cout << "  Output Variables:" << std::endl;
+            std::cout << "  Output Variables:\n";
 
             for (const auto& var : entry_point.output_variables) {
                 std::cout << "\t";
@@ -333,49 +326,47 @@
                 if (auto location = var.attributes.location) {
                     std::cout << "@location(" << location.value() << ") ";
                 }
-                std::cout << var.name << std::endl;
+                std::cout << var.name << "\n";
             }
         }
         if (!entry_point.overrides.empty()) {
-            std::cout << "  Overrides:" << std::endl;
+            std::cout << "  Overrides:\n";
 
             for (const auto& var : entry_point.overrides) {
-                std::cout << "\tname: " << var.name << std::endl;
-                std::cout << "\tid: " << var.id.value << std::endl;
+                std::cout << "\tname: " << var.name << "\n";
+                std::cout << "\tid: " << var.id.value << "\n";
             }
         }
 
         auto bindings = inspector.GetResourceBindings(entry_point.name);
         if (!inspector.error().empty()) {
-            std::cerr << "Failed to get bindings from Inspector: " << inspector.error()
-                      << std::endl;
+            std::cerr << "Failed to get bindings from Inspector: " << inspector.error() << "\n";
             exit(1);
         }
 
         if (!bindings.empty()) {
-            std::cout << "  Bindings:" << std::endl;
+            std::cout << "  Bindings:\n";
             PrintBindings(inspector, entry_point.name);
-            std::cout << std::endl;
+            std::cout << "\n";
         }
 
-        std::cout << std::endl;
+        std::cout << "\n";
     }
 }
 
 void PrintInspectorBindings(tint::inspector::Inspector& inspector) {
-    std::cout << std::string(80, '-') << std::endl;
+    std::cout << std::string(80, '-') << "\n";
     auto entry_points = inspector.GetEntryPoints();
     if (!inspector.error().empty()) {
-        std::cerr << "Failed to get entry points from Inspector: " << inspector.error()
-                  << std::endl;
+        std::cerr << "Failed to get entry points from Inspector: " << inspector.error() << "\n";
         exit(1);
     }
 
     for (auto& entry_point : entry_points) {
-        std::cout << "Entry Point = " << entry_point.name << std::endl;
+        std::cout << "Entry Point = " << entry_point.name << "\n";
         PrintBindings(inspector, entry_point.name);
     }
-    std::cout << std::string(80, '-') << std::endl;
+    std::cout << std::string(80, '-') << "\n";
 }
 
 std::string EntryPointStageToString(tint::inspector::PipelineStage stage) {
diff --git a/src/tint/cmd/common/helper.h b/src/tint/cmd/common/helper.h
index 0bfb820..7be30eb 100644
--- a/src/tint/cmd/common/helper.h
+++ b/src/tint/cmd/common/helper.h
@@ -140,7 +140,7 @@
 template <typename T>
 bool ReadFile(const std::string& input_file, std::vector<T>* buffer) {
     if (!buffer) {
-        std::cerr << "The buffer pointer was null" << std::endl;
+        std::cerr << "The buffer pointer was null\n";
         return false;
     }
 
@@ -151,7 +151,7 @@
     file = fopen(input_file.c_str(), "rb");
 #endif
     if (!file) {
-        std::cerr << "Failed to open " << input_file << std::endl;
+        std::cerr << "Failed to open " << input_file << "\n";
         return false;
     }
 
@@ -160,8 +160,7 @@
     if (0 != (file_size % sizeof(T))) {
         std::cerr << "File " << input_file
                   << " does not contain an integral number of objects: " << file_size
-                  << " bytes in the file, require " << sizeof(T) << " bytes per object"
-                  << std::endl;
+                  << " bytes in the file, require " << sizeof(T) << " bytes per object\n";
         fclose(file);
         return false;
     }
@@ -173,7 +172,7 @@
     size_t bytes_read = fread(buffer->data(), 1, file_size, file);
     fclose(file);
     if (bytes_read != file_size) {
-        std::cerr << "Failed to read " << input_file << std::endl;
+        std::cerr << "Failed to read " << input_file << "\n";
         return false;
     }
 
diff --git a/src/tint/cmd/fuzz/wgsl/fuzz.cc b/src/tint/cmd/fuzz/wgsl/fuzz.cc
index b5467bc..04c362e 100644
--- a/src/tint/cmd/fuzz/wgsl/fuzz.cc
+++ b/src/tint/cmd/fuzz/wgsl/fuzz.cc
@@ -67,8 +67,8 @@
 thread_local std::string_view currently_running;
 
 [[noreturn]] void TintInternalCompilerErrorReporter(const tint::InternalCompilerError& err) {
-    std::cerr << "ICE while running fuzzer: '" << currently_running << "'" << std::endl;
-    std::cerr << err.Error() << std::endl;
+    std::cerr << "ICE while running fuzzer: '" << currently_running << "'\n";
+    std::cerr << err.Error() << "\n";
     __builtin_trap();
 }
 
@@ -154,8 +154,7 @@
     auto program = tint::wgsl::reader::Parse(&file, parse_options);
     if (!program.IsValid()) {
         if (options.verbose) {
-            std::cerr << "invalid WGSL program: " << std::endl
-                      << program.Diagnostics() << std::endl;
+            std::cerr << "invalid WGSL program:\n" << program.Diagnostics() << "\n";
         }
         return;
     }
@@ -178,7 +177,7 @@
                 auto& fuzzer = Fuzzers()[i];
                 currently_running = fuzzer.name;
                 if (context.options.verbose) {
-                    std::cout << " • [" << i << "] Running: " << currently_running << std::endl;
+                    std::cout << " • [" << i << "] Running: " << currently_running << "\n";
                 }
                 fuzzer.fn(program, context, data);
             }));
@@ -195,7 +194,7 @@
 
             currently_running = fuzzer.name;
             if (options.verbose) {
-                std::cout << " • Running: " << currently_running << std::endl;
+                std::cout << " • Running: " << currently_running << "\n";
             }
             fuzzer.fn(program, context, data);
         }
diff --git a/src/tint/cmd/fuzz/wgsl/main_fuzz.cc b/src/tint/cmd/fuzz/wgsl/main_fuzz.cc
index 06489f1..733190d 100644
--- a/src/tint/cmd/fuzz/wgsl/main_fuzz.cc
+++ b/src/tint/cmd/fuzz/wgsl/main_fuzz.cc
@@ -61,9 +61,10 @@
     }
 
     auto show_help = [&] {
-        std::cerr << "Custom fuzzer options:" << std::endl;
+        std::cerr << "Custom fuzzer options:\n";
         opts.ShowHelp(std::cerr);
-        std::cerr << std::endl;
+        std::cerr << "\n";
+
         // Change args to show libfuzzer help
         std::cerr << "Standard libfuzzer ";  // libfuzzer will print 'Usage:'
         static char help[] = "-help=1";
diff --git a/src/tint/cmd/info/main.cc b/src/tint/cmd/info/main.cc
index 26f6df2..97623d0 100644
--- a/src/tint/cmd/info/main.cc
+++ b/src/tint/cmd/info/main.cc
@@ -72,12 +72,12 @@
             opts->emit_json = true;
         } else if (!arg.empty()) {
             if (arg[0] == '-') {
-                std::cerr << "Unrecognized option: " << arg << std::endl;
+                std::cerr << "Unrecognized option: " << arg << "\n";
                 return false;
             }
             if (!opts->input_filename.empty()) {
                 std::cerr << "More than one input file specified: '" << opts->input_filename
-                          << "' and '" << arg << "'" << std::endl;
+                          << "' and '" << arg << "'\n";
                 return false;
             }
             opts->input_filename = arg;
@@ -89,8 +89,7 @@
 void EmitJson(const tint::Program& program) {
     tint::inspector::Inspector inspector(program);
 
-    std::cout << "{" << std::endl;
-    std::cout << "\"extensions\": [" << std::endl;
+    std::cout << "{\n\"extensions\": [\n";
 
     if (!inspector.GetUsedExtensionNames().empty()) {
         bool first = true;
@@ -99,38 +98,32 @@
                 std::cout << ",";
             }
             first = false;
-            std::cout << "\"" << name << "\"" << std::endl;
+            std::cout << "\"" << name << "\"\n";
         }
     }
-    std::cout << "]," << std::endl;
-
+    std::cout << "],\n";
     std::cout << "\"entry_points\": [";
 
     auto stage_var = [&](const tint::inspector::StageVariable& var) {
-        std::cout << std::endl;
-        std::cout << "{" << std::endl;
-        std::cout << "\"name\": \"" << var.name << "\"";
-        std::cout << "," << std::endl;
+        std::cout << "\n{\n\"name\": \"" << var.name << "\",\n";
         if (auto location = var.attributes.location) {
-            std::cout << "\"location\": " << location.value() << "," << std::endl;
-            std::cout << "\"interpolation\": {" << std::endl;
-            std::cout << "\"type\": \""
-                      << tint::cmd::InterpolationTypeToString(var.interpolation_type) << "\","
-                      << std::endl;
-            std::cout << "\"sampling\": \""
+            std::cout << "\"location\": " << location.value() << ",\n"
+                      << "\"interpolation\": {\n"
+                      << "\"type\": \""
+                      << tint::cmd::InterpolationTypeToString(var.interpolation_type) << "\",\n"
+                      << "\"sampling\": \""
                       << tint::cmd::InterpolationSamplingToString(var.interpolation_sampling)
-                      << "\"" << std::endl;
-            std::cout << "}," << std::endl;
+                      << "\"\n"
+                      << "},\n";
         }
         if (auto color = var.attributes.color) {
-            std::cout << "\"color\": " << color.value() << "," << std::endl;
+            std::cout << "\"color\": " << color.value() << ",\n";
         }
         std::cout << "\"component_type\": \""
-                  << tint::cmd::ComponentTypeToString(var.component_type) << "\"," << std::endl;
-        std::cout << "\"composition_type\": \""
-                  << tint::cmd::CompositionTypeToString(var.composition_type) << "\"" << std::endl;
-        std::cout << std::endl;
-        std::cout << "}";
+                  << tint::cmd::ComponentTypeToString(var.component_type) << "\",\n"
+                  << "\"composition_type\": \""
+                  << tint::cmd::CompositionTypeToString(var.composition_type) << "\"\n\n"
+                  << "}";
     };
 
     auto entry_points = inspector.GetEntryPoints();
@@ -141,20 +134,15 @@
         }
         first = false;
 
-        std::cout << std::endl;
-        std::cout << "{" << std::endl;
-
-        std::cout << "\"name\": \"" << entry_point.name << "\""
-                  << "," << std::endl;
-        std::cout << "\"stage\": \"" << tint::cmd::EntryPointStageToString(entry_point.stage)
-                  << "\""
-                  << "," << std::endl;
+        std::cout << "\n{\n"
+                  << "\"name\": \"" << entry_point.name << "\",\n"
+                  << "\"stage\": \"" << tint::cmd::EntryPointStageToString(entry_point.stage)
+                  << "\",\n";
 
         if (entry_point.workgroup_size) {
             std::cout << "\"workgroup_size\": [";
             std::cout << entry_point.workgroup_size->x << ", " << entry_point.workgroup_size->y
-                      << ", " << entry_point.workgroup_size->z << "]"
-                      << "," << std::endl;
+                      << ", " << entry_point.workgroup_size->z << "],\n";
         }
 
         std::cout << "\"input_variables\": [";
@@ -166,10 +154,7 @@
             input_first = false;
             stage_var(var);
         }
-        std::cout << std::endl
-                  << "]"
-                  << "," << std::endl;
-
+        std::cout << "\n],\n";
         std::cout << "\"output_variables\": [";
         bool output_first = true;
         for (const auto& var : entry_point.output_variables) {
@@ -179,10 +164,7 @@
             output_first = false;
             stage_var(var);
         }
-        std::cout << std::endl
-                  << "]"
-                  << "," << std::endl;
-
+        std::cout << "\n],\n";
         std::cout << "\"overrides\": [";
 
         bool override_first = true;
@@ -192,21 +174,15 @@
             }
             override_first = false;
 
-            std::cout << std::endl;
-            std::cout << "{" << std::endl;
-            std::cout << "\"name\": \"" << var.name << "\"," << std::endl;
-            std::cout << "\"id\": " << var.id.value << "," << std::endl;
-            std::cout << "\"type\": \"" << tint::cmd::OverrideTypeToString(var.type) << "\","
-                      << std::endl;
-            std::cout << "\"is_initialized\": " << (var.is_initialized ? "true" : "false") << ","
-                      << std::endl;
-            std::cout << "\"is_id_specified\": " << (var.is_id_specified ? "true" : "false")
-                      << std::endl;
-            std::cout << "}";
+            std::cout << "\n{\n"
+                      << "\"name\": \"" << var.name << "\",\n"
+                      << "\"id\": " << var.id.value << ",\n"
+                      << "\"type\": \"" << tint::cmd::OverrideTypeToString(var.type) << "\",\n"
+                      << "\"is_initialized\": " << (var.is_initialized ? "true" : "false") << ",\n"
+                      << "\"is_id_specified\": " << (var.is_id_specified ? "true" : "false")
+                      << "\n}";
         }
-        std::cout << std::endl
-                  << "]"
-                  << "," << std::endl;
+        std::cout << "\n],\n";
 
         std::cout << "\"bindings\": [";
         auto bindings = inspector.GetResourceBindings(entry_point.name);
@@ -217,26 +193,24 @@
             }
             ep_first = false;
 
-            std::cout << std::endl;
-            std::cout << "{" << std::endl;
-            std::cout << "\"binding\": " << binding.binding << "," << std::endl;
-            std::cout << "\"group\": " << binding.bind_group << "," << std::endl;
-            std::cout << "\"size\": " << binding.size << "," << std::endl;
-            std::cout << "\"resource_type\": \""
-                      << tint::cmd::ResourceTypeToString(binding.resource_type) << "\","
-                      << std::endl;
-            std::cout << "\"dimemsions\": \"" << tint::cmd::TextureDimensionToString(binding.dim)
-                      << "\"," << std::endl;
-            std::cout << "\"sampled_kind\": \""
-                      << tint::cmd::SampledKindToString(binding.sampled_kind) << "\"," << std::endl;
-            std::cout << "\"image_format\": \""
-                      << tint::cmd::TexelFormatToString(binding.image_format) << "\"" << std::endl;
-            std::cout << "}";
+            std::cout << "\n{\n"
+                      << "\"binding\": " << binding.binding << ",\n"
+                      << "\"group\": " << binding.bind_group << ",\n"
+                      << "\"size\": " << binding.size << ",\n"
+                      << "\"resource_type\": \""
+                      << tint::cmd::ResourceTypeToString(binding.resource_type) << "\",\n"
+                      << "\"dimemsions\": \"" << tint::cmd::TextureDimensionToString(binding.dim)
+                      << "\",\n"
+                      << "\"sampled_kind\": \""
+                      << tint::cmd::SampledKindToString(binding.sampled_kind) << "\",\n"
+                      << "\"image_format\": \""
+                      << tint::cmd::TexelFormatToString(binding.image_format) << "\"\n"
+                      << "}";
         }
-        std::cout << std::endl << "]" << std::endl;
+        std::cout << "\n]\n";
         std::cout << "}";
     }
-    std::cout << std::endl << "]," << std::endl;
+    std::cout << "\n],\n";
     std::cout << "\"structures\": [";
 
     bool struct_first = true;
@@ -251,19 +225,18 @@
         }
         struct_first = false;
 
-        std::cout << std::endl;
-        std::cout << "{" << std::endl;
-        std::cout << "\"name\": \"" << s->FriendlyName() << "\"," << std::endl;
-        std::cout << "\"align\": " << s->Align() << "," << std::endl;
-        std::cout << "\"size\": " << s->Size() << "," << std::endl;
-        std::cout << "\"members\": [";
+        std::cout << "\n{\n"
+                  << "\"name\": \"" << s->FriendlyName() << "\",\n"
+                  << "\"align\": " << s->Align() << ",\n"
+                  << "\"size\": " << s->Size() << ",\n"
+                  << "\"members\": [";
         for (size_t i = 0; i < s->Members().Length(); ++i) {
             auto* const m = s->Members()[i];
 
             if (i != 0) {
                 std::cout << ",";
             }
-            std::cout << std::endl;
+            std::cout << "\n";
 
             // Output field alignment padding, if any
             auto* const prev_member = (i == 0) ? nullptr : s->Members()[i - 1];
@@ -271,39 +244,35 @@
                 uint32_t padding = m->Offset() - (prev_member->Offset() + prev_member->Size());
                 if (padding > 0) {
                     size_t padding_offset = m->Offset() - padding;
-                    std::cout << "{" << std::endl;
-                    std::cout << "\"name\": \"implicit_padding\"," << std::endl;
-                    std::cout << "\"offset\": " << padding_offset << "," << std::endl;
-                    std::cout << "\"align\": 1," << std::endl;
-                    std::cout << "\"size\": " << padding << std::endl;
-                    std::cout << "}," << std::endl;
+                    std::cout << "{\n"
+                              << "\"name\": \"implicit_padding\",\n"
+                              << "\"offset\": " << padding_offset << ",\n"
+                              << "\"align\": 1,\n"
+                              << "\"size\": " << padding << "\n},\n";
                 }
             }
 
-            std::cout << "{" << std::endl;
-            std::cout << "\"name\": \"" << m->Name().Name() << "\"," << std::endl;
-            std::cout << "\"offset\": " << m->Offset() << "," << std::endl;
-            std::cout << "\"align\": " << m->Align() << "," << std::endl;
-            std::cout << "\"size\": " << m->Size() << std::endl;
-            std::cout << "}";
+            std::cout << "{\n"
+                      << "\"name\": \"" << m->Name().Name() << "\",\n"
+                      << "\"offset\": " << m->Offset() << ",\n"
+                      << "\"align\": " << m->Align() << ",\n"
+                      << "\"size\": " << m->Size() << "\n}";
         }
-        std::cout << std::endl << "]" << std::endl;
-        std::cout << "}";
+        std::cout << "\n]\n}";
     }
-    std::cout << std::endl << "]" << std::endl;
-    std::cout << "}" << std::endl;
+    std::cout << "\n]\n}\n";
 }
 
 void EmitText(const tint::Program& program) {
     auto printer = tint::StyledTextPrinter::Create(stdout);
     tint::inspector::Inspector inspector(program);
     if (!inspector.GetUsedExtensionNames().empty()) {
-        std::cout << "Extensions:" << std::endl;
+        std::cout << "Extensions:\n";
         for (const auto& name : inspector.GetUsedExtensionNames()) {
-            std::cout << "\t" << name << std::endl;
+            std::cout << "\t" << name << "\n";
         }
     }
-    std::cout << std::endl;
+    std::cout << "\n";
 
     tint::cmd::PrintInspectorData(inspector);
 
@@ -317,7 +286,7 @@
     }
 
     if (has_struct) {
-        std::cout << "Structures" << std::endl;
+        std::cout << "Structures\n";
         for (const auto* ty : program.Types()) {
             if (!ty->Is<tint::core::type::Struct>()) {
                 continue;
@@ -337,12 +306,12 @@
     tint::SetInternalCompilerErrorReporter(&tint::cmd::TintInternalCompilerErrorReporter);
 
     if (!ParseArgs(args, &options)) {
-        std::cerr << "Failed to parse arguments." << std::endl;
+        std::cerr << "Failed to parse arguments.\n";
         return 1;
     }
 
     if (options.show_help) {
-        std::cout << kUsage << std::endl;
+        std::cout << kUsage << "\n";
         return 0;
     }
 
diff --git a/src/tint/cmd/loopy/main.cc b/src/tint/cmd/loopy/main.cc
index 7703f7a..37a6b4b 100644
--- a/src/tint/cmd/loopy/main.cc
+++ b/src/tint/cmd/loopy/main.cc
@@ -147,13 +147,13 @@
         if (arg == "--format") {
             ++i;
             if (i >= args.size()) {
-                std::cerr << "Missing value for --format argument." << std::endl;
+                std::cerr << "Missing value for --format argument.\n";
                 return false;
             }
             opts->format = parse_format(args[i]);
 
             if (opts->format == Format::kUnknown) {
-                std::cerr << "Unknown output format: " << args[i] << std::endl;
+                std::cerr << "Unknown output format: " << args[i] << "\n";
                 return false;
             }
         } else if (arg == "-h" || arg == "--help") {
@@ -161,7 +161,7 @@
         } else if (arg == "--loop") {
             ++i;
             if (i >= args.size()) {
-                std::cerr << "Missing value for --loop argument." << std::endl;
+                std::cerr << "Missing value for --loop argument.\n";
                 return false;
             }
             if (args[i] == "load") {
@@ -171,29 +171,29 @@
             } else if (args[i] == "writer") {
                 opts->loop = Looper::kWriter;
             } else {
-                std::cerr << "Invalid loop value" << std::endl;
+                std::cerr << "Invalid loop value\n";
                 return false;
             }
         } else if (arg == "--loop-count") {
             ++i;
             if (i >= args.size()) {
-                std::cerr << "Missing value for --loop-count argument." << std::endl;
+                std::cerr << "Missing value for --loop-count argument.\n";
                 return false;
             }
             int32_t val = atoi(args[i].c_str());
             if (val <= 0) {
-                std::cerr << "Loop count must be greater then 0" << std::endl;
+                std::cerr << "Loop count must be greater then 0\n";
                 return false;
             }
             opts->loop_count = static_cast<uint32_t>(val);
         } else if (!arg.empty()) {
             if (arg[0] == '-') {
-                std::cerr << "Unrecognized option: " << arg << std::endl;
+                std::cerr << "Unrecognized option: " << arg << "\n";
                 return false;
             }
             if (!opts->input_filename.empty()) {
                 std::cerr << "More than one input file specified: '" << opts->input_filename
-                          << "' and '" << arg << "'" << std::endl;
+                          << "' and '" << arg << "'\n";
                 return false;
             }
             opts->input_filename = arg;
@@ -212,13 +212,13 @@
     auto result = tint::spirv::writer::Generate(program, gen_options);
     if (result != tint::Success) {
         tint::cmd::PrintWGSL(std::cerr, program);
-        std::cerr << "Failed to generate: " << result.Failure() << std::endl;
+        std::cerr << "Failed to generate: " << result.Failure() << "\n";
         return false;
     }
     return true;
 #else
     (void)program;
-    std::cerr << "SPIR-V writer not enabled in tint build" << std::endl;
+    std::cerr << "SPIR-V writer not enabled in tint build\n";
     return false;
 #endif  // TINT_BUILD_SPV_WRITER
 }
@@ -231,14 +231,14 @@
     tint::wgsl::writer::Options gen_options;
     auto result = tint::wgsl::writer::Generate(program, gen_options);
     if (result != tint::Success) {
-        std::cerr << "Failed to generate: " << result.Failure() << std::endl;
+        std::cerr << "Failed to generate: " << result.Failure() << "\n";
         return false;
     }
 
     return true;
 #else
     (void)program;
-    std::cerr << "WGSL writer not enabled in tint build" << std::endl;
+    std::cerr << "WGSL writer not enabled in tint build\n";
     return false;
 #endif  // TINT_BUILD_WGSL_WRITER
 }
@@ -248,7 +248,7 @@
 /// @returns true on success
 bool GenerateMsl([[maybe_unused]] const tint::Program& program) {
 #if !TINT_BUILD_MSL_WRITER
-    std::cerr << "MSL writer not enabled in tint build" << std::endl;
+    std::cerr << "MSL writer not enabled in tint build\n";
     return false;
 #else
     // Remap resource numbers to a flat namespace.
@@ -269,7 +269,7 @@
     auto result = tint::msl::writer::Generate(*input_program, gen_options);
     if (result != tint::Success) {
         tint::cmd::PrintWGSL(std::cerr, program);
-        std::cerr << "Failed to generate: " << result.Failure() << std::endl;
+        std::cerr << "Failed to generate: " << result.Failure() << "\n";
         return false;
     }
 
@@ -287,14 +287,14 @@
     auto result = tint::hlsl::writer::Generate(program, gen_options);
     if (result != tint::Success) {
         tint::cmd::PrintWGSL(std::cerr, program);
-        std::cerr << "Failed to generate: " << result.Failure() << std::endl;
+        std::cerr << "Failed to generate: " << result.Failure() << "\n";
         return false;
     }
 
     return true;
 #else
     (void)program;
-    std::cerr << "HLSL writer not enabled in tint build" << std::endl;
+    std::cerr << "HLSL writer not enabled in tint build\n";
     return false;
 #endif  // TINT_BUILD_HLSL_WRITER
 }
@@ -310,7 +310,7 @@
     auto result = tint::glsl::writer::Generate(program, gen_options, "");
     if (result == tint::Success) {
         tint::cmd::PrintWGSL(std::cerr, program);
-        std::cerr << "Failed to generate: " << result.Failure() << std::endl;
+        std::cerr << "Failed to generate: " << result.Failure() << "\n";
         return false;
     }
 
@@ -318,7 +318,7 @@
 
 #else
     (void)program;
-    std::cerr << "GLSL writer not enabled in tint build" << std::endl;
+    std::cerr << "GLSL writer not enabled in tint build\n";
     return false;
 #endif  // TINT_BUILD_GLSL_WRITER
 }
@@ -333,12 +333,12 @@
     tint::SetInternalCompilerErrorReporter(&tint::cmd::TintInternalCompilerErrorReporter);
 
     if (!ParseArgs(args, &options)) {
-        std::cerr << "Failed to parse arguments." << std::endl;
+        std::cerr << "Failed to parse arguments.\n";
         return 1;
     }
 
     if (options.show_help) {
-        std::cout << kUsage << std::endl;
+        std::cout << kUsage << "\n";
         return 0;
     }
 
@@ -367,7 +367,7 @@
                     std::make_unique<tint::Program>(tint::wgsl::reader::Parse(source_file.get()));
             }
 #else
-            std::cerr << "Tint not built with the WGSL reader enabled" << std::endl;
+            std::cerr << "Tint not built with the WGSL reader enabled\n";
             exit(1);
 #endif  // TINT_BUILD_WGSL_READER
         } else {
@@ -382,7 +382,7 @@
                 program = std::make_unique<tint::Program>(tint::spirv::reader::Read(data, {}));
             }
 #else
-            std::cerr << "Tint not built with the SPIR-V reader enabled" << std::endl;
+            std::cerr << "Tint not built with the SPIR-V reader enabled\n";
             exit(1);
 #endif  // TINT_BUILD_SPV_READER
         }
@@ -402,7 +402,7 @@
         for (uint32_t i = 0; i < loop_count; ++i) {
             auto result = tint::wgsl::reader::ProgramToIR(info.program);
             if (result != tint::Success) {
-                std::cerr << "Failed to build IR from program: " << result.Failure() << std::endl;
+                std::cerr << "Failed to build IR from program: " << result.Failure() << "\n";
             }
         }
     }
@@ -444,7 +444,7 @@
             case Format::kNone:
                 break;
             default:
-                std::cerr << "Unknown output format specified" << std::endl;
+                std::cerr << "Unknown output format specified\n";
                 return 1;
         }
     }
diff --git a/src/tint/cmd/tint/main.cc b/src/tint/cmd/tint/main.cc
index 5203fec..b2dc66c 100644
--- a/src/tint/cmd/tint/main.cc
+++ b/src/tint/cmd/tint/main.cc
@@ -638,13 +638,13 @@
             auto values = tint::Split(binding_format, "=");
             if (values.Length() != 2) {
                 std::cerr << "Invalid binding format " << pixel_local_attachment_formats.name
-                          << ": " << binding_format << std::endl;
+                          << ": " << binding_format << "\n";
                 return false;
             }
             auto member_index = tint::strconv::ParseUint32(values[0]);
             if (member_index != tint::Success) {
                 std::cerr << "Invalid member index for " << pixel_local_attachment_formats.name
-                          << ": " << values[0] << std::endl;
+                          << ": " << values[0] << "\n";
                 return false;
             }
             auto format = values[1];
@@ -658,7 +658,7 @@
                 texel_format = tint::PixelLocalOptions::TexelFormat::kR32Float;
             } else {
                 std::cerr << "Invalid texel format for " << pixel_local_attachments.name << ": "
-                          << format << std::endl;
+                          << format << "\n";
                 return false;
             }
             opts->pixel_local_options.attachment_formats.emplace(member_index.Get(), texel_format);
@@ -669,8 +669,7 @@
     if (hlsl_shader_model.value.has_value()) {
         uint32_t shader_model = *hlsl_shader_model.value;
         if (shader_model < kMinShaderModelForDXC || shader_model > kMaxSupportedShaderModelForDXC) {
-            std::cerr << "Invalid HLSL shader model "
-                      << ": " << shader_model << std::endl;
+            std::cerr << "Invalid HLSL shader model: " << shader_model << "\n";
             return false;
         }
         opts->hlsl_shader_model = shader_model;
@@ -837,7 +836,7 @@
 #else
     (void)program;
     (void)options;
-    std::cerr << "SPIR-V writer not enabled in tint build" << std::endl;
+    std::cerr << "SPIR-V writer not enabled in tint build\n";
     return false;
 #endif  // TINT_BUILD_SPV_WRITER
 }
@@ -883,7 +882,7 @@
 
     return true;
 #else
-    std::cerr << "WGSL writer not enabled in tint build" << std::endl;
+    std::cerr << "WGSL writer not enabled in tint build\n";
     return false;
 #endif  // TINT_BUILD_WGSL_WRITER
 }
@@ -895,7 +894,7 @@
 bool GenerateMsl([[maybe_unused]] const tint::Program& program,
                  [[maybe_unused]] const Options& options) {
 #if !TINT_BUILD_MSL_WRITER
-    std::cerr << "MSL writer not enabled in tint build" << std::endl;
+    std::cerr << "MSL writer not enabled in tint build\n";
     return false;
 #else
     // Remap resource numbers to a flat namespace.
@@ -1021,7 +1020,7 @@
     auto result = tint::hlsl::writer::Generate(program, gen_options);
     if (result != tint::Success) {
         tint::cmd::PrintWGSL(std::cerr, program);
-        std::cerr << "Failed to generate: " << result.Failure() << std::endl;
+        std::cerr << "Failed to generate: " << result.Failure() << "\n";
         return false;
     }
 
@@ -1092,28 +1091,24 @@
         }
 
         if (fxc_res.failed) {
-            std::cerr << "FXC validation failure:" << std::endl << fxc_res.output << std::endl;
+            std::cerr << "FXC validation failure:\n" << fxc_res.output << "\n";
         }
         if (dxc_res.failed) {
-            std::cerr << "DXC validation failure:" << std::endl << dxc_res.output << std::endl;
+            std::cerr << "DXC validation failure:\n" << dxc_res.output << "\n";
         }
         if (fxc_res.failed || dxc_res.failed) {
             return false;
         }
         if (!fxc_found && !dxc_found) {
-            std::cerr << "Couldn't find FXC or DXC. Cannot validate" << std::endl;
+            std::cerr << "Couldn't find FXC or DXC. Cannot validate\n";
             return false;
         }
         if (options.verbose) {
             if (fxc_found && !fxc_res.failed) {
-                std::cout << "Passed FXC validation" << std::endl;
-                std::cout << fxc_res.output;
-                std::cout << std::endl;
+                std::cout << "Passed FXC validation\n" << fxc_res.output << "\n";
             }
             if (dxc_found && !dxc_res.failed) {
-                std::cout << "Passed DXC validation" << std::endl;
-                std::cout << dxc_res.output;
-                std::cout << std::endl;
+                std::cout << "Passed DXC validation\n" << dxc_res.output << "\n";
             }
         }
     }
@@ -1134,7 +1129,7 @@
 bool GenerateGlsl([[maybe_unused]] const tint::Program& program,
                   [[maybe_unused]] const Options& options) {
 #if !TINT_BUILD_GLSL_WRITER
-    std::cerr << "GLSL writer not enabled in tint build" << std::endl;
+    std::cerr << "GLSL writer not enabled in tint build\n";
     return false;
 #else
     tint::inspector::Inspector inspector(program);
@@ -1196,7 +1191,7 @@
 
         if (options.validate && options.skip_hash.count(hash) == 0) {
 #if !TINT_BUILD_GLSL_VALIDATOR
-            std::cerr << "GLSL validator not enabled in tint build" << std::endl;
+            std::cerr << "GLSL validator not enabled in tint build\n";
             return false;
 #else
             // If there is no entry point name there is nothing to validate
@@ -1245,7 +1240,7 @@
 bool GenerateIr([[maybe_unused]] const tint::Program& program,
                 [[maybe_unused]] const Options& options) {
 #if !TINT_BUILD_WGSL_READER
-    std::cerr << "WGSL reader not enabled in tint build" << std::endl;
+    std::cerr << "WGSL reader not enabled in tint build\n";
     return false;
 #else
     auto result = tint::wgsl::reader::ProgramToLoweredIR(program);
@@ -1299,10 +1294,10 @@
 bool GenerateIrProtoBinary([[maybe_unused]] const tint::Program& program,
                            [[maybe_unused]] const Options& options) {
 #if !TINT_BUILD_WGSL_READER
-    std::cerr << "WGSL reader not enabled in tint build" << std::endl;
+    std::cerr << "WGSL reader not enabled in tint build\n";
     return false;
 #elif !TINT_BUILD_IR_BINARY
-    std::cerr << "IR binary not enabled in tint build" << std::endl;
+    std::cerr << "IR binary not enabled in tint build\n";
     return false;
 #else
     auto module = GenerateIrModule(program, options);
diff --git a/src/tint/lang/core/ir/module.cc b/src/tint/lang/core/ir/module.cc
index 49af3bb..617f00d 100644
--- a/src/tint/lang/core/ir/module.cc
+++ b/src/tint/lang/core/ir/module.cc
@@ -43,7 +43,7 @@
 template <typename F>
 struct FunctionSorter {
     /// The dependency-ordered list of functions.
-    Vector<F*, 16> ordered_functions{};
+    UniqueVector<F*, 16> ordered_functions{};
 
     /// The functions that have been visited and checked for dependencies.
     Hashset<F*, 16> visited{};
@@ -70,7 +70,7 @@
             // unvisited dependencies. We can now add it to the ordered list, and walk back down the
             // stack until we find the next unvisited function.
             while (!function_stack.IsEmpty() && visited.Contains(function_stack.Back())) {
-                ordered_functions.Push(function_stack.Pop());
+                ordered_functions.Add(function_stack.Pop());
             }
         }
     }
@@ -106,7 +106,7 @@
         for (auto& func : mod.functions) {
             sorter.Visit(func.Get());
         }
-        return std::move(sorter.ordered_functions);
+        return std::move(sorter.ordered_functions.Release());
     }
 };
 
diff --git a/src/tint/lang/core/ir/module_test.cc b/src/tint/lang/core/ir/module_test.cc
index b04ae70..21668df 100644
--- a/src/tint/lang/core/ir/module_test.cc
+++ b/src/tint/lang/core/ir/module_test.cc
@@ -68,6 +68,8 @@
         auto* ifelse = b.If(true);
         b.Append(ifelse->True(), [&] {
             b.Call(fc);
+            b.Call(fc);
+            b.Call(fc);
             b.ExitIf(ifelse);
         });
         b.Append(ifelse->False(), [&] {
diff --git a/src/tint/lang/core/ir/validator.cc b/src/tint/lang/core/ir/validator.cc
index 34906d4..512ccc6 100644
--- a/src/tint/lang/core/ir/validator.cc
+++ b/src/tint/lang/core/ir/validator.cc
@@ -1609,9 +1609,9 @@
                                             [[maybe_unused]] Capabilities capabilities) {
 #if TINT_DUMP_IR_WHEN_VALIDATING
     auto printer = StyledTextPrinter::Create(stdout);
-    std::cout << "=========================================================" << std::endl;
-    std::cout << "== IR dump before " << msg << ":" << std::endl;
-    std::cout << "=========================================================" << std::endl;
+    std::cout << "=========================================================\n";
+    std::cout << "== IR dump before " << msg << ":\n";
+    std::cout << "=========================================================\n";
     printer->Print(Disassemble(ir).Text());
 #endif
 
diff --git a/src/tint/lang/hlsl/writer/BUILD.cmake b/src/tint/lang/hlsl/writer/BUILD.cmake
index 67af1a7..5c44e5f 100644
--- a/src/tint/lang/hlsl/writer/BUILD.cmake
+++ b/src/tint/lang/hlsl/writer/BUILD.cmake
@@ -155,6 +155,7 @@
   tint_lang_hlsl_writer_common
   tint_lang_wgsl
   tint_lang_wgsl_ast
+  tint_lang_wgsl_ast_transform
   tint_lang_wgsl_features
   tint_lang_wgsl_program
   tint_lang_wgsl_sem
diff --git a/src/tint/lang/hlsl/writer/BUILD.gn b/src/tint/lang/hlsl/writer/BUILD.gn
index 2111f1c..263c7f2 100644
--- a/src/tint/lang/hlsl/writer/BUILD.gn
+++ b/src/tint/lang/hlsl/writer/BUILD.gn
@@ -136,6 +136,7 @@
       "${tint_src_dir}/lang/hlsl/writer/common",
       "${tint_src_dir}/lang/wgsl",
       "${tint_src_dir}/lang/wgsl/ast",
+      "${tint_src_dir}/lang/wgsl/ast/transform",
       "${tint_src_dir}/lang/wgsl/features",
       "${tint_src_dir}/lang/wgsl/program",
       "${tint_src_dir}/lang/wgsl/sem",
diff --git a/src/tint/lang/hlsl/writer/ast_printer/ast_printer.cc b/src/tint/lang/hlsl/writer/ast_printer/ast_printer.cc
index 2345c72..c292f98 100644
--- a/src/tint/lang/hlsl/writer/ast_printer/ast_printer.cc
+++ b/src/tint/lang/hlsl/writer/ast_printer/ast_printer.cc
@@ -3603,7 +3603,7 @@
                 }
                 out << std::to_string(wgsize[i].value());
             }
-            out << ")]" << std::endl;
+            out << ")]\n";
         }
 
         if (!EmitTypeAndName(out, func_sem->ReturnType(), core::AddressSpace::kUndefined,
diff --git a/src/tint/lang/hlsl/writer/writer_ast_fuzz.cc b/src/tint/lang/hlsl/writer/writer_ast_fuzz.cc
index 568a636..2c360d3 100644
--- a/src/tint/lang/hlsl/writer/writer_ast_fuzz.cc
+++ b/src/tint/lang/hlsl/writer/writer_ast_fuzz.cc
@@ -27,6 +27,8 @@
 
 // GEN_BUILD:CONDITION(tint_build_wgsl_reader)
 
+#include <iostream>
+#include <sstream>
 #include <string>
 #include <unordered_map>
 
@@ -34,7 +36,9 @@
 #include "src/tint/lang/hlsl/validate/validate.h"
 #include "src/tint/lang/hlsl/writer/writer.h"
 #include "src/tint/lang/wgsl/ast/module.h"
+#include "src/tint/lang/wgsl/ast/transform/renamer.h"
 #include "src/tint/utils/command/command.h"
+#include "src/tint/utils/text/string.h"
 
 namespace tint::hlsl::writer {
 namespace {
@@ -44,38 +48,61 @@
         return;
     }
 
-    auto res = tint::hlsl::writer::Generate(program, options);
-    if (res == Success) {
-        const char* dxc_path = validate::kDxcDLLName;
-        bool must_validate = false;
-        if (!context.options.dxc.empty()) {
-            must_validate = true;
-            dxc_path = context.options.dxc.c_str();
+    // Currently disabled, as DXC can error on HLSL emitted by Tint. For example: post optimization
+    // infinite loops will fail to compile, but these are beyond Tint's analysis capabilities.
+    constexpr bool must_validate = false;
+
+    const char* dxc_path = validate::kDxcDLLName;
+    Result<tint::hlsl::writer::Output> res;
+    if (!context.options.dxc.empty()) {
+        dxc_path = context.options.dxc.c_str();
+        ast::transform::DataMap inputs, outputs;
+        inputs.Add<ast::transform::Renamer::Config>(ast::transform::Renamer::Target::kHlslKeywords,
+                                                    /* preserve_unicode */ false);
+        if (auto renamer_res = tint::ast::transform::Renamer{}.Apply(program, inputs, outputs)) {
+            if (!renamer_res->IsValid()) {
+                TINT_ICE() << renamer_res->Diagnostics();
+            }
+            res = tint::hlsl::writer::Generate(*renamer_res, options);
         }
 
-        auto dxc = tint::Command::LookPath(dxc_path);
-        if (dxc.Found()) {
-            uint32_t hlsl_shader_model = 60;
-            bool require_16bit_types = false;
-            auto enable_list = program.AST().Enables();
-            for (auto* enable : enable_list) {
-                if (enable->HasExtension(tint::wgsl::Extension::kF16)) {
-                    hlsl_shader_model = 62;
-                    require_16bit_types = true;
-                    break;
-                }
+    } else {
+        res = tint::hlsl::writer::Generate(program, options);
+    }
+
+    if (res != Success) {
+        return;
+    }
+
+    auto dxc = tint::Command::LookPath(dxc_path);
+    if (dxc.Found()) {
+        uint32_t hlsl_shader_model = 60;
+        bool require_16bit_types = false;
+        auto enable_list = program.AST().Enables();
+        for (auto* enable : enable_list) {
+            if (enable->HasExtension(tint::wgsl::Extension::kF16)) {
+                hlsl_shader_model = 62;
+                require_16bit_types = true;
+                break;
             }
-
-            auto validate_res = validate::ValidateUsingDXC(dxc.Path(), res->hlsl, res->entry_points,
-                                                           require_16bit_types, hlsl_shader_model);
-
-            if (must_validate && validate_res.failed) {
-                TINT_ICE() << "DXC was expected to succeed, but failed: " << validate_res.output;
-            }
-
-        } else if (must_validate) {
-            TINT_ICE() << "DXC path was explicitly specified, but was not found: " << dxc_path;
         }
+
+        auto validate_res = validate::ValidateUsingDXC(dxc.Path(), res->hlsl, res->entry_points,
+                                                       require_16bit_types, hlsl_shader_model);
+
+        if (must_validate && validate_res.failed) {
+            size_t line_num = 1;
+            std::stringstream err;
+            err << "DXC was expected to succeed, but failed:\n\n";
+            for (auto line : Split(res->hlsl, "\n")) {
+                err << line_num++ << ": " << line << "\n";
+            }
+            err << "\n\n" << validate_res.output;
+            TINT_ICE() << err.str();
+        }
+
+    } else if (must_validate) {
+        TINT_ICE() << "cannot validate with DXC as it was not found at: " << dxc_path;
     }
 }
 
diff --git a/src/tint/lang/msl/writer/printer/printer.cc b/src/tint/lang/msl/writer/printer/printer.cc
index 71b31a0..f3c0d79 100644
--- a/src/tint/lang/msl/writer/printer/printer.cc
+++ b/src/tint/lang/msl/writer/printer/printer.cc
@@ -127,7 +127,7 @@
         }
 
         StringStream ss;
-        ss << preamble_buffer_.String() << std::endl << main_buffer_.String();
+        ss << preamble_buffer_.String() << "\n" << main_buffer_.String();
         result_.msl = ss.str();
 
         return std::move(result_);
diff --git a/src/tint/lang/msl/writer/raise/shader_io.cc b/src/tint/lang/msl/writer/raise/shader_io.cc
index c4c8839..768a168 100644
--- a/src/tint/lang/msl/writer/raise/shader_io.cc
+++ b/src/tint/lang/msl/writer/raise/shader_io.cc
@@ -155,7 +155,7 @@
     core::ir::Value* GetInput(core::ir::Builder& builder, uint32_t idx) override {
         auto index = input_indices[idx];
         auto* param = input_params[index.param_index];
-        if (auto* str = param->Type()->As<core::type::Struct>()) {
+        if (param->Type()->Is<core::type::Struct>()) {
             return builder.Access(inputs[idx].type, param, u32(index.member_index))->Result(0);
         } else {
             return param;
diff --git a/src/tint/lang/spirv/reader/ast_parser/function_cfg_test.cc b/src/tint/lang/spirv/reader/ast_parser/function_cfg_test.cc
index 015ffc8..4878a7f 100644
--- a/src/tint/lang/spirv/reader/ast_parser/function_cfg_test.cc
+++ b/src/tint/lang/spirv/reader/ast_parser/function_cfg_test.cc
@@ -2613,7 +2613,7 @@
     EXPECT_FALSE(fe.VerifyHeaderContinueMergeOrder());
 
     tint::StringStream result;
-    result << *fe.GetBlockInfo(50) << std::endl << *fe.GetBlockInfo(20) << std::endl;
+    result << *fe.GetBlockInfo(50) << "\n" << *fe.GetBlockInfo(20) << "\n";
     EXPECT_THAT(p->error(), Eq("Header 50 does not strictly dominate its merge block 20"))
         << result.str() << Dump(fe.block_order());
 }
@@ -2649,7 +2649,7 @@
     fe.RegisterMerges();
     EXPECT_FALSE(fe.VerifyHeaderContinueMergeOrder());
     tint::StringStream str;
-    str << *fe.GetBlockInfo(50) << std::endl << *fe.GetBlockInfo(20) << std::endl;
+    str << *fe.GetBlockInfo(50) << "\n" << *fe.GetBlockInfo(20) << "\n";
     EXPECT_THAT(p->error(), Eq("Loop header 50 does not dominate its continue target 20"))
         << str.str() << Dump(fe.block_order());
 }
diff --git a/src/tint/lang/spirv/reader/ast_parser/function_var_test.cc b/src/tint/lang/spirv/reader/ast_parser/function_var_test.cc
index 6b678e3..e8e562c 100644
--- a/src/tint/lang/spirv/reader/ast_parser/function_var_test.cc
+++ b/src/tint/lang/spirv/reader/ast_parser/function_var_test.cc
@@ -465,8 +465,7 @@
      OpFunctionEnd
   )";
     auto p = parser(test::Assemble(assembly));
-    ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions())
-        << assembly << p->error() << std::endl;
+    ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << assembly << p->error() << "\n";
     auto fe = p->function_emitter(100);
     EXPECT_TRUE(fe.EmitFunctionVariables());
 
diff --git a/src/tint/lang/spirv/reader/ast_parser/handle_test.cc b/src/tint/lang/spirv/reader/ast_parser/handle_test.cc
index dd05ded..31f9a12 100644
--- a/src/tint/lang/spirv/reader/ast_parser/handle_test.cc
+++ b/src/tint/lang/spirv/reader/ast_parser/handle_test.cc
@@ -956,9 +956,9 @@
      OpFunctionEnd
   )";
     auto p = parser(test::Assemble(assembly));
-    ASSERT_TRUE(p->BuildInternalModule()) << p->error() << assembly << std::endl;
-    EXPECT_TRUE(p->RegisterHandleUsage()) << p->error() << assembly << std::endl;
-    EXPECT_TRUE(p->error().empty()) << p->error() << assembly << std::endl;
+    ASSERT_TRUE(p->BuildInternalModule()) << p->error() << assembly << "\n";
+    EXPECT_TRUE(p->RegisterHandleUsage()) << p->error() << assembly << "\n";
+    EXPECT_TRUE(p->error().empty()) << p->error() << assembly << "\n";
     Usage su = p->GetHandleUsage(10);
     Usage iu = p->GetHandleUsage(20);
 
@@ -3087,7 +3087,7 @@
     for (auto e : c.expected_expressions) {
         out << e << ",";
     }
-    out << ")" << std::endl;
+    out << ")\n";
     return out;
 }
 
diff --git a/src/tint/lang/spirv/reader/ast_parser/helper_test.cc b/src/tint/lang/spirv/reader/ast_parser/helper_test.cc
index 5091bbe..e497d98 100644
--- a/src/tint/lang/spirv/reader/ast_parser/helper_test.cc
+++ b/src/tint/lang/spirv/reader/ast_parser/helper_test.cc
@@ -44,7 +44,7 @@
     if (dump_successfully_converted_spirv_ && !skip_dumping_spirv_ && !impl_.spv_binary().empty() &&
         impl_.success()) {
         std::string disassembly = Disassemble(impl_.spv_binary());
-        std::cout << "BEGIN ConvertedOk:\n" << disassembly << "\nEND ConvertedOk" << std::endl;
+        std::cout << "BEGIN ConvertedOk:\n" << disassembly << "\nEND ConvertedOk\n";
     }
 }
 
diff --git a/src/tint/lang/wgsl/ast/transform/array_length_from_uniform_fuzz.cc b/src/tint/lang/wgsl/ast/transform/array_length_from_uniform_fuzz.cc
index 7b1f693..f8b5252 100644
--- a/src/tint/lang/wgsl/ast/transform/array_length_from_uniform_fuzz.cc
+++ b/src/tint/lang/wgsl/ast/transform/array_length_from_uniform_fuzz.cc
@@ -41,7 +41,7 @@
     for (auto* node : program.ASTNodes().Objects()) {
         if (auto* let = node->As<ast::Let>()) {
             if (auto* sem = program.Sem().Get(let)) {
-                if (auto* ptr = sem->Type()->As<core::type::Pointer>()) {
+                if (sem->Type()->Is<core::type::Pointer>()) {
                     return false;
                 }
             }
diff --git a/src/tint/lang/wgsl/ast/transform/manager.cc b/src/tint/lang/wgsl/ast/transform/manager.cc
index 741a302..a641c1a 100644
--- a/src/tint/lang/wgsl/ast/transform/manager.cc
+++ b/src/tint/lang/wgsl/ast/transform/manager.cc
@@ -53,18 +53,16 @@
 #if TINT_PRINT_PROGRAM_FOR_EACH_TRANSFORM
     auto print_program = [&](const char* msg, const Transform* transform) {
         auto wgsl = Program::printer(*program);
-        std::cout << "=========================================================" << std::endl;
+        std::cout << "=========================================================\n";
         std::cout << "== " << msg << " "
-                  << (transform ? transform->TypeInfo().name : "transform manager") << ":"
-                  << std::endl;
-        std::cout << "=========================================================" << std::endl;
-        std::cout << wgsl << std::endl;
+                  << (transform ? transform->TypeInfo().name : "transform manager") << ":\n";
+        std::cout << "=========================================================\n";
+        std::cout << wgsl << "\n";
         if (!program->IsValid()) {
-            std::cout << "-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --" << std::endl;
-            std::cout << program->Diagnostics() << std::endl;
+            std::cout << "-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --\n"
+                      << program->Diagnostics() << "\n";
         }
-        std::cout << "=========================================================" << std::endl
-                  << std::endl;
+        std::cout << "=========================================================\n\n";
     };
 #endif
 
@@ -84,8 +82,7 @@
 
             TINT_IF_PRINT_PROGRAM(print_program("Output of", transform.get()));
         } else {
-            TINT_IF_PRINT_PROGRAM(std::cout << "Skipped " << transform->TypeInfo().name
-                                            << std::endl);
+            TINT_IF_PRINT_PROGRAM(std::cout << "Skipped " << transform->TypeInfo().name << "\n");
         }
     }
 
diff --git a/src/tint/lang/wgsl/ir_roundtrip_fuzz.cc b/src/tint/lang/wgsl/ir_roundtrip_fuzz.cc
index 0dfc83d..16efce4 100644
--- a/src/tint/lang/wgsl/ir_roundtrip_fuzz.cc
+++ b/src/tint/lang/wgsl/ir_roundtrip_fuzz.cc
@@ -47,9 +47,9 @@
     program_options.allowed_features = AllowedFeatures::Everything();
     auto dst = tint::wgsl::writer::IRToProgram(ir, program_options);
     if (!dst.IsValid()) {
-        std::cerr << "IR:\n" << core::ir::Disassemble(ir).Plain() << std::endl;
+        std::cerr << "IR:\n" << core::ir::Disassemble(ir).Plain() << "\n";
         if (auto result = tint::wgsl::writer::Generate(dst, {}); result == Success) {
-            std::cerr << "WGSL:\n" << result->wgsl << std::endl << std::endl;
+            std::cerr << "WGSL:\n" << result->wgsl << "\n\n";
         }
         TINT_ICE() << dst.Diagnostics();
     }
diff --git a/src/tint/lang/wgsl/ir_roundtrip_test.cc b/src/tint/lang/wgsl/ir_roundtrip_test.cc
index 35308c6..52e8abb 100644
--- a/src/tint/lang/wgsl/ir_roundtrip_test.cc
+++ b/src/tint/lang/wgsl/ir_roundtrip_test.cc
@@ -118,32 +118,28 @@
 
 std::ostream& operator<<(std::ostream& o, const IRToProgramRoundtripTest::Result& res) {
     if (!res.err.empty()) {
-        o << "============================" << std::endl
-          << "== Error                  ==" << std::endl
-          << "============================" << std::endl
-          << res.err << std::endl
-          << std::endl;
+        o << "============================\n"
+          << "== Error                  ==\n"
+          << "============================\n"
+          << res.err << "\n\n";
     }
     if (!res.ir_pre_raise.empty()) {
-        o << "============================" << std::endl
-          << "== IR (pre-raise)         ==" << std::endl
-          << "============================" << std::endl
-          << res.ir_pre_raise << std::endl
-          << std::endl;
+        o << "============================\n"
+          << "== IR (pre-raise)         ==\n"
+          << "============================\n"
+          << res.ir_pre_raise << "\n\n";
     }
     if (!res.ir_post_raise.empty()) {
-        o << "============================" << std::endl
-          << "== IR (post-raise)        ==" << std::endl
-          << "============================" << std::endl
-          << res.ir_post_raise << std::endl
-          << std::endl;
+        o << "============================\n"
+          << "== IR (post-raise)        ==\n"
+          << "============================\n"
+          << res.ir_post_raise << "\n\n";
     }
     if (!res.ast.empty()) {
-        o << "============================" << std::endl
-          << "== AST                    ==" << std::endl
-          << "============================" << std::endl
-          << res.ast << std::endl
-          << std::endl;
+        o << "============================\n"
+          << "== AST                    ==\n"
+          << "============================\n"
+          << res.ast << "\n\n";
     }
     return o;
 }
diff --git a/src/tint/lang/wgsl/writer/ir_to_program/ir_to_program_test.h b/src/tint/lang/wgsl/writer/ir_to_program/ir_to_program_test.h
index f7a1338..92cbdd8 100644
--- a/src/tint/lang/wgsl/writer/ir_to_program/ir_to_program_test.h
+++ b/src/tint/lang/wgsl/writer/ir_to_program/ir_to_program_test.h
@@ -99,19 +99,17 @@
     }
 };
 
-#define EXPECT_WGSL(expected_wgsl)                                       \
-    do {                                                                 \
-        if (auto got = Run(); got.err.empty()) {                         \
-            auto expected = std::string(tint::TrimSpace(expected_wgsl)); \
-            if (!expected.empty()) {                                     \
-                expected = "\n" + expected + "\n";                       \
-            }                                                            \
-            EXPECT_EQ(expected, got.wgsl) << "IR: " << got.ir;           \
-        } else {                                                         \
-            FAIL() << got.err << std::endl                               \
-                   << "IR: " << got.ir << std::endl                      \
-                   << "AST: " << got.ast << std::endl;                   \
-        }                                                                \
+#define EXPECT_WGSL(expected_wgsl)                                                   \
+    do {                                                                             \
+        if (auto got = Run(); got.err.empty()) {                                     \
+            auto expected = std::string(tint::TrimSpace(expected_wgsl));             \
+            if (!expected.empty()) {                                                 \
+                expected = "\n" + expected + "\n";                                   \
+            }                                                                        \
+            EXPECT_EQ(expected, got.wgsl) << "IR: " << got.ir;                       \
+        } else {                                                                     \
+            FAIL() << got.err << "\nIR: " << got.ir << "\nAST: " << got.ast << "\n"; \
+        }                                                                            \
     } while (false)
 
 }  // namespace tint::wgsl::writer
diff --git a/src/tint/lang/wgsl/writer/writer_test.cc b/src/tint/lang/wgsl/writer/writer_test.cc
index d9e573c..3477d2a 100644
--- a/src/tint/lang/wgsl/writer/writer_test.cc
+++ b/src/tint/lang/wgsl/writer/writer_test.cc
@@ -108,32 +108,28 @@
 
 std::ostream& operator<<(std::ostream& o, const WgslIRWriterTest::Result& res) {
     if (!res.err.empty()) {
-        o << "============================" << std::endl
-          << "== Error                  ==" << std::endl
-          << "============================" << std::endl
-          << res.err << std::endl
-          << std::endl;
+        o << "============================\n"
+          << "== Error                  ==\n"
+          << "============================\n"
+          << res.err << "\n\n";
     }
     if (!res.ir_pre_raise.empty()) {
-        o << "============================" << std::endl
-          << "== IR (pre-raise)         ==" << std::endl
-          << "============================" << std::endl
-          << res.ir_pre_raise << std::endl
-          << std::endl;
+        o << "============================\n"
+          << "== IR (pre-raise)         ==\n"
+          << "============================\n"
+          << res.ir_pre_raise << "\n\n";
     }
     if (!res.ir_post_raise.empty()) {
-        o << "============================" << std::endl
-          << "== IR (post-raise)        ==" << std::endl
-          << "============================" << std::endl
-          << res.ir_post_raise << std::endl
-          << std::endl;
+        o << "============================\n"
+          << "== IR (post-raise)        ==\n"
+          << "============================\n"
+          << res.ir_post_raise << "\n\n";
     }
     if (!res.ast.empty()) {
-        o << "============================" << std::endl
-          << "== AST                    ==" << std::endl
-          << "============================" << std::endl
-          << res.ast << std::endl
-          << std::endl;
+        o << "============================\n"
+          << "== AST                    ==\n"
+          << "============================\n"
+          << res.ast << "\n\n";
     }
     return o;
 }
diff --git a/src/tint/utils/cli/cli.cc b/src/tint/utils/cli/cli.cc
index 6b00638..b1a98e2 100644
--- a/src/tint/utils/cli/cli.cc
+++ b/src/tint/utils/cli/cli.cc
@@ -115,7 +115,7 @@
                     if (left_lines[i].length() > left_width) {
                         // Left exceeds column width.
                         // Insert a new line and indent to the right
-                        s_out << std::endl;
+                        s_out << "\n";
                         pad(left_width);
                     } else {
                         pad(left_width - left_lines[i].length());
@@ -127,7 +127,7 @@
             if (has_right) {
                 s_out << "  " << right_lines[i];
             }
-            s_out << std::endl;
+            s_out << "\n";
         }
     }
 }
diff --git a/src/tint/utils/cli/cli_test.cc b/src/tint/utils/cli/cli_test.cc
index 470a3b7..5f38c65 100644
--- a/src/tint/utils/cli/cli_test.cc
+++ b/src/tint/utils/cli/cli_test.cc
@@ -51,7 +51,7 @@
     opts.Add<ValueOption<int>>("my_option", "sets the awesome value");
 
     std::stringstream out;
-    out << std::endl;
+    out << "\n";
     opts.ShowHelp(out);
     EXPECT_EQ(out.str(), R"(
 --my_option <value>  sets the awesome value
@@ -63,7 +63,7 @@
     opts.Add<ValueOption<int>>("my_option", "sets the awesome value", Alias{"alias"});
 
     std::stringstream out;
-    out << std::endl;
+    out << "\n";
     opts.ShowHelp(out);
     EXPECT_EQ(out.str(), R"(
 --my_option <value>  sets the awesome value
@@ -75,7 +75,7 @@
     opts.Add<ValueOption<int>>("my_option", "sets the awesome value", ShortName{"a"});
 
     std::stringstream out;
-    out << std::endl;
+    out << "\n";
     opts.ShowHelp(out);
     EXPECT_EQ(out.str(), R"(
 --my_option <value>  sets the awesome value
@@ -91,7 +91,7 @@
 )");
 
     std::stringstream out;
-    out << std::endl;
+    out << "\n";
     opts.ShowHelp(out);
     EXPECT_EQ(out.str(), R"(
 --an-option <value>  this is a
@@ -107,7 +107,7 @@
                                "this is an option that has a silly long name", ShortName{"a"});
 
     std::stringstream out;
-    out << std::endl;
+    out << "\n";
     opts.ShowHelp(out);
     EXPECT_EQ(out.str(), R"(
 --an-option-with-a-really-really-long-name <value>
@@ -128,7 +128,7 @@
                             });
 
     std::stringstream out;
-    out << std::endl;
+    out << "\n";
     opts.ShowHelp(out);
     EXPECT_EQ(out.str(), R"(
 --my_enum_option <X|Y|Z>  sets the awesome value
@@ -150,7 +150,7 @@
                             });
 
     std::stringstream out;
-    out << std::endl;
+    out << "\n";
     opts.ShowHelp(out);
     EXPECT_EQ(out.str(), R"(
 --option-a <value>  an integer
diff --git a/src/tint/utils/diagnostic/source.cc b/src/tint/utils/diagnostic/source.cc
index 47d8831..8f07d77 100644
--- a/src/tint/utils/diagnostic/source.cc
+++ b/src/tint/utils/diagnostic/source.cc
@@ -151,7 +151,7 @@
         }
 
         if (source.file) {
-            out << std::endl << std::endl;
+            out << "\n\n";
 
             auto repeat = [&](char c, size_t n) {
                 while (n--) {
@@ -163,9 +163,7 @@
                 if (line < source.file->content.lines.size() + 1) {
                     auto len = source.file->content.lines[line - 1].size();
 
-                    out << source.file->content.lines[line - 1];
-
-                    out << std::endl;
+                    out << source.file->content.lines[line - 1] << "\n";
 
                     if (line == rng.begin.line && line == rng.end.line) {
                         // Single line
@@ -183,7 +181,7 @@
                         repeat('^', len);
                     }
 
-                    out << std::endl;
+                    out << "\n";
                 }
             }
         }
diff --git a/src/tint/utils/generator/text_generator.cc b/src/tint/utils/generator/text_generator.cc
index e1ea901..00e022d 100644
--- a/src/tint/utils/generator/text_generator.cc
+++ b/src/tint/utils/generator/text_generator.cc
@@ -109,7 +109,7 @@
             }
             ss << line.content;
         }
-        ss << std::endl;
+        ss << "\n";
     }
     return ss.str();
 }
diff --git a/src/tint/utils/ice/ice.cc b/src/tint/utils/ice/ice.cc
index aac1eb9..c36b207 100644
--- a/src/tint/utils/ice/ice.cc
+++ b/src/tint/utils/ice/ice.cc
@@ -53,7 +53,7 @@
     if (ice_reporter) {
         ice_reporter(*this);
     } else {
-        std::cerr << Error() << std::endl << std::endl;
+        std::cerr << Error() << "\n\n";
     }
 
     debugger::Break();