diff --git a/src/tint/writer/glsl/generator_impl.cc b/src/tint/writer/glsl/generator_impl.cc
index d28f3f4..88eec26 100644
--- a/src/tint/writer/glsl/generator_impl.cc
+++ b/src/tint/writer/glsl/generator_impl.cc
@@ -502,42 +502,43 @@
     auto* ret_ty = TypeOf(expr)->UnwrapRef();
     auto* lhs_ty = TypeOf(expr->lhs)->UnwrapRef();
     auto* rhs_ty = TypeOf(expr->rhs)->UnwrapRef();
-    fn = utils::GetOrCreate(float_modulo_funcs_, {lhs_ty, rhs_ty}, [&]() -> std::string {
-        TextBuffer b;
-        TINT_DEFER(helpers_.Append(b));
+    fn = utils::GetOrCreate(float_modulo_funcs_, BinaryOperandType{{lhs_ty, rhs_ty}},
+                            [&]() -> std::string {
+                                TextBuffer b;
+                                TINT_DEFER(helpers_.Append(b));
 
-        auto fn_name = UniqueIdentifier("tint_float_modulo");
-        std::vector<std::string> parameter_names;
-        {
-            auto decl = line(&b);
-            if (!EmitTypeAndName(decl, ret_ty, ast::StorageClass::kNone, ast::Access::kUndefined,
-                                 fn_name)) {
-                return "";
-            }
-            {
-                ScopedParen sp(decl);
-                const auto* ty = TypeOf(expr->lhs)->UnwrapRef();
-                if (!EmitTypeAndName(decl, ty, ast::StorageClass::kNone, ast::Access::kUndefined,
-                                     "lhs")) {
-                    return "";
-                }
-                decl << ", ";
-                ty = TypeOf(expr->rhs)->UnwrapRef();
-                if (!EmitTypeAndName(decl, ty, ast::StorageClass::kNone, ast::Access::kUndefined,
-                                     "rhs")) {
-                    return "";
-                }
-            }
-            decl << " {";
-        }
-        {
-            ScopedIndent si(&b);
-            line(&b) << "return (lhs - rhs * trunc(lhs / rhs));";
-        }
-        line(&b) << "}";
-        line(&b);
-        return fn_name;
-    });
+                                auto fn_name = UniqueIdentifier("tint_float_modulo");
+                                std::vector<std::string> parameter_names;
+                                {
+                                    auto decl = line(&b);
+                                    if (!EmitTypeAndName(decl, ret_ty, ast::StorageClass::kNone,
+                                                         ast::Access::kUndefined, fn_name)) {
+                                        return "";
+                                    }
+                                    {
+                                        ScopedParen sp(decl);
+                                        const auto* ty = TypeOf(expr->lhs)->UnwrapRef();
+                                        if (!EmitTypeAndName(decl, ty, ast::StorageClass::kNone,
+                                                             ast::Access::kUndefined, "lhs")) {
+                                            return "";
+                                        }
+                                        decl << ", ";
+                                        ty = TypeOf(expr->rhs)->UnwrapRef();
+                                        if (!EmitTypeAndName(decl, ty, ast::StorageClass::kNone,
+                                                             ast::Access::kUndefined, "rhs")) {
+                                            return "";
+                                        }
+                                    }
+                                    decl << " {";
+                                }
+                                {
+                                    ScopedIndent si(&b);
+                                    line(&b) << "return (lhs - rhs * trunc(lhs / rhs));";
+                                }
+                                line(&b) << "}";
+                                line(&b);
+                                return fn_name;
+                            });
 
     if (fn.empty()) {
         return false;
diff --git a/src/tint/writer/glsl/generator_impl.h b/src/tint/writer/glsl/generator_impl.h
index 37352c5..811dd91 100644
--- a/src/tint/writer/glsl/generator_impl.h
+++ b/src/tint/writer/glsl/generator_impl.h
@@ -16,6 +16,7 @@
 #define SRC_TINT_WRITER_GLSL_GENERATOR_IMPL_H_
 
 #include <string>
+#include <tuple>
 #include <unordered_map>
 #include <unordered_set>
 #include <utility>
@@ -478,36 +479,9 @@
         std::string var_name;
     };
 
-    struct DMAIntrinsic {
-        transform::DecomposeMemoryAccess::Intrinsic::Op op;
-        transform::DecomposeMemoryAccess::Intrinsic::DataType type;
-        bool operator==(const DMAIntrinsic& rhs) const { return op == rhs.op && type == rhs.type; }
-        /// Hasher is a std::hash function for DMAIntrinsic
-        struct Hasher {
-            /// @param i the DMAIntrinsic to hash
-            /// @returns the hash of `i`
-            inline std::size_t operator()(const DMAIntrinsic& i) const {
-                return utils::Hash(i.op, i.type);
-            }
-        };
-    };
-
-    /// The structure holding both type of two operands for a binary operator.
-    struct BinaryOperandType {
-        const sem::Type* lhs_type;
-        const sem::Type* rhs_type;
-        bool operator==(const BinaryOperandType& rhs) const {
-            return lhs_type == rhs.lhs_type && rhs_type == rhs.rhs_type;
-        }
-        /// Hasher is a std::hash function for BinaryOperandType
-        struct Hasher {
-            /// @param i the BinaryOperandType to hash
-            /// @returns the hash of `i`
-            inline std::size_t operator()(const BinaryOperandType& i) const {
-                return utils::Hash(i.lhs_type, i.rhs_type);
-            }
-        };
-    };
+    /// The map key for two semantic types.
+    using BinaryOperandType =
+        utils::UnorderedKeyWrapper<std::tuple<const sem::Type*, const sem::Type*>>;
 
     /// CallBuiltinHelper will call the builtin helper function, creating it
     /// if it hasn't been built already. If the builtin needs to be built then
@@ -535,12 +509,10 @@
 
     TextBuffer helpers_;  // Helper functions emitted at the top of the output
     std::function<bool()> emit_continuing_;
-    std::unordered_map<DMAIntrinsic, std::string, DMAIntrinsic::Hasher> dma_intrinsics_;
     std::unordered_map<const sem::Builtin*, std::string> builtins_;
     std::unordered_map<const sem::Vector*, std::string> dynamic_vector_write_;
     std::unordered_map<const sem::Vector*, std::string> int_dot_funcs_;
-    std::unordered_map<BinaryOperandType, std::string, BinaryOperandType::Hasher>
-        float_modulo_funcs_;
+    std::unordered_map<BinaryOperandType, std::string> float_modulo_funcs_;
     std::unordered_set<const sem::Struct*> emitted_structs_;
     bool requires_oes_sample_variables_ = false;
     bool requires_default_precision_qualifier_ = false;
