NFC: Fix a few typos in the tutorials and one in the comment of FunctionAttr::dropFunctionReference.

--

PiperOrigin-RevId: 242050934
diff --git a/examples/toy/Ch2/mlir/MLIRGen.cpp b/examples/toy/Ch2/mlir/MLIRGen.cpp
index 062f88a..11805e8 100644
--- a/examples/toy/Ch2/mlir/MLIRGen.cpp
+++ b/examples/toy/Ch2/mlir/MLIRGen.cpp
@@ -180,7 +180,7 @@
     if (!mlirGen(*funcAST.getBody()))
       return nullptr;
 
-    // Implicitly return void if no return statement was emited.
+    // Implicitly return void if no return statement was emitted.
     // FIXME: we may fix the parser instead to always return the last expression
     // (this would possibly help the REPL case later)
     if (function->getBlocks().back().back().getName().getStringRef() !=
diff --git a/examples/toy/Ch3/mlir/MLIRGen.cpp b/examples/toy/Ch3/mlir/MLIRGen.cpp
index 464a206..cf0dd07 100644
--- a/examples/toy/Ch3/mlir/MLIRGen.cpp
+++ b/examples/toy/Ch3/mlir/MLIRGen.cpp
@@ -181,7 +181,7 @@
     if (!mlirGen(*funcAST.getBody()))
       return nullptr;
 
-    // Implicitly return void if no return statement was emited.
+    // Implicitly return void if no return statement was emitted.
     // FIXME: we may fix the parser instead to always return the last expression
     // (this would possibly help the REPL case later)
     if (function->getBlocks().back().back().getName().getStringRef() !=
diff --git a/g3doc/Tutorials/Toy/Ch-1.md b/g3doc/Tutorials/Toy/Ch-1.md
index 80617f1..5479a1b 100644
--- a/g3doc/Tutorials/Toy/Ch-1.md
+++ b/g3doc/Tutorials/Toy/Ch-1.md
@@ -45,7 +45,7 @@
   # Define a variable `a` with shape <2, 3>, initialized with the literal value.
   # The shape is inferred from the supplied literal.
   var a = [[1, 2, 3], [4, 5, 6]];
-  # b is identical to a, the literal array is implicitely reshaped: defining new
+  # b is identical to a, the literal array is implicitly reshaped: defining new
   # variables is the way to reshape arrays (element count must match).
   var b<2, 3> = [1, 2, 3, 4, 5, 6];
   # transpose() and print() are the only builtin, the following will transpose
diff --git a/g3doc/Tutorials/Toy/Ch-2.md b/g3doc/Tutorials/Toy/Ch-2.md
index 85f5484..6a262b5 100644
--- a/g3doc/Tutorials/Toy/Ch-2.md
+++ b/g3doc/Tutorials/Toy/Ch-2.md
@@ -1,4 +1,4 @@
-# Chapter 2: Emiting Basic MLIR
+# Chapter 2: Emitting Basic MLIR
 
 [TOC]
 
@@ -47,7 +47,7 @@
 -   it is identified by its name, which is expected to be a unique string (e.g.
     `toy.transpose`).
 -   it takes as input zero or more operands (or arguments), which are SSA values
-    defined by other operations or refering to function and block arguments
+    defined by other operations or referring to function and block arguments
     (e.g. `%array`).
 -   it produces zero or more results (we will limit ourselves to a single result
     in the context of Toy), which are SSA values (e.g. `%t_array`).
diff --git a/include/mlir/IR/Attributes.h b/include/mlir/IR/Attributes.h
index 132105e..9c812a5 100644
--- a/include/mlir/IR/Attributes.h
+++ b/include/mlir/IR/Attributes.h
@@ -333,7 +333,7 @@
   static bool kindof(Kind kind) { return kind == Kind::Function; }
 
   /// This function is used by the internals of the Function class to null out
-  /// attributes refering to functions that are about to be deleted.
+  /// attributes referring to functions that are about to be deleted.
   static void dropFunctionReference(Function *value);
 };
 
diff --git a/lib/IR/MLIRContext.cpp b/lib/IR/MLIRContext.cpp
index 1a459ad..da6a6e7 100644
--- a/lib/IR/MLIRContext.cpp
+++ b/lib/IR/MLIRContext.cpp
@@ -1156,7 +1156,7 @@
 }
 
 /// This function is used by the internals of the Function class to null out
-/// attributes refering to functions that are about to be deleted.
+/// attributes referring to functions that are about to be deleted.
 void FunctionAttr::dropFunctionReference(Function *value) {
   auto &impl = value->getContext()->getImpl();
 
diff --git a/test/Examples/Toy/Ch1/ast.toy b/test/Examples/Toy/Ch1/ast.toy
index 0069869..dd315ea 100644
--- a/test/Examples/Toy/Ch1/ast.toy
+++ b/test/Examples/Toy/Ch1/ast.toy
@@ -10,7 +10,7 @@
   # Define a variable `a` with shape <2, 3>, initialized with the literal value.
   # The shape is inferred from the supplied literal.
   var a = [[1, 2, 3], [4, 5, 6]];
-  # b is identical to a, the literal array is implicitely reshaped: defining new
+  # b is identical to a, the literal array is implicitly reshaped: defining new
   # variables is the way to reshape arrays (element count must match).
   var b<2, 3> = [1, 2, 3, 4, 5, 6];
   # This call will specialize `multiply_transpose` with <2, 3> for both
diff --git a/test/Examples/Toy/Ch2/ast.toy b/test/Examples/Toy/Ch2/ast.toy
index 91f26b7..1287ee1 100644
--- a/test/Examples/Toy/Ch2/ast.toy
+++ b/test/Examples/Toy/Ch2/ast.toy
@@ -10,7 +10,7 @@
   # Define a variable `a` with shape <2, 3>, initialized with the literal value.
   # The shape is inferred from the supplied literal.
   var a = [[1, 2, 3], [4, 5, 6]];
-  # b is identical to a, the literal array is implicitely reshaped: defining new
+  # b is identical to a, the literal array is implicitly reshaped: defining new
   # variables is the way to reshape arrays (element count must match).
   var b<2, 3> = [1, 2, 3, 4, 5, 6];
   # This call will specialize `multiply_transpose` with <2, 3> for both
diff --git a/test/Examples/Toy/Ch3/ast.toy b/test/Examples/Toy/Ch3/ast.toy
index 0c90421..19400f1 100644
--- a/test/Examples/Toy/Ch3/ast.toy
+++ b/test/Examples/Toy/Ch3/ast.toy
@@ -10,7 +10,7 @@
   # Define a variable `a` with shape <2, 3>, initialized with the literal value.
   # The shape is inferred from the supplied literal.
   var a = [[1, 2, 3], [4, 5, 6]];
-  # b is identical to a, the literal array is implicitely reshaped: defining new
+  # b is identical to a, the literal array is implicitly reshaped: defining new
   # variables is the way to reshape arrays (element count must match).
   var b<2, 3> = [1, 2, 3, 4, 5, 6];
   # This call will specialize `multiply_transpose` with <2, 3> for both