[ir] Add Builder::FunctionParam overload with name

Use it in all the tests.

Bug: tint:1718
Change-Id: Ib8635c62ec10444d5e092105b32d36b483852f74
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/139261
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
diff --git a/src/tint/ir/builder.cc b/src/tint/ir/builder.cc
index 2b3c9a4..bef450f 100644
--- a/src/tint/ir/builder.cc
+++ b/src/tint/ir/builder.cc
@@ -84,6 +84,12 @@
     return ir.values.Create<ir::FunctionParam>(type);
 }
 
+ir::FunctionParam* Builder::FunctionParam(std::string_view name, const type::Type* type) {
+    auto* param = ir.values.Create<ir::FunctionParam>(type);
+    ir.SetName(param, name);
+    return param;
+}
+
 ir::Unreachable* Builder::Unreachable() {
     return Append(ir.instructions.Create<ir::Unreachable>());
 }
diff --git a/src/tint/ir/builder.h b/src/tint/ir/builder.h
index 72482b6..9ef8d81 100644
--- a/src/tint/ir/builder.h
+++ b/src/tint/ir/builder.h
@@ -665,6 +665,12 @@
     /// @returns the value
     ir::FunctionParam* FunctionParam(const type::Type* type);
 
+    /// Creates a new `FunctionParam` with a name.
+    /// @param name the parameter name
+    /// @param type the parameter type
+    /// @returns the value
+    ir::FunctionParam* FunctionParam(std::string_view name, const type::Type* type);
+
     /// Creates a new `Access`
     /// @param type the return type
     /// @param object the object being accessed
diff --git a/src/tint/ir/from_program.cc b/src/tint/ir/from_program.cc
index b6c6586..191178c 100644
--- a/src/tint/ir/from_program.cc
+++ b/src/tint/ir/from_program.cc
@@ -338,7 +338,7 @@
         for (auto* p : ast_func->params) {
             const auto* param_sem = program_->Sem().Get(p)->As<sem::Parameter>();
             auto* ty = param_sem->Type()->Clone(clone_ctx_.type_ctx);
-            auto* param = builder_.FunctionParam(ty);
+            auto* param = builder_.FunctionParam(p->name->symbol.NameView(), ty);
 
             // Note, interpolated is only valid when paired with Location, so it will only be set
             // when the location is set.
@@ -412,7 +412,6 @@
             }
 
             scopes_.Set(p->name->symbol, param);
-            builder_.ir.SetName(param, p->name->symbol.NameView());
             params.Push(param);
         }
         ir_func->SetParams(params);
diff --git a/src/tint/ir/to_program_test.cc b/src/tint/ir/to_program_test.cc
index b0a9c73..91840b1 100644
--- a/src/tint/ir/to_program_test.cc
+++ b/src/tint/ir/to_program_test.cc
@@ -98,10 +98,8 @@
 
 TEST_F(IRToProgramTest, SingleFunction_Parameters) {
     auto* fn = b.Function("f", ty.i32());
-    auto* i = b.FunctionParam(ty.i32());
-    auto* u = b.FunctionParam(ty.u32());
-    mod.SetName(i, "i");
-    mod.SetName(u, "u");
+    auto* i = b.FunctionParam("i", ty.i32());
+    auto* u = b.FunctionParam("u", ty.u32());
     fn->SetParams({i, u});
     mod.functions.Push(fn);
 
@@ -119,8 +117,7 @@
 ////////////////////////////////////////////////////////////////////////////////
 TEST_F(IRToProgramTest, UnaryOp_Negate) {
     auto* fn = b.Function("f", ty.i32());
-    auto* i = b.FunctionParam(ty.i32());
-    mod.SetName(i, "i");
+    auto* i = b.FunctionParam("i", ty.i32());
     fn->SetParams({i});
     mod.functions.Push(fn);
 
@@ -135,8 +132,7 @@
 
 TEST_F(IRToProgramTest, UnaryOp_Complement) {
     auto* fn = b.Function("f", ty.u32());
-    auto* i = b.FunctionParam(ty.u32());
-    mod.SetName(i, "i");
+    auto* i = b.FunctionParam("i", ty.u32());
     fn->SetParams({i});
     mod.functions.Push(fn);
 
@@ -151,8 +147,7 @@
 
 TEST_F(IRToProgramTest, UnaryOp_Not) {
     auto* fn = b.Function("f", ty.bool_());
-    auto* i = b.FunctionParam(ty.bool_());
-    mod.SetName(i, "b");
+    auto* i = b.FunctionParam("b", ty.bool_());
     fn->SetParams({i});
     mod.functions.Push(fn);
 
@@ -170,10 +165,8 @@
 ////////////////////////////////////////////////////////////////////////////////
 TEST_F(IRToProgramTest, BinaryOp_Add) {
     auto* fn = b.Function("f", ty.i32());
-    auto* pa = b.FunctionParam(ty.i32());
-    auto* pb = b.FunctionParam(ty.i32());
-    mod.SetName(pa, "a");
-    mod.SetName(pb, "b");
+    auto* pa = b.FunctionParam("a", ty.i32());
+    auto* pb = b.FunctionParam("b", ty.i32());
     fn->SetParams({pa, pb});
     mod.functions.Push(fn);
 
@@ -188,10 +181,8 @@
 
 TEST_F(IRToProgramTest, BinaryOp_Subtract) {
     auto* fn = b.Function("f", ty.i32());
-    auto* pa = b.FunctionParam(ty.i32());
-    auto* pb = b.FunctionParam(ty.i32());
-    mod.SetName(pa, "a");
-    mod.SetName(pb, "b");
+    auto* pa = b.FunctionParam("a", ty.i32());
+    auto* pb = b.FunctionParam("b", ty.i32());
     fn->SetParams({pa, pb});
     mod.functions.Push(fn);
 
@@ -206,10 +197,8 @@
 
 TEST_F(IRToProgramTest, BinaryOp_Multiply) {
     auto* fn = b.Function("f", ty.i32());
-    auto* pa = b.FunctionParam(ty.i32());
-    auto* pb = b.FunctionParam(ty.i32());
-    mod.SetName(pa, "a");
-    mod.SetName(pb, "b");
+    auto* pa = b.FunctionParam("a", ty.i32());
+    auto* pb = b.FunctionParam("b", ty.i32());
     fn->SetParams({pa, pb});
     mod.functions.Push(fn);
 
@@ -224,10 +213,8 @@
 
 TEST_F(IRToProgramTest, BinaryOp_Divide) {
     auto* fn = b.Function("f", ty.i32());
-    auto* pa = b.FunctionParam(ty.i32());
-    auto* pb = b.FunctionParam(ty.i32());
-    mod.SetName(pa, "a");
-    mod.SetName(pb, "b");
+    auto* pa = b.FunctionParam("a", ty.i32());
+    auto* pb = b.FunctionParam("b", ty.i32());
     fn->SetParams({pa, pb});
     mod.functions.Push(fn);
 
@@ -242,10 +229,8 @@
 
 TEST_F(IRToProgramTest, BinaryOp_Modulo) {
     auto* fn = b.Function("f", ty.i32());
-    auto* pa = b.FunctionParam(ty.i32());
-    auto* pb = b.FunctionParam(ty.i32());
-    mod.SetName(pa, "a");
-    mod.SetName(pb, "b");
+    auto* pa = b.FunctionParam("a", ty.i32());
+    auto* pb = b.FunctionParam("b", ty.i32());
     fn->SetParams({pa, pb});
     mod.functions.Push(fn);
 
@@ -260,10 +245,8 @@
 
 TEST_F(IRToProgramTest, BinaryOp_And) {
     auto* fn = b.Function("f", ty.i32());
-    auto* pa = b.FunctionParam(ty.i32());
-    auto* pb = b.FunctionParam(ty.i32());
-    mod.SetName(pa, "a");
-    mod.SetName(pb, "b");
+    auto* pa = b.FunctionParam("a", ty.i32());
+    auto* pb = b.FunctionParam("b", ty.i32());
     fn->SetParams({pa, pb});
     mod.functions.Push(fn);
 
@@ -278,10 +261,8 @@
 
 TEST_F(IRToProgramTest, BinaryOp_Or) {
     auto* fn = b.Function("f", ty.i32());
-    auto* pa = b.FunctionParam(ty.i32());
-    auto* pb = b.FunctionParam(ty.i32());
-    mod.SetName(pa, "a");
-    mod.SetName(pb, "b");
+    auto* pa = b.FunctionParam("a", ty.i32());
+    auto* pb = b.FunctionParam("b", ty.i32());
     fn->SetParams({pa, pb});
     mod.functions.Push(fn);
 
@@ -296,10 +277,8 @@
 
 TEST_F(IRToProgramTest, BinaryOp_Xor) {
     auto* fn = b.Function("f", ty.i32());
-    auto* pa = b.FunctionParam(ty.i32());
-    auto* pb = b.FunctionParam(ty.i32());
-    mod.SetName(pa, "a");
-    mod.SetName(pb, "b");
+    auto* pa = b.FunctionParam("a", ty.i32());
+    auto* pb = b.FunctionParam("b", ty.i32());
     fn->SetParams({pa, pb});
     mod.functions.Push(fn);
 
@@ -314,10 +293,8 @@
 
 TEST_F(IRToProgramTest, BinaryOp_Equal) {
     auto* fn = b.Function("f", ty.bool_());
-    auto* pa = b.FunctionParam(ty.i32());
-    auto* pb = b.FunctionParam(ty.i32());
-    mod.SetName(pa, "a");
-    mod.SetName(pb, "b");
+    auto* pa = b.FunctionParam("a", ty.i32());
+    auto* pb = b.FunctionParam("b", ty.i32());
     fn->SetParams({pa, pb});
     mod.functions.Push(fn);
 
@@ -332,10 +309,8 @@
 
 TEST_F(IRToProgramTest, BinaryOp_NotEqual) {
     auto* fn = b.Function("f", ty.bool_());
-    auto* pa = b.FunctionParam(ty.i32());
-    auto* pb = b.FunctionParam(ty.i32());
-    mod.SetName(pa, "a");
-    mod.SetName(pb, "b");
+    auto* pa = b.FunctionParam("a", ty.i32());
+    auto* pb = b.FunctionParam("b", ty.i32());
     fn->SetParams({pa, pb});
     mod.functions.Push(fn);
 
@@ -350,10 +325,8 @@
 
 TEST_F(IRToProgramTest, BinaryOp_LessThan) {
     auto* fn = b.Function("f", ty.bool_());
-    auto* pa = b.FunctionParam(ty.i32());
-    auto* pb = b.FunctionParam(ty.i32());
-    mod.SetName(pa, "a");
-    mod.SetName(pb, "b");
+    auto* pa = b.FunctionParam("a", ty.i32());
+    auto* pb = b.FunctionParam("b", ty.i32());
     fn->SetParams({pa, pb});
     mod.functions.Push(fn);
 
@@ -368,10 +341,8 @@
 
 TEST_F(IRToProgramTest, BinaryOp_GreaterThan) {
     auto* fn = b.Function("f", ty.bool_());
-    auto* pa = b.FunctionParam(ty.i32());
-    auto* pb = b.FunctionParam(ty.i32());
-    mod.SetName(pa, "a");
-    mod.SetName(pb, "b");
+    auto* pa = b.FunctionParam("a", ty.i32());
+    auto* pb = b.FunctionParam("b", ty.i32());
     fn->SetParams({pa, pb});
     mod.functions.Push(fn);
 
@@ -386,10 +357,8 @@
 
 TEST_F(IRToProgramTest, BinaryOp_LessThanEqual) {
     auto* fn = b.Function("f", ty.bool_());
-    auto* pa = b.FunctionParam(ty.i32());
-    auto* pb = b.FunctionParam(ty.i32());
-    mod.SetName(pa, "a");
-    mod.SetName(pb, "b");
+    auto* pa = b.FunctionParam("a", ty.i32());
+    auto* pb = b.FunctionParam("b", ty.i32());
     fn->SetParams({pa, pb});
     mod.functions.Push(fn);
 
@@ -404,10 +373,8 @@
 
 TEST_F(IRToProgramTest, BinaryOp_GreaterThanEqual) {
     auto* fn = b.Function("f", ty.bool_());
-    auto* pa = b.FunctionParam(ty.i32());
-    auto* pb = b.FunctionParam(ty.i32());
-    mod.SetName(pa, "a");
-    mod.SetName(pb, "b");
+    auto* pa = b.FunctionParam("a", ty.i32());
+    auto* pb = b.FunctionParam("b", ty.i32());
     fn->SetParams({pa, pb});
     mod.functions.Push(fn);
 
@@ -422,10 +389,8 @@
 
 TEST_F(IRToProgramTest, BinaryOp_ShiftLeft) {
     auto* fn = b.Function("f", ty.i32());
-    auto* pa = b.FunctionParam(ty.i32());
-    auto* pb = b.FunctionParam(ty.u32());
-    mod.SetName(pa, "a");
-    mod.SetName(pb, "b");
+    auto* pa = b.FunctionParam("a", ty.i32());
+    auto* pb = b.FunctionParam("b", ty.u32());
     fn->SetParams({pa, pb});
     mod.functions.Push(fn);
 
@@ -440,10 +405,8 @@
 
 TEST_F(IRToProgramTest, BinaryOp_ShiftRight) {
     auto* fn = b.Function("f", ty.i32());
-    auto* pa = b.FunctionParam(ty.i32());
-    auto* pb = b.FunctionParam(ty.u32());
-    mod.SetName(pa, "a");
-    mod.SetName(pb, "b");
+    auto* pa = b.FunctionParam("a", ty.i32());
+    auto* pb = b.FunctionParam("b", ty.u32());
     fn->SetParams({pa, pb});
     mod.functions.Push(fn);
 
@@ -461,10 +424,8 @@
 ////////////////////////////////////////////////////////////////////////////////
 TEST_F(IRToProgramTest, BinaryOp_LogicalAnd_Param_2) {
     auto* fn = b.Function("f", ty.bool_());
-    auto* pa = b.FunctionParam(ty.bool_());
-    auto* pb = b.FunctionParam(ty.bool_());
-    mod.SetName(pa, "a");
-    mod.SetName(pb, "b");
+    auto* pa = b.FunctionParam("a", ty.bool_());
+    auto* pb = b.FunctionParam("b", ty.bool_());
     fn->SetParams({pa, pb});
     mod.functions.Push(fn);
 
@@ -486,12 +447,9 @@
 
 TEST_F(IRToProgramTest, BinaryOp_LogicalAnd_Param_3_ab_c) {
     auto* fn = b.Function("f", ty.bool_());
-    auto* pa = b.FunctionParam(ty.bool_());
-    auto* pb = b.FunctionParam(ty.bool_());
-    auto* pc = b.FunctionParam(ty.bool_());
-    mod.SetName(pa, "a");
-    mod.SetName(pb, "b");
-    mod.SetName(pc, "c");
+    auto* pa = b.FunctionParam("a", ty.bool_());
+    auto* pb = b.FunctionParam("b", ty.bool_());
+    auto* pc = b.FunctionParam("c", ty.bool_());
     fn->SetParams({pa, pb, pc});
     mod.functions.Push(fn);
 
@@ -518,12 +476,9 @@
 
 TEST_F(IRToProgramTest, BinaryOp_LogicalAnd_Param_3_a_bc) {
     auto* fn = b.Function("f", ty.bool_());
-    auto* pa = b.FunctionParam(ty.bool_());
-    auto* pb = b.FunctionParam(ty.bool_());
-    auto* pc = b.FunctionParam(ty.bool_());
-    mod.SetName(pa, "a");
-    mod.SetName(pb, "b");
-    mod.SetName(pc, "c");
+    auto* pa = b.FunctionParam("a", ty.bool_());
+    auto* pb = b.FunctionParam("b", ty.bool_());
+    auto* pc = b.FunctionParam("c", ty.bool_());
     fn->SetParams({pa, pb, pc});
     mod.functions.Push(fn);
 
@@ -549,10 +504,8 @@
 
 TEST_F(IRToProgramTest, BinaryOp_LogicalAnd_Let_2) {
     auto* fn = b.Function("f", ty.bool_());
-    auto* pa = b.FunctionParam(ty.bool_());
-    auto* pb = b.FunctionParam(ty.bool_());
-    mod.SetName(pa, "a");
-    mod.SetName(pb, "b");
+    auto* pa = b.FunctionParam("a", ty.bool_());
+    auto* pb = b.FunctionParam("b", ty.bool_());
     fn->SetParams({pa, pb});
     mod.functions.Push(fn);
 
@@ -576,12 +529,9 @@
 
 TEST_F(IRToProgramTest, BinaryOp_LogicalAnd_Let_3_ab_c) {
     auto* fn = b.Function("f", ty.bool_());
-    auto* pa = b.FunctionParam(ty.bool_());
-    auto* pb = b.FunctionParam(ty.bool_());
-    auto* pc = b.FunctionParam(ty.bool_());
-    mod.SetName(pa, "a");
-    mod.SetName(pb, "b");
-    mod.SetName(pc, "c");
+    auto* pa = b.FunctionParam("a", ty.bool_());
+    auto* pb = b.FunctionParam("b", ty.bool_());
+    auto* pc = b.FunctionParam("c", ty.bool_());
     fn->SetParams({pa, pb, pc});
     mod.functions.Push(fn);
 
@@ -610,12 +560,9 @@
 
 TEST_F(IRToProgramTest, BinaryOp_LogicalAnd_Let_3_a_bc) {
     auto* fn = b.Function("f", ty.bool_());
-    auto* pa = b.FunctionParam(ty.bool_());
-    auto* pb = b.FunctionParam(ty.bool_());
-    auto* pc = b.FunctionParam(ty.bool_());
-    mod.SetName(pa, "a");
-    mod.SetName(pb, "b");
-    mod.SetName(pc, "c");
+    auto* pa = b.FunctionParam("a", ty.bool_());
+    auto* pb = b.FunctionParam("b", ty.bool_());
+    auto* pc = b.FunctionParam("c", ty.bool_());
     fn->SetParams({pa, pb, pc});
     mod.functions.Push(fn);
 
@@ -778,10 +725,8 @@
 
 TEST_F(IRToProgramTest, BinaryOp_LogicalOr_Param_2) {
     auto* fn = b.Function("f", ty.bool_());
-    auto* pa = b.FunctionParam(ty.bool_());
-    auto* pb = b.FunctionParam(ty.bool_());
-    mod.SetName(pa, "a");
-    mod.SetName(pb, "b");
+    auto* pa = b.FunctionParam("a", ty.bool_());
+    auto* pb = b.FunctionParam("b", ty.bool_());
     fn->SetParams({pa, pb});
     mod.functions.Push(fn);
 
@@ -803,12 +748,9 @@
 
 TEST_F(IRToProgramTest, BinaryOp_LogicalOr_Param_3_ab_c) {
     auto* fn = b.Function("f", ty.bool_());
-    auto* pa = b.FunctionParam(ty.bool_());
-    auto* pb = b.FunctionParam(ty.bool_());
-    auto* pc = b.FunctionParam(ty.bool_());
-    mod.SetName(pa, "a");
-    mod.SetName(pb, "b");
-    mod.SetName(pc, "c");
+    auto* pa = b.FunctionParam("a", ty.bool_());
+    auto* pb = b.FunctionParam("b", ty.bool_());
+    auto* pc = b.FunctionParam("c", ty.bool_());
     fn->SetParams({pa, pb, pc});
     mod.functions.Push(fn);
 
@@ -835,12 +777,9 @@
 
 TEST_F(IRToProgramTest, BinaryOp_LogicalOr_Param_3_a_bc) {
     auto* fn = b.Function("f", ty.bool_());
-    auto* pa = b.FunctionParam(ty.bool_());
-    auto* pb = b.FunctionParam(ty.bool_());
-    auto* pc = b.FunctionParam(ty.bool_());
-    mod.SetName(pa, "a");
-    mod.SetName(pb, "b");
-    mod.SetName(pc, "c");
+    auto* pa = b.FunctionParam("a", ty.bool_());
+    auto* pb = b.FunctionParam("b", ty.bool_());
+    auto* pc = b.FunctionParam("c", ty.bool_());
     fn->SetParams({pa, pb, pc});
     mod.functions.Push(fn);
 
@@ -867,10 +806,8 @@
 
 TEST_F(IRToProgramTest, BinaryOp_LogicalOr_Let_2) {
     auto* fn = b.Function("f", ty.bool_());
-    auto* pa = b.FunctionParam(ty.bool_());
-    auto* pb = b.FunctionParam(ty.bool_());
-    mod.SetName(pa, "a");
-    mod.SetName(pb, "b");
+    auto* pa = b.FunctionParam("a", ty.bool_());
+    auto* pb = b.FunctionParam("b", ty.bool_());
     fn->SetParams({pa, pb});
     mod.functions.Push(fn);
 
@@ -894,12 +831,9 @@
 
 TEST_F(IRToProgramTest, BinaryOp_LogicalOr_Let_3_ab_c) {
     auto* fn = b.Function("f", ty.bool_());
-    auto* pa = b.FunctionParam(ty.bool_());
-    auto* pb = b.FunctionParam(ty.bool_());
-    auto* pc = b.FunctionParam(ty.bool_());
-    mod.SetName(pa, "a");
-    mod.SetName(pb, "b");
-    mod.SetName(pc, "c");
+    auto* pa = b.FunctionParam("a", ty.bool_());
+    auto* pb = b.FunctionParam("b", ty.bool_());
+    auto* pc = b.FunctionParam("c", ty.bool_());
     fn->SetParams({pa, pb, pc});
     mod.functions.Push(fn);
 
@@ -928,12 +862,9 @@
 
 TEST_F(IRToProgramTest, BinaryOp_LogicalOr_Let_3_a_bc) {
     auto* fn = b.Function("f", ty.bool_());
-    auto* pa = b.FunctionParam(ty.bool_());
-    auto* pb = b.FunctionParam(ty.bool_());
-    auto* pc = b.FunctionParam(ty.bool_());
-    mod.SetName(pa, "a");
-    mod.SetName(pb, "b");
-    mod.SetName(pc, "c");
+    auto* pa = b.FunctionParam("a", ty.bool_());
+    auto* pb = b.FunctionParam("b", ty.bool_());
+    auto* pc = b.FunctionParam("c", ty.bool_());
     fn->SetParams({pa, pb, pc});
     mod.functions.Push(fn);
 
@@ -1104,10 +1035,8 @@
     b.With(fn_d->Block(), [&] { b.Return(fn_d, true); });
 
     auto* fn = b.Function("f", ty.bool_());
-    auto* pa = b.FunctionParam(ty.bool_());
-    auto* pc = b.FunctionParam(ty.bool_());
-    mod.SetName(pa, "a");
-    mod.SetName(pc, "c");
+    auto* pa = b.FunctionParam("a", ty.bool_());
+    auto* pc = b.FunctionParam("c", ty.bool_());
     fn->SetParams({pa, pc});
     mod.functions.Push(fn);
 
@@ -1283,8 +1212,7 @@
 ////////////////////////////////////////////////////////////////////////////////
 TEST_F(IRToProgramTest, LetUsedOnce) {
     auto* fn = b.Function("f", ty.u32());
-    auto* i = b.FunctionParam(ty.u32());
-    mod.SetName(i, "i");
+    auto* i = b.FunctionParam("i", ty.u32());
     fn->SetParams({i});
     mod.functions.Push(fn);
 
@@ -1304,8 +1232,7 @@
 
 TEST_F(IRToProgramTest, LetUsedTwice) {
     auto* fn = b.Function("f", ty.i32());
-    auto* i = b.FunctionParam(ty.i32());
-    mod.SetName(i, "i");
+    auto* i = b.FunctionParam("i", ty.i32());
     fn->SetParams({i});
     mod.functions.Push(fn);
 
@@ -1397,8 +1324,7 @@
     mod.functions.Push(a);
 
     auto* fn = b.Function("f", ty.void_());
-    auto* cond = b.FunctionParam(ty.bool_());
-    mod.SetName(cond, "cond");
+    auto* cond = b.FunctionParam("cond", ty.bool_());
     fn->SetParams({cond});
     mod.functions.Push(fn);
 
@@ -1424,8 +1350,7 @@
 
 TEST_F(IRToProgramTest, If_Return) {
     auto* fn = b.Function("f", ty.void_());
-    auto* cond = b.FunctionParam(ty.bool_());
-    mod.SetName(cond, "cond");
+    auto* cond = b.FunctionParam("cond", ty.bool_());
     fn->SetParams({cond});
     mod.functions.Push(fn);
 
@@ -1475,8 +1400,7 @@
     mod.functions.Push(fn_b);
 
     auto* fn = b.Function("f", ty.void_());
-    auto* cond = b.FunctionParam(ty.bool_());
-    mod.SetName(cond, "cond");
+    auto* cond = b.FunctionParam("cond", ty.bool_());
     fn->SetParams({cond});
     mod.functions.Push(fn);
 
@@ -1635,21 +1559,16 @@
 
 TEST_F(IRToProgramTest, If_Else_Chain) {
     auto* x = b.Function("x", ty.bool_());
-    auto* i = b.FunctionParam(ty.i32());
-    mod.SetName(i, "i");
+    auto* i = b.FunctionParam("i", ty.i32());
     x->SetParams({i});
     mod.functions.Push(x);
     b.With(x->Block(), [&] { b.Return(x, true); });
 
     auto* fn = b.Function("f", ty.void_());
-    auto* pa = b.FunctionParam(ty.bool_());
-    auto* pb = b.FunctionParam(ty.bool_());
-    auto* pc = b.FunctionParam(ty.bool_());
-    auto* pd = b.FunctionParam(ty.bool_());
-    mod.SetName(pa, "a");
-    mod.SetName(pb, "b");
-    mod.SetName(pc, "c");
-    mod.SetName(pd, "d");
+    auto* pa = b.FunctionParam("a", ty.bool_());
+    auto* pb = b.FunctionParam("b", ty.bool_());
+    auto* pc = b.FunctionParam("c", ty.bool_());
+    auto* pd = b.FunctionParam("d", ty.bool_());
     fn->SetParams({pa, pb, pc, pd});
     mod.functions.Push(fn);
 
@@ -2021,8 +1940,7 @@
 
 TEST_F(IRToProgramTest, For_ComplexBody) {
     auto* a = b.Function("a", ty.bool_());
-    auto* v = b.FunctionParam(ty.i32());
-    mod.SetName(v, "v");
+    auto* v = b.FunctionParam("v", ty.i32());
     a->SetParams({v});
     b.With(a->Block(), [&] { b.Return(a, b.Equal(ty.bool_(), v, 1_i)); });
     mod.functions.Push(a);
@@ -2074,8 +1992,7 @@
 
 TEST_F(IRToProgramTest, For_ComplexBody_NoInit) {
     auto* a = b.Function("a", ty.bool_());
-    auto* v = b.FunctionParam(ty.i32());
-    mod.SetName(v, "v");
+    auto* v = b.FunctionParam("v", ty.i32());
     a->SetParams({v});
     b.With(a->Block(), [&] { b.Return(a, b.Equal(ty.bool_(), v, 1_i)); });
     mod.functions.Push(a);
@@ -2126,8 +2043,7 @@
 
 TEST_F(IRToProgramTest, For_ComplexBody_NoCont) {
     auto* a = b.Function("a", ty.bool_());
-    auto* v = b.FunctionParam(ty.i32());
-    mod.SetName(v, "v");
+    auto* v = b.FunctionParam("v", ty.i32());
     a->SetParams({v});
     b.With(a->Block(), [&] { b.Return(a, b.Equal(ty.bool_(), v, 1_i)); });
     mod.functions.Push(a);
@@ -2176,8 +2092,7 @@
 
 TEST_F(IRToProgramTest, For_CallInInitCondCont) {
     auto* fn_n = b.Function("n", ty.i32());
-    auto* v = b.FunctionParam(ty.i32());
-    mod.SetName(v, "v");
+    auto* v = b.FunctionParam("v", ty.i32());
     fn_n->SetParams({v});
     b.With(fn_n->Block(), [&] { b.Return(fn_n, b.Add(ty.i32(), v, 1_i)); });
     mod.functions.Push(fn_n);
@@ -2243,8 +2158,7 @@
 
 TEST_F(IRToProgramTest, While_Cond) {
     auto* fn = b.Function("f", ty.void_());
-    auto* cond = b.FunctionParam(ty.bool_());
-    mod.SetName(cond, "cond");
+    auto* cond = b.FunctionParam("cond", ty.bool_());
     fn->SetParams({cond});
     mod.functions.Push(fn);
 
@@ -2292,8 +2206,7 @@
 
 TEST_F(IRToProgramTest, While_IfBreak) {
     auto* fn = b.Function("f", ty.void_());
-    auto* cond = b.FunctionParam(ty.bool_());
-    mod.SetName(cond, "cond");
+    auto* cond = b.FunctionParam("cond", ty.bool_());
     fn->SetParams({cond});
     mod.functions.Push(fn);
 
@@ -2323,8 +2236,7 @@
 
 TEST_F(IRToProgramTest, While_IfReturn) {
     auto* fn = b.Function("f", ty.void_());
-    auto* cond = b.FunctionParam(ty.bool_());
-    mod.SetName(cond, "cond");
+    auto* cond = b.FunctionParam("cond", ty.bool_());
     fn->SetParams({cond});
     mod.functions.Push(fn);
 
@@ -2376,8 +2288,7 @@
 
 TEST_F(IRToProgramTest, Loop_IfBreak) {
     auto* fn = b.Function("f", ty.void_());
-    auto* cond = b.FunctionParam(ty.bool_());
-    mod.SetName(cond, "cond");
+    auto* cond = b.FunctionParam("cond", ty.bool_());
     fn->SetParams({cond});
     mod.functions.Push(fn);
 
@@ -2402,8 +2313,7 @@
 
 TEST_F(IRToProgramTest, Loop_IfReturn) {
     auto* fn = b.Function("f", ty.void_());
-    auto* cond = b.FunctionParam(ty.bool_());
-    mod.SetName(cond, "cond");
+    auto* cond = b.FunctionParam("cond", ty.bool_());
     fn->SetParams({cond});
     mod.functions.Push(fn);
 
diff --git a/src/tint/ir/transform/merge_return_test.cc b/src/tint/ir/transform/merge_return_test.cc
index c54f809..2d20f25 100644
--- a/src/tint/ir/transform/merge_return_test.cc
+++ b/src/tint/ir/transform/merge_return_test.cc
@@ -656,12 +656,9 @@
     b.RootBlock()->Append(global);
 
     auto* func = b.Function("foo", ty.i32());
-    auto* condA = b.FunctionParam(ty.bool_());
-    auto* condB = b.FunctionParam(ty.bool_());
-    auto* condC = b.FunctionParam(ty.bool_());
-    mod.SetName(condA, "condA");
-    mod.SetName(condB, "condB");
-    mod.SetName(condC, "condC");
+    auto* condA = b.FunctionParam("condA", ty.bool_());
+    auto* condB = b.FunctionParam("condB", ty.bool_());
+    auto* condC = b.FunctionParam("condC", ty.bool_());
     func->SetParams({condA, condB, condC});
     mod.functions.Push(func);
 
@@ -806,12 +803,9 @@
     b.RootBlock()->Append(global);
 
     auto* func = b.Function("foo", ty.i32());
-    auto* condA = b.FunctionParam(ty.bool_());
-    auto* condB = b.FunctionParam(ty.bool_());
-    auto* condC = b.FunctionParam(ty.bool_());
-    mod.SetName(condA, "condA");
-    mod.SetName(condB, "condB");
-    mod.SetName(condC, "condC");
+    auto* condA = b.FunctionParam("condA", ty.bool_());
+    auto* condB = b.FunctionParam("condB", ty.bool_());
+    auto* condC = b.FunctionParam("condC", ty.bool_());
     func->SetParams({condA, condB, condC});
     mod.functions.Push(func);
 
@@ -931,12 +925,9 @@
     b.RootBlock()->Append(global);
 
     auto* func = b.Function("foo", ty.i32());
-    auto* condA = b.FunctionParam(ty.bool_());
-    auto* condB = b.FunctionParam(ty.bool_());
-    auto* condC = b.FunctionParam(ty.bool_());
-    mod.SetName(condA, "condA");
-    mod.SetName(condB, "condB");
-    mod.SetName(condC, "condC");
+    auto* condA = b.FunctionParam("condA", ty.bool_());
+    auto* condB = b.FunctionParam("condB", ty.bool_());
+    auto* condC = b.FunctionParam("condC", ty.bool_());
     func->SetParams({condA, condB, condC});
     mod.functions.Push(func);
 
diff --git a/src/tint/ir/transform/shader_io_test.cc b/src/tint/ir/transform/shader_io_test.cc
index 915c8f8..bd94416 100644
--- a/src/tint/ir/transform/shader_io_test.cc
+++ b/src/tint/ir/transform/shader_io_test.cc
@@ -56,20 +56,16 @@
 
 TEST_F(IR_ShaderIOTest, Parameters_NonStruct_Spirv) {
     auto* ep = b.Function("foo", ty.void_());
-    auto* front_facing = b.FunctionParam(ty.bool_());
+    auto* front_facing = b.FunctionParam("front_facing", ty.bool_());
     front_facing->SetBuiltin(FunctionParam::Builtin::kFrontFacing);
-    mod.SetName(front_facing, "front_facing");
-    auto* position = b.FunctionParam(ty.vec4<f32>());
+    auto* position = b.FunctionParam("position", ty.vec4<f32>());
     position->SetBuiltin(FunctionParam::Builtin::kPosition);
     position->SetInvariant(true);
-    mod.SetName(position, "position");
-    auto* color1 = b.FunctionParam(ty.f32());
+    auto* color1 = b.FunctionParam("color1", ty.f32());
     color1->SetLocation(0, {});
-    mod.SetName(color1, "color1");
-    auto* color2 = b.FunctionParam(ty.f32());
+    auto* color2 = b.FunctionParam("color2", ty.f32());
     color2->SetLocation(1, builtin::Interpolation{builtin::InterpolationType::kLinear,
                                                   builtin::InterpolationSampling::kSample});
-    mod.SetName(color2, "color2");
 
     ep->SetParams({front_facing, position, color1, color2});
     ep->SetStage(Function::PipelineStage::kFragment);
@@ -183,8 +179,7 @@
                   });
 
     auto* ep = b.Function("foo", ty.void_());
-    auto* str_param = b.FunctionParam(str_ty);
-    mod.SetName(str_param, "inputs");
+    auto* str_param = b.FunctionParam("inputs", str_ty);
     ep->SetParams({str_param});
     ep->SetStage(Function::PipelineStage::kFragment);
     mod.functions.Push(ep);
@@ -307,15 +302,12 @@
                              });
 
     auto* ep = b.Function("foo", ty.void_());
-    auto* front_facing = b.FunctionParam(ty.bool_());
+    auto* front_facing = b.FunctionParam("front_facing", ty.bool_());
     front_facing->SetBuiltin(FunctionParam::Builtin::kFrontFacing);
-    mod.SetName(front_facing, "front_facing");
-    auto* str_param = b.FunctionParam(str_ty);
-    mod.SetName(str_param, "inputs");
-    auto* color2 = b.FunctionParam(ty.f32());
+    auto* str_param = b.FunctionParam("inputs", str_ty);
+    auto* color2 = b.FunctionParam("color2", ty.f32());
     color2->SetLocation(1, builtin::Interpolation{builtin::InterpolationType::kLinear,
                                                   builtin::InterpolationSampling::kSample});
-    mod.SetName(color2, "color2");
 
     ep->SetParams({front_facing, str_param, color2});
     ep->SetStage(Function::PipelineStage::kFragment);
@@ -654,10 +646,9 @@
     // Fragment shader.
     {
         auto* ep = b.Function("frag", vec4f);
-        auto* inputs = b.FunctionParam(str_ty);
+        auto* inputs = b.FunctionParam("inputs", str_ty);
         ep->SetStage(Function::PipelineStage::kFragment);
         ep->SetParams({inputs});
-        mod.SetName(inputs, "inputs");
         mod.functions.Push(ep);
 
         b.With(ep->Block(), [&] {  //
@@ -884,9 +875,8 @@
                                  },
                              });
 
-    auto* mask_in = b.FunctionParam(ty.u32());
+    auto* mask_in = b.FunctionParam("mask_in", ty.u32());
     mask_in->SetBuiltin(FunctionParam::Builtin::kSampleMask);
-    mod.SetName(mask_in, "mask_in");
 
     auto* ep = b.Function("foo", str_ty);
     ep->SetStage(Function::PipelineStage::kFragment);