Importing rustc-1.38.0
diff --git a/src/llvm-project/llvm/unittests/ADT/APFloatTest.cpp b/src/llvm-project/llvm/unittests/ADT/APFloatTest.cpp
index 64053a8..c76347e 100644
--- a/src/llvm-project/llvm/unittests/ADT/APFloatTest.cpp
+++ b/src/llvm-project/llvm/unittests/ADT/APFloatTest.cpp
@@ -1,9 +1,8 @@
 //===- llvm/unittest/ADT/APFloat.cpp - APFloat unit tests ---------------------===//
 //
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 //===----------------------------------------------------------------------===//
 
@@ -869,6 +868,33 @@
   EXPECT_EQ(2.05e+12,  APFloat(APFloat::IEEEdouble(), "002.05000e+12").convertToDouble());
   EXPECT_EQ(2.05e-12,  APFloat(APFloat::IEEEdouble(), "002.05000e-12").convertToDouble());
 
+  EXPECT_EQ(1.0,      APFloat(APFloat::IEEEdouble(), "1e").convertToDouble());
+  EXPECT_EQ(1.0,      APFloat(APFloat::IEEEdouble(), "+1e").convertToDouble());
+  EXPECT_EQ(-1.0,      APFloat(APFloat::IEEEdouble(), "-1e").convertToDouble());
+
+  EXPECT_EQ(1.0,      APFloat(APFloat::IEEEdouble(), "1.e").convertToDouble());
+  EXPECT_EQ(1.0,      APFloat(APFloat::IEEEdouble(), "+1.e").convertToDouble());
+  EXPECT_EQ(-1.0,      APFloat(APFloat::IEEEdouble(), "-1.e").convertToDouble());
+
+  EXPECT_EQ(0.1,      APFloat(APFloat::IEEEdouble(), ".1e").convertToDouble());
+  EXPECT_EQ(0.1,      APFloat(APFloat::IEEEdouble(), "+.1e").convertToDouble());
+  EXPECT_EQ(-0.1,      APFloat(APFloat::IEEEdouble(), "-.1e").convertToDouble());
+
+  EXPECT_EQ(1.1,      APFloat(APFloat::IEEEdouble(), "1.1e").convertToDouble());
+  EXPECT_EQ(1.1,      APFloat(APFloat::IEEEdouble(), "+1.1e").convertToDouble());
+  EXPECT_EQ(-1.1,      APFloat(APFloat::IEEEdouble(), "-1.1e").convertToDouble());
+
+  EXPECT_EQ(1.0,      APFloat(APFloat::IEEEdouble(), "1e+").convertToDouble());
+  EXPECT_EQ(1.0,      APFloat(APFloat::IEEEdouble(), "1e-").convertToDouble());
+
+  EXPECT_EQ(0.1,      APFloat(APFloat::IEEEdouble(), ".1e").convertToDouble());
+  EXPECT_EQ(0.1,      APFloat(APFloat::IEEEdouble(), ".1e+").convertToDouble());
+  EXPECT_EQ(0.1,      APFloat(APFloat::IEEEdouble(), ".1e-").convertToDouble());
+
+  EXPECT_EQ(1.0,      APFloat(APFloat::IEEEdouble(), "1.0e").convertToDouble());
+  EXPECT_EQ(1.0,      APFloat(APFloat::IEEEdouble(), "1.0e+").convertToDouble());
+  EXPECT_EQ(1.0,      APFloat(APFloat::IEEEdouble(), "1.0e-").convertToDouble());
+
   // These are "carefully selected" to overflow the fast log-base
   // calculations in APFloat.cpp
   EXPECT_TRUE(APFloat(APFloat::IEEEdouble(), "99e99999").isInfinity());
@@ -1166,36 +1192,6 @@
   EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), "-.e"), "Significand has no digits");
 }
 
-TEST(APFloatTest, StringDecimalExponentDeath) {
-  EXPECT_DEATH(APFloat(APFloat::IEEEdouble(),   "1e"), "Exponent has no digits");
-  EXPECT_DEATH(APFloat(APFloat::IEEEdouble(),  "+1e"), "Exponent has no digits");
-  EXPECT_DEATH(APFloat(APFloat::IEEEdouble(),  "-1e"), "Exponent has no digits");
-
-  EXPECT_DEATH(APFloat(APFloat::IEEEdouble(),   "1.e"), "Exponent has no digits");
-  EXPECT_DEATH(APFloat(APFloat::IEEEdouble(),  "+1.e"), "Exponent has no digits");
-  EXPECT_DEATH(APFloat(APFloat::IEEEdouble(),  "-1.e"), "Exponent has no digits");
-
-  EXPECT_DEATH(APFloat(APFloat::IEEEdouble(),   ".1e"), "Exponent has no digits");
-  EXPECT_DEATH(APFloat(APFloat::IEEEdouble(),  "+.1e"), "Exponent has no digits");
-  EXPECT_DEATH(APFloat(APFloat::IEEEdouble(),  "-.1e"), "Exponent has no digits");
-
-  EXPECT_DEATH(APFloat(APFloat::IEEEdouble(),   "1.1e"), "Exponent has no digits");
-  EXPECT_DEATH(APFloat(APFloat::IEEEdouble(),  "+1.1e"), "Exponent has no digits");
-  EXPECT_DEATH(APFloat(APFloat::IEEEdouble(),  "-1.1e"), "Exponent has no digits");
-
-
-  EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), "1e+"), "Exponent has no digits");
-  EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), "1e-"), "Exponent has no digits");
-
-  EXPECT_DEATH(APFloat(APFloat::IEEEdouble(),  ".1e"), "Exponent has no digits");
-  EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), ".1e+"), "Exponent has no digits");
-  EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), ".1e-"), "Exponent has no digits");
-
-  EXPECT_DEATH(APFloat(APFloat::IEEEdouble(),  "1.0e"), "Exponent has no digits");
-  EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), "1.0e+"), "Exponent has no digits");
-  EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), "1.0e-"), "Exponent has no digits");
-}
-
 TEST(APFloatTest, StringHexadecimalDeath) {
   EXPECT_DEATH(APFloat(APFloat::IEEEdouble(),  "0x"), "Invalid string");
   EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), "+0x"), "Invalid string");
diff --git a/src/llvm-project/llvm/unittests/ADT/APIntTest.cpp b/src/llvm-project/llvm/unittests/ADT/APIntTest.cpp
index 8b876f3..4ab79e4 100644
--- a/src/llvm-project/llvm/unittests/ADT/APIntTest.cpp
+++ b/src/llvm-project/llvm/unittests/ADT/APIntTest.cpp
@@ -1,9 +1,8 @@
 //===- llvm/unittest/ADT/APInt.cpp - APInt unit tests ---------------------===//
 //
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 //===----------------------------------------------------------------------===//
 
@@ -1263,6 +1262,22 @@
   EXPECT_EQ(5U, APInt::getBitsNeeded("-10", 10));
   EXPECT_EQ(6U, APInt::getBitsNeeded("-19", 10));
   EXPECT_EQ(6U, APInt::getBitsNeeded("-20", 10));
+
+  EXPECT_EQ(1U, APInt::getBitsNeeded("-1", 10));
+  EXPECT_EQ(2U, APInt::getBitsNeeded("-2", 10));
+  EXPECT_EQ(3U, APInt::getBitsNeeded("-4", 10));
+  EXPECT_EQ(4U, APInt::getBitsNeeded("-8", 10));
+  EXPECT_EQ(5U, APInt::getBitsNeeded("-16", 10));
+  EXPECT_EQ(6U, APInt::getBitsNeeded("-23", 10));
+  EXPECT_EQ(6U, APInt::getBitsNeeded("-32", 10));
+  EXPECT_EQ(7U, APInt::getBitsNeeded("-64", 10));
+  EXPECT_EQ(8U, APInt::getBitsNeeded("-127", 10));
+  EXPECT_EQ(8U, APInt::getBitsNeeded("-128", 10));
+  EXPECT_EQ(9U, APInt::getBitsNeeded("-255", 10));
+  EXPECT_EQ(9U, APInt::getBitsNeeded("-256", 10));
+  EXPECT_EQ(10U, APInt::getBitsNeeded("-512", 10));
+  EXPECT_EQ(11U, APInt::getBitsNeeded("-1024", 10));
+  EXPECT_EQ(12U, APInt::getBitsNeeded("-1025", 10));
 }
 
 TEST(APIntTest, StringBitsNeeded16) {
@@ -2382,6 +2397,42 @@
   }
 }
 
+TEST(APIntTest, umul_ov) {
+  const std::pair<uint64_t, uint64_t> Overflows[] = {
+      {0x8000000000000000, 2},
+      {0x5555555555555556, 3},
+      {4294967296, 4294967296},
+      {4294967295, 4294967298},
+  };
+  const std::pair<uint64_t, uint64_t> NonOverflows[] = {
+      {0x7fffffffffffffff, 2},
+      {0x5555555555555555, 3},
+      {4294967295, 4294967297},
+  };
+
+  bool Overflow;
+  for (auto &X : Overflows) {
+    APInt A(64, X.first);
+    APInt B(64, X.second);
+    (void)A.umul_ov(B, Overflow);
+    EXPECT_TRUE(Overflow);
+  }
+  for (auto &X : NonOverflows) {
+    APInt A(64, X.first);
+    APInt B(64, X.second);
+    (void)A.umul_ov(B, Overflow);
+    EXPECT_FALSE(Overflow);
+  }
+
+  for (unsigned Bits = 1; Bits <= 5; ++Bits)
+    for (unsigned A = 0; A != 1u << Bits; ++A)
+      for (unsigned B = 0; B != 1u << Bits; ++B) {
+        APInt C = APInt(Bits, A).umul_ov(APInt(Bits, B), Overflow);
+        APInt D = APInt(2 * Bits, A) * APInt(2 * Bits, B);
+        EXPECT_TRUE(D.getHiBits(Bits).isNullValue() != Overflow);
+      }
+}
+
 TEST(APIntTest, SolveQuadraticEquationWrap) {
   // Verify that "Solution" is the first non-negative integer that solves
   // Ax^2 + Bx + C = "0 or overflow", i.e. that it is a correct solution
@@ -2467,4 +2518,24 @@
     Iterate(i);
 }
 
+TEST(APIntTest, MultiplicativeInverseExaustive) {
+  for (unsigned BitWidth = 1; BitWidth <= 16; ++BitWidth) {
+    for (unsigned Value = 0; Value < (1u << BitWidth); ++Value) {
+      APInt V = APInt(BitWidth, Value);
+      APInt MulInv =
+          V.zext(BitWidth + 1)
+              .multiplicativeInverse(APInt::getSignedMinValue(BitWidth + 1))
+              .trunc(BitWidth);
+      APInt One = V * MulInv;
+      if (!V.isNullValue() && V.countTrailingZeros() == 0) {
+        // Multiplicative inverse exists for all odd numbers.
+        EXPECT_TRUE(One.isOneValue());
+      } else {
+        // Multiplicative inverse does not exist for even numbers (and 0).
+        EXPECT_TRUE(MulInv.isNullValue());
+      }
+    }
+  }
+}
+
 } // end anonymous namespace
diff --git a/src/llvm-project/llvm/unittests/ADT/APSIntTest.cpp b/src/llvm-project/llvm/unittests/ADT/APSIntTest.cpp
index a9b3071..1ad3871 100644
--- a/src/llvm-project/llvm/unittests/ADT/APSIntTest.cpp
+++ b/src/llvm-project/llvm/unittests/ADT/APSIntTest.cpp
@@ -1,9 +1,8 @@
 //===- llvm/unittest/ADT/APSIntTest.cpp - APSInt unit tests ---------------===//
 //
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 //===----------------------------------------------------------------------===//
 
@@ -160,4 +159,90 @@
 
 #endif
 
+TEST(APSIntTest, SignedHighBit) {
+  APSInt False(APInt(1, 0), false);
+  APSInt True(APInt(1, 1), false);
+  APSInt CharMin(APInt(8, 0), false);
+  APSInt CharSmall(APInt(8, 0x13), false);
+  APSInt CharBoundaryUnder(APInt(8, 0x7f), false);
+  APSInt CharBoundaryOver(APInt(8, 0x80), false);
+  APSInt CharLarge(APInt(8, 0xd9), false);
+  APSInt CharMax(APInt(8, 0xff), false);
+
+  EXPECT_FALSE(False.isNegative());
+  EXPECT_TRUE(False.isNonNegative());
+  EXPECT_FALSE(False.isStrictlyPositive());
+
+  EXPECT_TRUE(True.isNegative());
+  EXPECT_FALSE(True.isNonNegative());
+  EXPECT_FALSE(True.isStrictlyPositive());
+
+  EXPECT_FALSE(CharMin.isNegative());
+  EXPECT_TRUE(CharMin.isNonNegative());
+  EXPECT_FALSE(CharMin.isStrictlyPositive());
+
+  EXPECT_FALSE(CharSmall.isNegative());
+  EXPECT_TRUE(CharSmall.isNonNegative());
+  EXPECT_TRUE(CharSmall.isStrictlyPositive());
+
+  EXPECT_FALSE(CharBoundaryUnder.isNegative());
+  EXPECT_TRUE(CharBoundaryUnder.isNonNegative());
+  EXPECT_TRUE(CharBoundaryUnder.isStrictlyPositive());
+
+  EXPECT_TRUE(CharBoundaryOver.isNegative());
+  EXPECT_FALSE(CharBoundaryOver.isNonNegative());
+  EXPECT_FALSE(CharBoundaryOver.isStrictlyPositive());
+
+  EXPECT_TRUE(CharLarge.isNegative());
+  EXPECT_FALSE(CharLarge.isNonNegative());
+  EXPECT_FALSE(CharLarge.isStrictlyPositive());
+
+  EXPECT_TRUE(CharMax.isNegative());
+  EXPECT_FALSE(CharMax.isNonNegative());
+  EXPECT_FALSE(CharMax.isStrictlyPositive());
+}
+
+TEST(APSIntTest, UnsignedHighBit) {
+  APSInt False(APInt(1, 0));
+  APSInt True(APInt(1, 1));
+  APSInt CharMin(APInt(8, 0));
+  APSInt CharSmall(APInt(8, 0x13));
+  APSInt CharBoundaryUnder(APInt(8, 0x7f));
+  APSInt CharBoundaryOver(APInt(8, 0x80));
+  APSInt CharLarge(APInt(8, 0xd9));
+  APSInt CharMax(APInt(8, 0xff));
+
+  EXPECT_FALSE(False.isNegative());
+  EXPECT_TRUE(False.isNonNegative());
+  EXPECT_FALSE(False.isStrictlyPositive());
+
+  EXPECT_FALSE(True.isNegative());
+  EXPECT_TRUE(True.isNonNegative());
+  EXPECT_TRUE(True.isStrictlyPositive());
+
+  EXPECT_FALSE(CharMin.isNegative());
+  EXPECT_TRUE(CharMin.isNonNegative());
+  EXPECT_FALSE(CharMin.isStrictlyPositive());
+
+  EXPECT_FALSE(CharSmall.isNegative());
+  EXPECT_TRUE(CharSmall.isNonNegative());
+  EXPECT_TRUE(CharSmall.isStrictlyPositive());
+
+  EXPECT_FALSE(CharBoundaryUnder.isNegative());
+  EXPECT_TRUE(CharBoundaryUnder.isNonNegative());
+  EXPECT_TRUE(CharBoundaryUnder.isStrictlyPositive());
+
+  EXPECT_FALSE(CharBoundaryOver.isNegative());
+  EXPECT_TRUE(CharBoundaryOver.isNonNegative());
+  EXPECT_TRUE(CharBoundaryOver.isStrictlyPositive());
+
+  EXPECT_FALSE(CharLarge.isNegative());
+  EXPECT_TRUE(CharLarge.isNonNegative());
+  EXPECT_TRUE(CharLarge.isStrictlyPositive());
+
+  EXPECT_FALSE(CharMax.isNegative());
+  EXPECT_TRUE(CharMax.isNonNegative());
+  EXPECT_TRUE(CharMax.isStrictlyPositive());
+}
+
 } // end anonymous namespace
diff --git a/src/llvm-project/llvm/unittests/ADT/AnyTest.cpp b/src/llvm-project/llvm/unittests/ADT/AnyTest.cpp
index 658f6b6..2ca81bd 100644
--- a/src/llvm-project/llvm/unittests/ADT/AnyTest.cpp
+++ b/src/llvm-project/llvm/unittests/ADT/AnyTest.cpp
@@ -1,9 +1,8 @@
 //===- llvm/unittest/Support/AnyTest.cpp - Any tests ---===//
 //
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 //===----------------------------------------------------------------------===//
 
diff --git a/src/llvm-project/llvm/unittests/ADT/ArrayRefTest.cpp b/src/llvm-project/llvm/unittests/ADT/ArrayRefTest.cpp
index e01d212..04b92c0 100644
--- a/src/llvm-project/llvm/unittests/ADT/ArrayRefTest.cpp
+++ b/src/llvm-project/llvm/unittests/ADT/ArrayRefTest.cpp
@@ -1,9 +1,8 @@
 //===- llvm/unittest/ADT/ArrayRefTest.cpp - ArrayRef unit tests -----------===//
 //
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 //===----------------------------------------------------------------------===//
 
@@ -34,10 +33,6 @@
 
 // Check that we can't accidentally assign a temporary location to an ArrayRef.
 // (Unfortunately we can't make use of the same thing with constructors.)
-//
-// Disable this check under MSVC; even MSVC 2015 isn't inconsistent between
-// std::is_assignable and actually writing such an assignment.
-#if !defined(_MSC_VER)
 static_assert(
     !std::is_assignable<ArrayRef<int *>&, int *>::value,
     "Assigning from single prvalue element");
@@ -50,7 +45,6 @@
 static_assert(
     !std::is_assignable<ArrayRef<int *>&, std::initializer_list<int *>>::value,
     "Assigning from an initializer list");
-#endif
 
 namespace {
 
@@ -249,4 +243,14 @@
   EXPECT_TRUE(AR2.equals(AR2Ref));
 }
 
+TEST(ArrayRefTest, OwningArrayRef) {
+  static const int A1[] = {0, 1};
+  OwningArrayRef<int> A(makeArrayRef(A1));
+  OwningArrayRef<int> B(std::move(A));
+  EXPECT_EQ(A.data(), nullptr);
+}
+
+static_assert(is_trivially_copyable<ArrayRef<int>>::value,
+              "trivially copyable");
+
 } // end anonymous namespace
diff --git a/src/llvm-project/llvm/unittests/ADT/BitVectorTest.cpp b/src/llvm-project/llvm/unittests/ADT/BitVectorTest.cpp
index 84290b3..559dcc5 100644
--- a/src/llvm-project/llvm/unittests/ADT/BitVectorTest.cpp
+++ b/src/llvm-project/llvm/unittests/ADT/BitVectorTest.cpp
@@ -1,9 +1,8 @@
 //===- llvm/unittest/ADT/BitVectorTest.cpp - BitVector tests --------------===//
 //
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 //===----------------------------------------------------------------------===//
 
diff --git a/src/llvm-project/llvm/unittests/ADT/BitmaskEnumTest.cpp b/src/llvm-project/llvm/unittests/ADT/BitmaskEnumTest.cpp
index 77635c6..f07e203 100644
--- a/src/llvm-project/llvm/unittests/ADT/BitmaskEnumTest.cpp
+++ b/src/llvm-project/llvm/unittests/ADT/BitmaskEnumTest.cpp
@@ -1,9 +1,8 @@
 //===- llvm/unittest/ADT/BitmaskEnumTest.cpp - BitmaskEnum unit tests -----===//
 //
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 //===----------------------------------------------------------------------===//
 
diff --git a/src/llvm-project/llvm/unittests/ADT/BreadthFirstIteratorTest.cpp b/src/llvm-project/llvm/unittests/ADT/BreadthFirstIteratorTest.cpp
index 42a07bb..5d034ad 100644
--- a/src/llvm-project/llvm/unittests/ADT/BreadthFirstIteratorTest.cpp
+++ b/src/llvm-project/llvm/unittests/ADT/BreadthFirstIteratorTest.cpp
@@ -1,9 +1,8 @@
 //=== llvm/unittest/ADT/BreadthFirstIteratorTest.cpp - BFS iterator tests -===//
 //
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 //===----------------------------------------------------------------------===//
 
diff --git a/src/llvm-project/llvm/unittests/ADT/BumpPtrListTest.cpp b/src/llvm-project/llvm/unittests/ADT/BumpPtrListTest.cpp
index be34a71..ebd0ce2 100644
--- a/src/llvm-project/llvm/unittests/ADT/BumpPtrListTest.cpp
+++ b/src/llvm-project/llvm/unittests/ADT/BumpPtrListTest.cpp
@@ -1,9 +1,8 @@
 //===- unittests/ADT/BumpPtrListTest.cpp - BumpPtrList unit tests ---------===//
 //
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 //===----------------------------------------------------------------------===//
 
diff --git a/src/llvm-project/llvm/unittests/ADT/CMakeLists.txt b/src/llvm-project/llvm/unittests/ADT/CMakeLists.txt
index 098b6b6..676ce18 100644
--- a/src/llvm-project/llvm/unittests/ADT/CMakeLists.txt
+++ b/src/llvm-project/llvm/unittests/ADT/CMakeLists.txt
@@ -18,6 +18,7 @@
   DenseSetTest.cpp
   DepthFirstIteratorTest.cpp
   EquivalenceClassesTest.cpp
+  FallibleIteratorTest.cpp
   FoldingSet.cpp
   FunctionExtrasTest.cpp
   FunctionRefTest.cpp
@@ -64,6 +65,7 @@
   StringExtrasTest.cpp
   StringMapTest.cpp
   StringRefTest.cpp
+  StringSetTest.cpp
   StringSwitchTest.cpp
   TinyPtrVectorTest.cpp
   TripleTest.cpp
@@ -71,4 +73,6 @@
   VariadicFunctionTest.cpp
   )
 
+target_link_libraries(ADTTests PRIVATE LLVMTestingSupport)
+
 add_dependencies(ADTTests intrinsics_gen)
diff --git a/src/llvm-project/llvm/unittests/ADT/DAGDeltaAlgorithmTest.cpp b/src/llvm-project/llvm/unittests/ADT/DAGDeltaAlgorithmTest.cpp
index 030fadb..66a67d9 100644
--- a/src/llvm-project/llvm/unittests/ADT/DAGDeltaAlgorithmTest.cpp
+++ b/src/llvm-project/llvm/unittests/ADT/DAGDeltaAlgorithmTest.cpp
@@ -1,9 +1,8 @@
 //===- llvm/unittest/ADT/DAGDeltaAlgorithmTest.cpp ------------------------===//
 //
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 //===----------------------------------------------------------------------===//
 
diff --git a/src/llvm-project/llvm/unittests/ADT/DeltaAlgorithmTest.cpp b/src/llvm-project/llvm/unittests/ADT/DeltaAlgorithmTest.cpp
index 01dc1f3..5e28412 100644
--- a/src/llvm-project/llvm/unittests/ADT/DeltaAlgorithmTest.cpp
+++ b/src/llvm-project/llvm/unittests/ADT/DeltaAlgorithmTest.cpp
@@ -1,9 +1,8 @@
 //===- llvm/unittest/ADT/DeltaAlgorithmTest.cpp ---------------------------===//
 //
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 //===----------------------------------------------------------------------===//
 
diff --git a/src/llvm-project/llvm/unittests/ADT/DenseMapTest.cpp b/src/llvm-project/llvm/unittests/ADT/DenseMapTest.cpp
index ee9c5dd..7e85ce7 100644
--- a/src/llvm-project/llvm/unittests/ADT/DenseMapTest.cpp
+++ b/src/llvm-project/llvm/unittests/ADT/DenseMapTest.cpp
@@ -1,9 +1,8 @@
 //===- llvm/unittest/ADT/DenseMapMap.cpp - DenseMap unit tests --*- C++ -*-===//
 //
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 //===----------------------------------------------------------------------===//
 
@@ -120,17 +119,8 @@
   // Lookup tests
   EXPECT_FALSE(this->Map.count(this->getKey()));
   EXPECT_TRUE(this->Map.find(this->getKey()) == this->Map.end());
-#if !defined(_MSC_VER) || defined(__clang__)
   EXPECT_EQ(typename TypeParam::mapped_type(),
             this->Map.lookup(this->getKey()));
-#else
-  // MSVC, at least old versions, cannot parse the typename to disambiguate
-  // TypeParam::mapped_type as a type. However, because MSVC doesn't implement
-  // two-phase name lookup, it also doesn't require the typename. Deal with
-  // this mutual incompatibility through specialized code.
-  EXPECT_EQ(TypeParam::mapped_type(),
-            this->Map.lookup(this->getKey()));
-#endif
 }
 
 // Constant map tests
diff --git a/src/llvm-project/llvm/unittests/ADT/DenseSetTest.cpp b/src/llvm-project/llvm/unittests/ADT/DenseSetTest.cpp
index 7368e2e..e6fe9ca 100644
--- a/src/llvm-project/llvm/unittests/ADT/DenseSetTest.cpp
+++ b/src/llvm-project/llvm/unittests/ADT/DenseSetTest.cpp
@@ -1,9 +1,8 @@
 //===- llvm/unittest/ADT/DenseSetTest.cpp - DenseSet unit tests --*- C++ -*-===//
 //
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 //===----------------------------------------------------------------------===//
 
diff --git a/src/llvm-project/llvm/unittests/ADT/DepthFirstIteratorTest.cpp b/src/llvm-project/llvm/unittests/ADT/DepthFirstIteratorTest.cpp
index 4169cd4..0e3e0e6 100644
--- a/src/llvm-project/llvm/unittests/ADT/DepthFirstIteratorTest.cpp
+++ b/src/llvm-project/llvm/unittests/ADT/DepthFirstIteratorTest.cpp
@@ -1,9 +1,8 @@
 //=== llvm/unittest/ADT/DepthFirstIteratorTest.cpp - DFS iterator tests ---===//
 //
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 //===----------------------------------------------------------------------===//
 
diff --git a/src/llvm-project/llvm/unittests/ADT/EquivalenceClassesTest.cpp b/src/llvm-project/llvm/unittests/ADT/EquivalenceClassesTest.cpp
index 57d588a..30eab6e 100644
--- a/src/llvm-project/llvm/unittests/ADT/EquivalenceClassesTest.cpp
+++ b/src/llvm-project/llvm/unittests/ADT/EquivalenceClassesTest.cpp
@@ -1,9 +1,8 @@
 //=== llvm/unittest/ADT/EquivalenceClassesTest.cpp - the structure tests --===//
 //
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 //===----------------------------------------------------------------------===//
 
diff --git a/src/llvm-project/llvm/unittests/ADT/FallibleIteratorTest.cpp b/src/llvm-project/llvm/unittests/ADT/FallibleIteratorTest.cpp
new file mode 100644
index 0000000..d338974
--- /dev/null
+++ b/src/llvm-project/llvm/unittests/ADT/FallibleIteratorTest.cpp
@@ -0,0 +1,291 @@
+//===- unittests/ADT/FallibleIteratorTest.cpp - fallible_iterator.h tests -===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/ADT/fallible_iterator.h"
+#include "llvm/Testing/Support/Error.h"
+
+#include "gtest/gtest-spi.h"
+#include "gtest/gtest.h"
+
+#include <utility>
+#include <vector>
+
+using namespace llvm;
+
+namespace {
+
+using ItemValid = enum { ValidItem, InvalidItem };
+using LinkValid = enum { ValidLink, InvalidLink };
+
+class Item {
+public:
+  Item(ItemValid V) : V(V) {}
+  bool isValid() const { return V == ValidItem; }
+
+private:
+  ItemValid V;
+};
+
+// A utility to mock "bad collections". It supports both invalid items,
+// where the dereference operator may return an Error, and bad links
+// where the inc/dec operations may return an Error.
+// Each element of the mock collection contains a pair of a (possibly broken)
+// item and link.
+using FallibleCollection = std::vector<std::pair<Item, LinkValid>>;
+
+class FallibleCollectionWalker {
+public:
+  FallibleCollectionWalker(FallibleCollection &C, unsigned Idx)
+      : C(C), Idx(Idx) {}
+
+  Item &operator*() { return C[Idx].first; }
+
+  const Item &operator*() const { return C[Idx].first; }
+
+  Error inc() {
+    assert(Idx != C.size() && "Walking off end of (mock) collection");
+    if (C[Idx].second == ValidLink) {
+      ++Idx;
+      return Error::success();
+    }
+    return make_error<StringError>("cant get next object in (mock) collection",
+                                   inconvertibleErrorCode());
+  }
+
+  Error dec() {
+    assert(Idx != 0 && "Walking off start of (mock) collection");
+    --Idx;
+    if (C[Idx].second == ValidLink)
+      return Error::success();
+    return make_error<StringError>("cant get prev object in (mock) collection",
+                                   inconvertibleErrorCode());
+  }
+
+  friend bool operator==(const FallibleCollectionWalker &LHS,
+                         const FallibleCollectionWalker &RHS) {
+    assert(&LHS.C == &RHS.C && "Comparing iterators across collectionss.");
+    return LHS.Idx == RHS.Idx;
+  }
+
+private:
+  FallibleCollection &C;
+  unsigned Idx;
+};
+
+class FallibleCollectionWalkerWithStructDeref
+    : public FallibleCollectionWalker {
+public:
+  using FallibleCollectionWalker::FallibleCollectionWalker;
+
+  Item *operator->() { return &this->operator*(); }
+
+  const Item *operator->() const { return &this->operator*(); }
+};
+
+class FallibleCollectionWalkerWithFallibleDeref
+    : public FallibleCollectionWalker {
+public:
+  using FallibleCollectionWalker::FallibleCollectionWalker;
+
+  Expected<Item &> operator*() {
+    auto &I = FallibleCollectionWalker::operator*();
+    if (!I.isValid())
+      return make_error<StringError>("bad item", inconvertibleErrorCode());
+    return I;
+  }
+
+  Expected<const Item &> operator*() const {
+    const auto &I = FallibleCollectionWalker::operator*();
+    if (!I.isValid())
+      return make_error<StringError>("bad item", inconvertibleErrorCode());
+    return I;
+  }
+};
+
+TEST(FallibleIteratorTest, BasicSuccess) {
+
+  // Check that a basic use-case involing successful iteration over a
+  // "FallibleCollection" works.
+
+  FallibleCollection C({{ValidItem, ValidLink}, {ValidItem, ValidLink}});
+
+  FallibleCollectionWalker begin(C, 0);
+  FallibleCollectionWalker end(C, 2);
+
+  Error Err = Error::success();
+  for (auto &Elem :
+       make_fallible_range<FallibleCollectionWalker>(begin, end, Err))
+    EXPECT_TRUE(Elem.isValid());
+  cantFail(std::move(Err));
+}
+
+TEST(FallibleIteratorTest, BasicFailure) {
+
+  // Check that a iteration failure (due to the InvalidLink state on element one
+  // of the fallible collection) breaks out of the loop and raises an Error.
+
+  FallibleCollection C({{ValidItem, ValidLink}, {ValidItem, InvalidLink}});
+
+  FallibleCollectionWalker begin(C, 0);
+  FallibleCollectionWalker end(C, 2);
+
+  Error Err = Error::success();
+  for (auto &Elem :
+       make_fallible_range<FallibleCollectionWalker>(begin, end, Err))
+    EXPECT_TRUE(Elem.isValid());
+
+  EXPECT_THAT_ERROR(std::move(Err), Failed()) << "Expected failure value";
+}
+
+TEST(FallibleIteratorTest, NoRedundantErrorCheckOnEarlyExit) {
+
+  // Check that an early return from the loop body does not require a redundant
+  // check of Err.
+
+  FallibleCollection C({{ValidItem, ValidLink}, {ValidItem, ValidLink}});
+
+  FallibleCollectionWalker begin(C, 0);
+  FallibleCollectionWalker end(C, 2);
+
+  Error Err = Error::success();
+  for (auto &Elem :
+       make_fallible_range<FallibleCollectionWalker>(begin, end, Err)) {
+    (void)Elem;
+    return;
+  }
+  // Err not checked, but should be ok because we exit from the loop
+  // body.
+}
+
+#if LLVM_ENABLE_ABI_BREAKING_CHECKS
+TEST(FallibleIteratorTest, RegularLoopExitRequiresErrorCheck) {
+
+  // Check that Err must be checked after a normal (i.e. not early) loop exit
+  // by failing to check and expecting program death (due to the unchecked
+  // error).
+
+  EXPECT_DEATH(
+      {
+        FallibleCollection C({{ValidItem, ValidLink}, {ValidItem, ValidLink}});
+
+        FallibleCollectionWalker begin(C, 0);
+        FallibleCollectionWalker end(C, 2);
+
+        Error Err = Error::success();
+        for (auto &Elem :
+             make_fallible_range<FallibleCollectionWalker>(begin, end, Err))
+          (void)Elem;
+      },
+      "Program aborted due to an unhandled Error:")
+      << "Normal (i.e. not early) loop exit should require an error check";
+}
+#endif
+
+TEST(FallibleIteratorTest, RawIncrementAndDecrementBehavior) {
+
+  // Check the exact behavior of increment / decrement.
+
+  FallibleCollection C({{ValidItem, ValidLink},
+                        {ValidItem, InvalidLink},
+                        {ValidItem, ValidLink},
+                        {ValidItem, InvalidLink}});
+
+  {
+    // One increment from begin succeeds.
+    Error Err = Error::success();
+    auto I = make_fallible_itr(FallibleCollectionWalker(C, 0), Err);
+    ++I;
+    EXPECT_THAT_ERROR(std::move(Err), Succeeded());
+  }
+
+  {
+    // Two increments from begin fail.
+    Error Err = Error::success();
+    auto I = make_fallible_itr(FallibleCollectionWalker(C, 0), Err);
+    ++I;
+    EXPECT_THAT_ERROR(std::move(Err), Succeeded());
+    ++I;
+    EXPECT_THAT_ERROR(std::move(Err), Failed()) << "Expected failure value";
+  }
+
+  {
+    // One decement from element three succeeds.
+    Error Err = Error::success();
+    auto I = make_fallible_itr(FallibleCollectionWalker(C, 3), Err);
+    --I;
+    EXPECT_THAT_ERROR(std::move(Err), Succeeded());
+  }
+
+  {
+    // One decement from element three succeeds.
+    Error Err = Error::success();
+    auto I = make_fallible_itr(FallibleCollectionWalker(C, 3), Err);
+    --I;
+    EXPECT_THAT_ERROR(std::move(Err), Succeeded());
+    --I;
+    EXPECT_THAT_ERROR(std::move(Err), Failed());
+  }
+}
+
+TEST(FallibleIteratorTest, CheckStructDerefOperatorSupport) {
+  // Check that the fallible_iterator wrapper forwards through to the
+  // underlying iterator's structure dereference operator if present.
+
+  FallibleCollection C({{ValidItem, ValidLink},
+                        {ValidItem, ValidLink},
+                        {InvalidItem, InvalidLink}});
+
+  FallibleCollectionWalkerWithStructDeref begin(C, 0);
+
+  {
+    Error Err = Error::success();
+    auto I = make_fallible_itr(begin, Err);
+    EXPECT_TRUE(I->isValid());
+    cantFail(std::move(Err));
+  }
+
+  {
+    Error Err = Error::success();
+    const auto I = make_fallible_itr(begin, Err);
+    EXPECT_TRUE(I->isValid());
+    cantFail(std::move(Err));
+  }
+}
+
+TEST(FallibleIteratorTest, CheckDerefToExpectedSupport) {
+
+  // Check that the fallible_iterator wrapper forwards value types, in
+  // particular llvm::Expected, correctly.
+
+  FallibleCollection C({{ValidItem, ValidLink},
+                        {InvalidItem, ValidLink},
+                        {ValidItem, ValidLink}});
+
+  FallibleCollectionWalkerWithFallibleDeref begin(C, 0);
+  FallibleCollectionWalkerWithFallibleDeref end(C, 3);
+
+  Error Err = Error::success();
+  auto I = make_fallible_itr(begin, Err);
+  auto E = make_fallible_end(end);
+
+  Expected<Item> V1 = *I;
+  EXPECT_THAT_ERROR(V1.takeError(), Succeeded());
+  ++I;
+  EXPECT_NE(I, E); // Implicitly check error.
+  Expected<Item> V2 = *I;
+  EXPECT_THAT_ERROR(V2.takeError(), Failed());
+  ++I;
+  EXPECT_NE(I, E); // Implicitly check error.
+  Expected<Item> V3 = *I;
+  EXPECT_THAT_ERROR(V3.takeError(), Succeeded());
+  ++I;
+  EXPECT_EQ(I, E);
+  cantFail(std::move(Err));
+}
+
+} // namespace
diff --git a/src/llvm-project/llvm/unittests/ADT/FoldingSet.cpp b/src/llvm-project/llvm/unittests/ADT/FoldingSet.cpp
index f5b1b71..c03353f 100644
--- a/src/llvm-project/llvm/unittests/ADT/FoldingSet.cpp
+++ b/src/llvm-project/llvm/unittests/ADT/FoldingSet.cpp
@@ -1,9 +1,8 @@
 //===- llvm/unittest/ADT/FoldingSetTest.cpp -------------------------------===//
 //
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 //===----------------------------------------------------------------------===//
 //
diff --git a/src/llvm-project/llvm/unittests/ADT/FunctionExtrasTest.cpp b/src/llvm-project/llvm/unittests/ADT/FunctionExtrasTest.cpp
index d85962e..bbbb045 100644
--- a/src/llvm-project/llvm/unittests/ADT/FunctionExtrasTest.cpp
+++ b/src/llvm-project/llvm/unittests/ADT/FunctionExtrasTest.cpp
@@ -1,9 +1,8 @@
 //===- FunctionExtrasTest.cpp - Unit tests for function type erasure ------===//
 //
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 //===----------------------------------------------------------------------===//
 
diff --git a/src/llvm-project/llvm/unittests/ADT/FunctionRefTest.cpp b/src/llvm-project/llvm/unittests/ADT/FunctionRefTest.cpp
index b7ef7d7..a599bee 100644
--- a/src/llvm-project/llvm/unittests/ADT/FunctionRefTest.cpp
+++ b/src/llvm-project/llvm/unittests/ADT/FunctionRefTest.cpp
@@ -1,9 +1,8 @@
 //===- llvm/unittest/ADT/MakeUniqueTest.cpp - make_unique unit tests ------===//
 //
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 //===----------------------------------------------------------------------===//
 
diff --git a/src/llvm-project/llvm/unittests/ADT/HashingTest.cpp b/src/llvm-project/llvm/unittests/ADT/HashingTest.cpp
index d96dd7e..66d63d4 100644
--- a/src/llvm-project/llvm/unittests/ADT/HashingTest.cpp
+++ b/src/llvm-project/llvm/unittests/ADT/HashingTest.cpp
@@ -1,9 +1,8 @@
 //===- llvm/unittest/ADT/HashingTest.cpp ----------------------------------===//
 //
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 //===----------------------------------------------------------------------===//
 //
diff --git a/src/llvm-project/llvm/unittests/ADT/IListBaseTest.cpp b/src/llvm-project/llvm/unittests/ADT/IListBaseTest.cpp
index 3b8ede8..2983618 100644
--- a/src/llvm-project/llvm/unittests/ADT/IListBaseTest.cpp
+++ b/src/llvm-project/llvm/unittests/ADT/IListBaseTest.cpp
@@ -1,9 +1,8 @@
 //===- unittests/ADT/IListBaseTest.cpp - ilist_base unit tests ------------===//
 //
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 //===----------------------------------------------------------------------===//
 
diff --git a/src/llvm-project/llvm/unittests/ADT/IListIteratorTest.cpp b/src/llvm-project/llvm/unittests/ADT/IListIteratorTest.cpp
index 8b2aa62..559e32d 100644
--- a/src/llvm-project/llvm/unittests/ADT/IListIteratorTest.cpp
+++ b/src/llvm-project/llvm/unittests/ADT/IListIteratorTest.cpp
@@ -1,9 +1,8 @@
 //===- unittests/ADT/IListIteratorTest.cpp - ilist_iterator unit tests ----===//
 //
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 //===----------------------------------------------------------------------===//
 
diff --git a/src/llvm-project/llvm/unittests/ADT/IListNodeBaseTest.cpp b/src/llvm-project/llvm/unittests/ADT/IListNodeBaseTest.cpp
index 8819ab1..65f85fc 100644
--- a/src/llvm-project/llvm/unittests/ADT/IListNodeBaseTest.cpp
+++ b/src/llvm-project/llvm/unittests/ADT/IListNodeBaseTest.cpp
@@ -1,9 +1,8 @@
 //===- unittests/ADT/IListNodeBaseTest.cpp - ilist_node_base unit tests ---===//
 //
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 //===----------------------------------------------------------------------===//
 
diff --git a/src/llvm-project/llvm/unittests/ADT/IListNodeTest.cpp b/src/llvm-project/llvm/unittests/ADT/IListNodeTest.cpp
index 51bebc2..cf775eb 100644
--- a/src/llvm-project/llvm/unittests/ADT/IListNodeTest.cpp
+++ b/src/llvm-project/llvm/unittests/ADT/IListNodeTest.cpp
@@ -1,9 +1,8 @@
 //===- unittests/ADT/IListNodeTest.cpp - ilist_node unit tests ------------===//
 //
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 //===----------------------------------------------------------------------===//
 
diff --git a/src/llvm-project/llvm/unittests/ADT/IListSentinelTest.cpp b/src/llvm-project/llvm/unittests/ADT/IListSentinelTest.cpp
index bd60c90..1f4a831 100644
--- a/src/llvm-project/llvm/unittests/ADT/IListSentinelTest.cpp
+++ b/src/llvm-project/llvm/unittests/ADT/IListSentinelTest.cpp
@@ -1,9 +1,8 @@
 //===- unittests/ADT/IListSentinelTest.cpp - ilist_sentinel unit tests ----===//
 //
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 //===----------------------------------------------------------------------===//
 
diff --git a/src/llvm-project/llvm/unittests/ADT/IListTest.cpp b/src/llvm-project/llvm/unittests/ADT/IListTest.cpp
index 0dee4c1..18f6c41 100644
--- a/src/llvm-project/llvm/unittests/ADT/IListTest.cpp
+++ b/src/llvm-project/llvm/unittests/ADT/IListTest.cpp
@@ -1,9 +1,8 @@
 //===- unittests/ADT/IListTest.cpp - ilist unit tests ---------------------===//
 //
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 //===----------------------------------------------------------------------===//
 
@@ -208,6 +207,12 @@
 } // end namespace
 
 namespace llvm {
+// These nodes are stack-allocated for testing purposes, so don't let the ilist
+// own or delete them.
+template <> struct ilist_alloc_traits<NodeWithCallback> {
+  static void deleteNode(NodeWithCallback *) {}
+};
+
 template <> struct ilist_callback_traits<NodeWithCallback> {
   void addNodeToList(NodeWithCallback *N) { N->IsInList = true; }
   void removeNodeFromList(NodeWithCallback *N) { N->IsInList = false; }
@@ -248,6 +253,30 @@
   ASSERT_TRUE(N.WasTransferred);
 }
 
+TEST(IListTest, sameListSplice) {
+  NodeWithCallback N1(1);
+  NodeWithCallback N2(2);
+  ASSERT_FALSE(N1.WasTransferred);
+  ASSERT_FALSE(N2.WasTransferred);
+
+  ilist<NodeWithCallback> L1;
+  L1.insert(L1.end(), &N1);
+  L1.insert(L1.end(), &N2);
+  ASSERT_EQ(2u, L1.size());
+  ASSERT_EQ(&N1, &L1.front());
+  ASSERT_FALSE(N1.WasTransferred);
+  ASSERT_FALSE(N2.WasTransferred);
+
+  // Swap the nodes with splice inside the same list. Check that we get the
+  // transfer callback.
+  L1.splice(L1.begin(), L1, std::next(L1.begin()), L1.end());
+  ASSERT_EQ(2u, L1.size());
+  ASSERT_EQ(&N1, &L1.back());
+  ASSERT_EQ(&N2, &L1.front());
+  ASSERT_FALSE(N1.WasTransferred);
+  ASSERT_TRUE(N2.WasTransferred);
+}
+
 struct PrivateNode : private ilist_node<PrivateNode> {
   friend struct llvm::ilist_detail::NodeAccess;
 
diff --git a/src/llvm-project/llvm/unittests/ADT/ImmutableListTest.cpp b/src/llvm-project/llvm/unittests/ADT/ImmutableListTest.cpp
index 280cb2e..b0b1e0e 100644
--- a/src/llvm-project/llvm/unittests/ADT/ImmutableListTest.cpp
+++ b/src/llvm-project/llvm/unittests/ADT/ImmutableListTest.cpp
@@ -1,9 +1,8 @@
 //===--------- ImmutableListTest.cpp - ImmutableList unit tests --*- C++ -*-==//
 //
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. Lee LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 //===----------------------------------------------------------------------===//
 
@@ -268,4 +267,7 @@
   ASSERT_EQ(6, i);
 }
 
+static_assert(is_trivially_copyable<ImmutableList<Wrapper<long>>>::value,
+              "trivially copyable");
+
 } // namespace
diff --git a/src/llvm-project/llvm/unittests/ADT/ImmutableMapTest.cpp b/src/llvm-project/llvm/unittests/ADT/ImmutableMapTest.cpp
index 23ca168..fa61816 100644
--- a/src/llvm-project/llvm/unittests/ADT/ImmutableMapTest.cpp
+++ b/src/llvm-project/llvm/unittests/ADT/ImmutableMapTest.cpp
@@ -1,9 +1,8 @@
 //===----------- ImmutableMapTest.cpp - ImmutableMap unit tests ------------===//
 //
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 //===----------------------------------------------------------------------===//
 
diff --git a/src/llvm-project/llvm/unittests/ADT/ImmutableSetTest.cpp b/src/llvm-project/llvm/unittests/ADT/ImmutableSetTest.cpp
index 35ac2c1..9fe7a80 100644
--- a/src/llvm-project/llvm/unittests/ADT/ImmutableSetTest.cpp
+++ b/src/llvm-project/llvm/unittests/ADT/ImmutableSetTest.cpp
@@ -1,9 +1,8 @@
 //===----------- ImmutableSetTest.cpp - ImmutableSet unit tests ------------===//
 //
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 //===----------------------------------------------------------------------===//
 
diff --git a/src/llvm-project/llvm/unittests/ADT/IntEqClassesTest.cpp b/src/llvm-project/llvm/unittests/ADT/IntEqClassesTest.cpp
index fc908c1..1c15d2c 100644
--- a/src/llvm-project/llvm/unittests/ADT/IntEqClassesTest.cpp
+++ b/src/llvm-project/llvm/unittests/ADT/IntEqClassesTest.cpp
@@ -1,9 +1,8 @@
 //===---- ADT/IntEqClassesTest.cpp - IntEqClasses unit tests ----*- C++ -*-===//
 //
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 //===----------------------------------------------------------------------===//
 
diff --git a/src/llvm-project/llvm/unittests/ADT/IntervalMapTest.cpp b/src/llvm-project/llvm/unittests/ADT/IntervalMapTest.cpp
index 513c063..170d152 100644
--- a/src/llvm-project/llvm/unittests/ADT/IntervalMapTest.cpp
+++ b/src/llvm-project/llvm/unittests/ADT/IntervalMapTest.cpp
@@ -1,9 +1,8 @@
 //===---- ADT/IntervalMapTest.cpp - IntervalMap unit tests ------*- C++ -*-===//
 //
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 //===----------------------------------------------------------------------===//
 
diff --git a/src/llvm-project/llvm/unittests/ADT/IntrusiveRefCntPtrTest.cpp b/src/llvm-project/llvm/unittests/ADT/IntrusiveRefCntPtrTest.cpp
index 83dc137..c248b04 100644
--- a/src/llvm-project/llvm/unittests/ADT/IntrusiveRefCntPtrTest.cpp
+++ b/src/llvm-project/llvm/unittests/ADT/IntrusiveRefCntPtrTest.cpp
@@ -1,9 +1,8 @@
 //===- unittest/ADT/IntrusiveRefCntPtrTest.cpp ----------------------------===//
 //
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 //===----------------------------------------------------------------------===//
 
diff --git a/src/llvm-project/llvm/unittests/ADT/IteratorTest.cpp b/src/llvm-project/llvm/unittests/ADT/IteratorTest.cpp
index 902ddfb..f46f109 100644
--- a/src/llvm-project/llvm/unittests/ADT/IteratorTest.cpp
+++ b/src/llvm-project/llvm/unittests/ADT/IteratorTest.cpp
@@ -1,9 +1,8 @@
 //===- IteratorTest.cpp - Unit tests for iterator utilities ---------------===//
 //
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 //===----------------------------------------------------------------------===//
 
diff --git a/src/llvm-project/llvm/unittests/ADT/MakeUniqueTest.cpp b/src/llvm-project/llvm/unittests/ADT/MakeUniqueTest.cpp
index 3b4938a..c0c1096 100644
--- a/src/llvm-project/llvm/unittests/ADT/MakeUniqueTest.cpp
+++ b/src/llvm-project/llvm/unittests/ADT/MakeUniqueTest.cpp
@@ -1,9 +1,8 @@
 //===- llvm/unittest/ADT/MakeUniqueTest.cpp - make_unique unit tests ------===//
 //
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 //===----------------------------------------------------------------------===//
 
diff --git a/src/llvm-project/llvm/unittests/ADT/MapVectorTest.cpp b/src/llvm-project/llvm/unittests/ADT/MapVectorTest.cpp
index 16e9b5a..b8fdbdd 100644
--- a/src/llvm-project/llvm/unittests/ADT/MapVectorTest.cpp
+++ b/src/llvm-project/llvm/unittests/ADT/MapVectorTest.cpp
@@ -1,9 +1,8 @@
 //===- unittest/ADT/MapVectorTest.cpp - MapVector unit tests ----*- C++ -*-===//
 //
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 //===----------------------------------------------------------------------===//
 
diff --git a/src/llvm-project/llvm/unittests/ADT/MappedIteratorTest.cpp b/src/llvm-project/llvm/unittests/ADT/MappedIteratorTest.cpp
index d8c48a7..61e45e3 100644
--- a/src/llvm-project/llvm/unittests/ADT/MappedIteratorTest.cpp
+++ b/src/llvm-project/llvm/unittests/ADT/MappedIteratorTest.cpp
@@ -1,9 +1,8 @@
 //===------ MappedIteratorTest.cpp - Unit tests for mapped_iterator -------===//
 //
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 //===----------------------------------------------------------------------===//
 
diff --git a/src/llvm-project/llvm/unittests/ADT/OptionalTest.cpp b/src/llvm-project/llvm/unittests/ADT/OptionalTest.cpp
index 20bc9da..1f26c10 100644
--- a/src/llvm-project/llvm/unittests/ADT/OptionalTest.cpp
+++ b/src/llvm-project/llvm/unittests/ADT/OptionalTest.cpp
@@ -1,17 +1,28 @@
 //===- llvm/unittest/ADT/OptionalTest.cpp - Optional unit tests -----------===//
 //
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 //===----------------------------------------------------------------------===//
 
 #include "llvm/ADT/Optional.h"
+#include "llvm/ADT/SmallString.h"
+#include "llvm/Support/raw_ostream.h"
+#include "gtest/gtest-spi.h"
 #include "gtest/gtest.h"
 
+#include <array>
+
+
 using namespace llvm;
 
+static_assert(is_trivially_copyable<Optional<int>>::value,
+          "trivially copyable");
+
+static_assert(is_trivially_copyable<Optional<std::array<int, 3>>>::value,
+              "trivially copyable");
+
 namespace {
 
 struct NonDefaultConstructible {
@@ -41,6 +52,10 @@
 unsigned NonDefaultConstructible::Destructions = 0;
 unsigned NonDefaultConstructible::CopyAssignments = 0;
 
+static_assert(
+      !is_trivially_copyable<Optional<NonDefaultConstructible>>::value,
+      "not trivially copyable");
+
 // Test fixture
 class OptionalTest : public testing::Test {
 };
@@ -199,6 +214,10 @@
 };
 unsigned MultiArgConstructor::Destructions = 0;
 
+static_assert(
+  !is_trivially_copyable<Optional<MultiArgConstructor>>::value,
+  "not trivially copyable");
+
 TEST_F(OptionalTest, Emplace) {
   MultiArgConstructor::ResetCounts();
   Optional<MultiArgConstructor> A;
@@ -246,6 +265,9 @@
 unsigned MoveOnly::Destructions = 0;
 unsigned MoveOnly::MoveAssignments = 0;
 
+static_assert(!is_trivially_copyable<Optional<MoveOnly>>::value,
+              "not trivially copyable");
+
 TEST_F(OptionalTest, MoveOnlyNull) {
   MoveOnly::ResetCounts();
   Optional<MoveOnly> O;
@@ -347,6 +369,9 @@
 unsigned Immovable::Constructions = 0;
 unsigned Immovable::Destructions = 0;
 
+static_assert(!is_trivially_copyable<Optional<Immovable>>::value,
+              "not trivially copyable");
+
 TEST_F(OptionalTest, ImmovableEmplace) {
   Optional<Immovable> A;
   Immovable::ResetCounts();
@@ -518,5 +543,52 @@
   CheckRelation<GreaterEqual>(InequalityLhs, InequalityRhs, !IsLess);
 }
 
-} // end anonymous namespace
+struct ComparableAndStreamable {
+  friend bool operator==(ComparableAndStreamable,
+                         ComparableAndStreamable) LLVM_ATTRIBUTE_USED {
+    return true;
+  }
 
+  friend raw_ostream &operator<<(raw_ostream &OS, ComparableAndStreamable) {
+    return OS << "ComparableAndStreamable";
+  }
+
+  static Optional<ComparableAndStreamable> get() {
+    return ComparableAndStreamable();
+  }
+};
+
+TEST_F(OptionalTest, StreamOperator) {
+  auto to_string = [](Optional<ComparableAndStreamable> O) {
+    SmallString<16> S;
+    raw_svector_ostream OS(S);
+    OS << O;
+    return S;
+  };
+  EXPECT_EQ("ComparableAndStreamable",
+            to_string(ComparableAndStreamable::get()));
+  EXPECT_EQ("None", to_string(None));
+}
+
+struct Comparable {
+  friend bool operator==(Comparable, Comparable) LLVM_ATTRIBUTE_USED {
+    return true;
+  }
+  static Optional<Comparable> get() { return Comparable(); }
+};
+
+TEST_F(OptionalTest, UseInUnitTests) {
+  // Test that we invoke the streaming operators when pretty-printing values in
+  // EXPECT macros.
+  EXPECT_NONFATAL_FAILURE(EXPECT_EQ(llvm::None, ComparableAndStreamable::get()),
+                          "Expected: llvm::None\n"
+                          "      Which is: None\n"
+                          "To be equal to: ComparableAndStreamable::get()\n"
+                          "      Which is: ComparableAndStreamable");
+
+  // Test that it is still possible to compare objects which do not have a
+  // custom streaming operator.
+  EXPECT_NONFATAL_FAILURE(EXPECT_EQ(llvm::None, Comparable::get()), "object");
+}
+
+} // end anonymous namespace
diff --git a/src/llvm-project/llvm/unittests/ADT/PackedVectorTest.cpp b/src/llvm-project/llvm/unittests/ADT/PackedVectorTest.cpp
index 199a670..24df398 100644
--- a/src/llvm-project/llvm/unittests/ADT/PackedVectorTest.cpp
+++ b/src/llvm-project/llvm/unittests/ADT/PackedVectorTest.cpp
@@ -1,9 +1,8 @@
 //===- llvm/unittest/ADT/PackedVectorTest.cpp - PackedVector tests --------===//
 //
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 //===----------------------------------------------------------------------===//
 
diff --git a/src/llvm-project/llvm/unittests/ADT/PointerEmbeddedIntTest.cpp b/src/llvm-project/llvm/unittests/ADT/PointerEmbeddedIntTest.cpp
index 695ea12..d24c8b8 100644
--- a/src/llvm-project/llvm/unittests/ADT/PointerEmbeddedIntTest.cpp
+++ b/src/llvm-project/llvm/unittests/ADT/PointerEmbeddedIntTest.cpp
@@ -1,9 +1,8 @@
 //===- llvm/unittest/ADT/PointerEmbeddedIntTest.cpp -----------------------===//
 //
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 //===----------------------------------------------------------------------===//
 
diff --git a/src/llvm-project/llvm/unittests/ADT/PointerIntPairTest.cpp b/src/llvm-project/llvm/unittests/ADT/PointerIntPairTest.cpp
index 985fdba..6b3a4c0 100644
--- a/src/llvm-project/llvm/unittests/ADT/PointerIntPairTest.cpp
+++ b/src/llvm-project/llvm/unittests/ADT/PointerIntPairTest.cpp
@@ -1,9 +1,8 @@
 //===- llvm/unittest/ADT/PointerIntPairTest.cpp - Unit tests --------------===//
 //
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 //===----------------------------------------------------------------------===//
 
@@ -62,6 +61,9 @@
   Pair2.setPointerAndInt(&s, E::Case3);
   EXPECT_EQ(&s, Pair2.getPointer());
   EXPECT_EQ(E::Case3, Pair2.getInt());
+
+  static_assert(is_trivially_copyable<PointerIntPair<S *, 2, E>>::value,
+                "trivially copyable");
 }
 
 TEST(PointerIntPairTest, DefaultInitialize) {
@@ -97,6 +99,11 @@
 
   EXPECT_EQ(FixnumPointerTraits::NumLowBitsAvailable - 1,
             PointerLikeTypeTraits<decltype(pair)>::NumLowBitsAvailable);
+
+  static_assert(
+      is_trivially_copyable<
+          PointerIntPair<Fixnum31, 1, bool, FixnumPointerTraits>>::value,
+      "trivially copyable");
 }
 
 } // end anonymous namespace
diff --git a/src/llvm-project/llvm/unittests/ADT/PointerSumTypeTest.cpp b/src/llvm-project/llvm/unittests/ADT/PointerSumTypeTest.cpp
index a4faea6..fbf59f3 100644
--- a/src/llvm-project/llvm/unittests/ADT/PointerSumTypeTest.cpp
+++ b/src/llvm-project/llvm/unittests/ADT/PointerSumTypeTest.cpp
@@ -1,9 +1,8 @@
 //===- llvm/unittest/ADT/PointerSumTypeTest.cpp ---------------------------===//
 //
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 //===----------------------------------------------------------------------===//
 
diff --git a/src/llvm-project/llvm/unittests/ADT/PointerUnionTest.cpp b/src/llvm-project/llvm/unittests/ADT/PointerUnionTest.cpp
index 360c371..cd6e980 100644
--- a/src/llvm-project/llvm/unittests/ADT/PointerUnionTest.cpp
+++ b/src/llvm-project/llvm/unittests/ADT/PointerUnionTest.cpp
@@ -1,9 +1,8 @@
 //===- llvm/unittest/ADT/PointerUnionTest.cpp - Optional unit tests -------===//
 //
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 //===----------------------------------------------------------------------===//
 
@@ -69,4 +68,41 @@
   EXPECT_EQ(n.get<int *>(), (int *)nullptr);
 }
 
+template<int I> struct alignas(8) Aligned {};
+
+typedef PointerUnion<Aligned<0> *, Aligned<1> *, Aligned<2> *, Aligned<3> *,
+                     Aligned<4> *, Aligned<5> *, Aligned<6> *, Aligned<7> *>
+    PU8;
+
+TEST_F(PointerUnionTest, ManyElements) {
+  Aligned<0> a0;
+  Aligned<7> a7;
+
+  PU8 a = &a0;
+  EXPECT_TRUE(a.is<Aligned<0>*>());
+  EXPECT_FALSE(a.is<Aligned<1>*>());
+  EXPECT_FALSE(a.is<Aligned<2>*>());
+  EXPECT_FALSE(a.is<Aligned<3>*>());
+  EXPECT_FALSE(a.is<Aligned<4>*>());
+  EXPECT_FALSE(a.is<Aligned<5>*>());
+  EXPECT_FALSE(a.is<Aligned<6>*>());
+  EXPECT_FALSE(a.is<Aligned<7>*>());
+  EXPECT_EQ(a.dyn_cast<Aligned<0>*>(), &a0);
+  EXPECT_EQ(*a.getAddrOfPtr1(), &a0);
+
+  a = &a7;
+  EXPECT_FALSE(a.is<Aligned<0>*>());
+  EXPECT_FALSE(a.is<Aligned<1>*>());
+  EXPECT_FALSE(a.is<Aligned<2>*>());
+  EXPECT_FALSE(a.is<Aligned<3>*>());
+  EXPECT_FALSE(a.is<Aligned<4>*>());
+  EXPECT_FALSE(a.is<Aligned<5>*>());
+  EXPECT_FALSE(a.is<Aligned<6>*>());
+  EXPECT_TRUE(a.is<Aligned<7>*>());
+  EXPECT_EQ(a.dyn_cast<Aligned<7>*>(), &a7);
+
+  EXPECT_TRUE(a == PU8(&a7));
+  EXPECT_TRUE(a != PU8(&a0));
+}
+
 } // end anonymous namespace
diff --git a/src/llvm-project/llvm/unittests/ADT/PostOrderIteratorTest.cpp b/src/llvm-project/llvm/unittests/ADT/PostOrderIteratorTest.cpp
index 20c938e..8e53247 100644
--- a/src/llvm-project/llvm/unittests/ADT/PostOrderIteratorTest.cpp
+++ b/src/llvm-project/llvm/unittests/ADT/PostOrderIteratorTest.cpp
@@ -1,9 +1,8 @@
 //===- PostOrderIteratorTest.cpp - PostOrderIterator unit tests -----------===//
 //
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 //===----------------------------------------------------------------------===//
 #include "llvm/ADT/PostOrderIterator.h"
diff --git a/src/llvm-project/llvm/unittests/ADT/PriorityWorklistTest.cpp b/src/llvm-project/llvm/unittests/ADT/PriorityWorklistTest.cpp
index 040a11f..4dfdd5f 100644
--- a/src/llvm-project/llvm/unittests/ADT/PriorityWorklistTest.cpp
+++ b/src/llvm-project/llvm/unittests/ADT/PriorityWorklistTest.cpp
@@ -1,9 +1,8 @@
 //===- llvm/unittest/ADT/PriorityWorklist.cpp -----------------------------===//
 //
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 //===----------------------------------------------------------------------===//
 //
diff --git a/src/llvm-project/llvm/unittests/ADT/RangeAdapterTest.cpp b/src/llvm-project/llvm/unittests/ADT/RangeAdapterTest.cpp
index edc1ced..eb18526 100644
--- a/src/llvm-project/llvm/unittests/ADT/RangeAdapterTest.cpp
+++ b/src/llvm-project/llvm/unittests/ADT/RangeAdapterTest.cpp
@@ -1,9 +1,8 @@
 //===- RangeAdapterTest.cpp - Unit tests for range adapters  --------------===//
 //
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 //===----------------------------------------------------------------------===//
 
diff --git a/src/llvm-project/llvm/unittests/ADT/SCCIteratorTest.cpp b/src/llvm-project/llvm/unittests/ADT/SCCIteratorTest.cpp
index 57a999b..4835095 100644
--- a/src/llvm-project/llvm/unittests/ADT/SCCIteratorTest.cpp
+++ b/src/llvm-project/llvm/unittests/ADT/SCCIteratorTest.cpp
@@ -1,9 +1,8 @@
 //===----- llvm/unittest/ADT/SCCIteratorTest.cpp - SCCIterator tests ------===//
 //
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 //===----------------------------------------------------------------------===//
 
diff --git a/src/llvm-project/llvm/unittests/ADT/STLExtrasTest.cpp b/src/llvm-project/llvm/unittests/ADT/STLExtrasTest.cpp
index e65e71f..8704ddd 100644
--- a/src/llvm-project/llvm/unittests/ADT/STLExtrasTest.cpp
+++ b/src/llvm-project/llvm/unittests/ADT/STLExtrasTest.cpp
@@ -1,9 +1,8 @@
 //===- STLExtrasTest.cpp - Unit tests for STL extras ----------------------===//
 //
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 //===----------------------------------------------------------------------===//
 
@@ -447,4 +446,37 @@
   EXPECT_FALSE(is_splat(V));
 }
 
+TEST(STLExtrasTest, to_address) {
+  int *V1 = new int;
+  EXPECT_EQ(V1, to_address(V1));
+
+  // Check fancy pointer overload for unique_ptr
+  std::unique_ptr<int> V2 = make_unique<int>(0);
+  EXPECT_EQ(V2.get(), to_address(V2));
+
+  V2.reset(V1);
+  EXPECT_EQ(V1, to_address(V2));
+  V2.release();
+
+  // Check fancy pointer overload for shared_ptr
+  std::shared_ptr<int> V3 = std::make_shared<int>(0);
+  std::shared_ptr<int> V4 = V3;
+  EXPECT_EQ(V3.get(), V4.get());
+  EXPECT_EQ(V3.get(), to_address(V3));
+  EXPECT_EQ(V4.get(), to_address(V4));
+
+  V3.reset(V1);
+  EXPECT_EQ(V1, to_address(V3));
+}
+
+TEST(STLExtrasTest, partition_point) {
+  std::vector<int> V = {1, 3, 5, 7, 9};
+
+  // Range version.
+  EXPECT_EQ(V.begin() + 3,
+            partition_point(V, [](unsigned X) { return X < 7; }));
+  EXPECT_EQ(V.begin(), partition_point(V, [](unsigned X) { return X < 1; }));
+  EXPECT_EQ(V.end(), partition_point(V, [](unsigned X) { return X < 50; }));
+}
+
 } // namespace
diff --git a/src/llvm-project/llvm/unittests/ADT/ScopeExitTest.cpp b/src/llvm-project/llvm/unittests/ADT/ScopeExitTest.cpp
index ab11dff..1437652 100644
--- a/src/llvm-project/llvm/unittests/ADT/ScopeExitTest.cpp
+++ b/src/llvm-project/llvm/unittests/ADT/ScopeExitTest.cpp
@@ -1,9 +1,8 @@
 //===- llvm/unittest/ADT/ScopeExit.cpp - Scope exit unit tests --*- C++ -*-===//
 //
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 //===----------------------------------------------------------------------===//
 
diff --git a/src/llvm-project/llvm/unittests/ADT/SequenceTest.cpp b/src/llvm-project/llvm/unittests/ADT/SequenceTest.cpp
index cc82f86..4356bb1 100644
--- a/src/llvm-project/llvm/unittests/ADT/SequenceTest.cpp
+++ b/src/llvm-project/llvm/unittests/ADT/SequenceTest.cpp
@@ -1,9 +1,8 @@
 //===- SequenceTest.cpp - Unit tests for a sequence abstraciton -----------===//
 //
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 //===----------------------------------------------------------------------===//
 
diff --git a/src/llvm-project/llvm/unittests/ADT/SetVectorTest.cpp b/src/llvm-project/llvm/unittests/ADT/SetVectorTest.cpp
index b8cac0d..b9fef78 100644
--- a/src/llvm-project/llvm/unittests/ADT/SetVectorTest.cpp
+++ b/src/llvm-project/llvm/unittests/ADT/SetVectorTest.cpp
@@ -1,9 +1,8 @@
 //===- llvm/unittest/ADT/SetVector.cpp ------------------------------===//
 //
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 //===----------------------------------------------------------------------===//
 //
diff --git a/src/llvm-project/llvm/unittests/ADT/SimpleIListTest.cpp b/src/llvm-project/llvm/unittests/ADT/SimpleIListTest.cpp
index a354f33..9b8ffac 100644
--- a/src/llvm-project/llvm/unittests/ADT/SimpleIListTest.cpp
+++ b/src/llvm-project/llvm/unittests/ADT/SimpleIListTest.cpp
@@ -1,9 +1,8 @@
 //===- unittests/ADT/SimpleIListTest.cpp - simple_ilist unit tests --------===//
 //
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 //===----------------------------------------------------------------------===//
 
diff --git a/src/llvm-project/llvm/unittests/ADT/SmallPtrSetTest.cpp b/src/llvm-project/llvm/unittests/ADT/SmallPtrSetTest.cpp
index 76f9cf7..cff1632 100644
--- a/src/llvm-project/llvm/unittests/ADT/SmallPtrSetTest.cpp
+++ b/src/llvm-project/llvm/unittests/ADT/SmallPtrSetTest.cpp
@@ -1,9 +1,8 @@
 //===- llvm/unittest/ADT/SmallPtrSetTest.cpp ------------------------------===//
 //
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 //===----------------------------------------------------------------------===//
 //
diff --git a/src/llvm-project/llvm/unittests/ADT/SmallSetTest.cpp b/src/llvm-project/llvm/unittests/ADT/SmallSetTest.cpp
index 3391a5c..8fb78b0 100644
--- a/src/llvm-project/llvm/unittests/ADT/SmallSetTest.cpp
+++ b/src/llvm-project/llvm/unittests/ADT/SmallSetTest.cpp
@@ -1,9 +1,8 @@
 //===- llvm/unittest/ADT/SmallSetTest.cpp ------------------------------===//
 //
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 //===----------------------------------------------------------------------===//
 //
diff --git a/src/llvm-project/llvm/unittests/ADT/SmallStringTest.cpp b/src/llvm-project/llvm/unittests/ADT/SmallStringTest.cpp
index 995ef8e..6868381 100644
--- a/src/llvm-project/llvm/unittests/ADT/SmallStringTest.cpp
+++ b/src/llvm-project/llvm/unittests/ADT/SmallStringTest.cpp
@@ -1,9 +1,8 @@
 //===- llvm/unittest/ADT/SmallStringTest.cpp ------------------------------===//
 //
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 //===----------------------------------------------------------------------===//
 //
diff --git a/src/llvm-project/llvm/unittests/ADT/SmallVectorTest.cpp b/src/llvm-project/llvm/unittests/ADT/SmallVectorTest.cpp
index 9c501bb..dbe4048 100644
--- a/src/llvm-project/llvm/unittests/ADT/SmallVectorTest.cpp
+++ b/src/llvm-project/llvm/unittests/ADT/SmallVectorTest.cpp
@@ -1,9 +1,8 @@
 //===- llvm/unittest/ADT/SmallVectorTest.cpp ------------------------------===//
 //
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 //===----------------------------------------------------------------------===//
 //
@@ -909,63 +908,69 @@
   EmplaceableArg<3> A3(true);
   {
     SmallVector<Emplaceable, 3> V;
-    V.emplace_back();
+    Emplaceable &back = V.emplace_back();
+    EXPECT_TRUE(&back == &V.back());
     EXPECT_TRUE(V.size() == 1);
-    EXPECT_TRUE(V.back().State == ES_Emplaced);
-    EXPECT_TRUE(V.back().A0.State == EAS_Defaulted);
-    EXPECT_TRUE(V.back().A1.State == EAS_Defaulted);
-    EXPECT_TRUE(V.back().A2.State == EAS_Defaulted);
-    EXPECT_TRUE(V.back().A3.State == EAS_Defaulted);
+    EXPECT_TRUE(back.State == ES_Emplaced);
+    EXPECT_TRUE(back.A0.State == EAS_Defaulted);
+    EXPECT_TRUE(back.A1.State == EAS_Defaulted);
+    EXPECT_TRUE(back.A2.State == EAS_Defaulted);
+    EXPECT_TRUE(back.A3.State == EAS_Defaulted);
   }
   {
     SmallVector<Emplaceable, 3> V;
-    V.emplace_back(std::move(A0));
+    Emplaceable &back = V.emplace_back(std::move(A0));
+    EXPECT_TRUE(&back == &V.back());
     EXPECT_TRUE(V.size() == 1);
-    EXPECT_TRUE(V.back().State == ES_Emplaced);
-    EXPECT_TRUE(V.back().A0.State == EAS_RValue);
-    EXPECT_TRUE(V.back().A1.State == EAS_Defaulted);
-    EXPECT_TRUE(V.back().A2.State == EAS_Defaulted);
-    EXPECT_TRUE(V.back().A3.State == EAS_Defaulted);
+    EXPECT_TRUE(back.State == ES_Emplaced);
+    EXPECT_TRUE(back.A0.State == EAS_RValue);
+    EXPECT_TRUE(back.A1.State == EAS_Defaulted);
+    EXPECT_TRUE(back.A2.State == EAS_Defaulted);
+    EXPECT_TRUE(back.A3.State == EAS_Defaulted);
   }
   {
     SmallVector<Emplaceable, 3> V;
-    V.emplace_back(A0);
+    Emplaceable &back = V.emplace_back(A0);
+    EXPECT_TRUE(&back == &V.back());
     EXPECT_TRUE(V.size() == 1);
-    EXPECT_TRUE(V.back().State == ES_Emplaced);
-    EXPECT_TRUE(V.back().A0.State == EAS_LValue);
-    EXPECT_TRUE(V.back().A1.State == EAS_Defaulted);
-    EXPECT_TRUE(V.back().A2.State == EAS_Defaulted);
-    EXPECT_TRUE(V.back().A3.State == EAS_Defaulted);
+    EXPECT_TRUE(back.State == ES_Emplaced);
+    EXPECT_TRUE(back.A0.State == EAS_LValue);
+    EXPECT_TRUE(back.A1.State == EAS_Defaulted);
+    EXPECT_TRUE(back.A2.State == EAS_Defaulted);
+    EXPECT_TRUE(back.A3.State == EAS_Defaulted);
   }
   {
     SmallVector<Emplaceable, 3> V;
-    V.emplace_back(A0, A1);
+    Emplaceable &back = V.emplace_back(A0, A1);
+    EXPECT_TRUE(&back == &V.back());
     EXPECT_TRUE(V.size() == 1);
-    EXPECT_TRUE(V.back().State == ES_Emplaced);
-    EXPECT_TRUE(V.back().A0.State == EAS_LValue);
-    EXPECT_TRUE(V.back().A1.State == EAS_LValue);
-    EXPECT_TRUE(V.back().A2.State == EAS_Defaulted);
-    EXPECT_TRUE(V.back().A3.State == EAS_Defaulted);
+    EXPECT_TRUE(back.State == ES_Emplaced);
+    EXPECT_TRUE(back.A0.State == EAS_LValue);
+    EXPECT_TRUE(back.A1.State == EAS_LValue);
+    EXPECT_TRUE(back.A2.State == EAS_Defaulted);
+    EXPECT_TRUE(back.A3.State == EAS_Defaulted);
   }
   {
     SmallVector<Emplaceable, 3> V;
-    V.emplace_back(std::move(A0), std::move(A1));
+    Emplaceable &back = V.emplace_back(std::move(A0), std::move(A1));
+    EXPECT_TRUE(&back == &V.back());
     EXPECT_TRUE(V.size() == 1);
-    EXPECT_TRUE(V.back().State == ES_Emplaced);
-    EXPECT_TRUE(V.back().A0.State == EAS_RValue);
-    EXPECT_TRUE(V.back().A1.State == EAS_RValue);
-    EXPECT_TRUE(V.back().A2.State == EAS_Defaulted);
-    EXPECT_TRUE(V.back().A3.State == EAS_Defaulted);
+    EXPECT_TRUE(back.State == ES_Emplaced);
+    EXPECT_TRUE(back.A0.State == EAS_RValue);
+    EXPECT_TRUE(back.A1.State == EAS_RValue);
+    EXPECT_TRUE(back.A2.State == EAS_Defaulted);
+    EXPECT_TRUE(back.A3.State == EAS_Defaulted);
   }
   {
     SmallVector<Emplaceable, 3> V;
-    V.emplace_back(std::move(A0), A1, std::move(A2), A3);
+    Emplaceable &back = V.emplace_back(std::move(A0), A1, std::move(A2), A3);
+    EXPECT_TRUE(&back == &V.back());
     EXPECT_TRUE(V.size() == 1);
-    EXPECT_TRUE(V.back().State == ES_Emplaced);
-    EXPECT_TRUE(V.back().A0.State == EAS_RValue);
-    EXPECT_TRUE(V.back().A1.State == EAS_LValue);
-    EXPECT_TRUE(V.back().A2.State == EAS_RValue);
-    EXPECT_TRUE(V.back().A3.State == EAS_LValue);
+    EXPECT_TRUE(back.State == ES_Emplaced);
+    EXPECT_TRUE(back.A0.State == EAS_RValue);
+    EXPECT_TRUE(back.A1.State == EAS_LValue);
+    EXPECT_TRUE(back.A2.State == EAS_RValue);
+    EXPECT_TRUE(back.A3.State == EAS_LValue);
   }
   {
     SmallVector<int, 1> V;
diff --git a/src/llvm-project/llvm/unittests/ADT/SparseBitVectorTest.cpp b/src/llvm-project/llvm/unittests/ADT/SparseBitVectorTest.cpp
index 7675dda..db8d58a 100644
--- a/src/llvm-project/llvm/unittests/ADT/SparseBitVectorTest.cpp
+++ b/src/llvm-project/llvm/unittests/ADT/SparseBitVectorTest.cpp
@@ -1,9 +1,8 @@
 //===- llvm/unittest/ADT/SparseBitVectorTest.cpp - SparseBitVector tests --===//
 //
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 //===----------------------------------------------------------------------===//
 
diff --git a/src/llvm-project/llvm/unittests/ADT/SparseMultiSetTest.cpp b/src/llvm-project/llvm/unittests/ADT/SparseMultiSetTest.cpp
index 032990e..54f7bc9 100644
--- a/src/llvm-project/llvm/unittests/ADT/SparseMultiSetTest.cpp
+++ b/src/llvm-project/llvm/unittests/ADT/SparseMultiSetTest.cpp
@@ -1,9 +1,8 @@
 //===------ ADT/SparseSetTest.cpp - SparseSet unit tests -  -----*- C++ -*-===//
 //
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 //===----------------------------------------------------------------------===//
 
diff --git a/src/llvm-project/llvm/unittests/ADT/SparseSetTest.cpp b/src/llvm-project/llvm/unittests/ADT/SparseSetTest.cpp
index 4db7a7d..2b065ea 100644
--- a/src/llvm-project/llvm/unittests/ADT/SparseSetTest.cpp
+++ b/src/llvm-project/llvm/unittests/ADT/SparseSetTest.cpp
@@ -1,9 +1,8 @@
 //===------ ADT/SparseSetTest.cpp - SparseSet unit tests -  -----*- C++ -*-===//
 //
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 //===----------------------------------------------------------------------===//
 
diff --git a/src/llvm-project/llvm/unittests/ADT/StatisticTest.cpp b/src/llvm-project/llvm/unittests/ADT/StatisticTest.cpp
index 17a5c7f..1b5530f 100644
--- a/src/llvm-project/llvm/unittests/ADT/StatisticTest.cpp
+++ b/src/llvm-project/llvm/unittests/ADT/StatisticTest.cpp
@@ -1,9 +1,8 @@
 //===- llvm/unittest/ADT/StatisticTest.cpp - Statistic unit tests ---------===//
 //
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 //===----------------------------------------------------------------------===//
 
diff --git a/src/llvm-project/llvm/unittests/ADT/StringExtrasTest.cpp b/src/llvm-project/llvm/unittests/ADT/StringExtrasTest.cpp
index 02a45c3..97c91de 100644
--- a/src/llvm-project/llvm/unittests/ADT/StringExtrasTest.cpp
+++ b/src/llvm-project/llvm/unittests/ADT/StringExtrasTest.cpp
@@ -1,9 +1,8 @@
 //===- StringExtrasTest.cpp - Unit tests for String extras ----------------===//
 //
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 //===----------------------------------------------------------------------===//
 
diff --git a/src/llvm-project/llvm/unittests/ADT/StringMapTest.cpp b/src/llvm-project/llvm/unittests/ADT/StringMapTest.cpp
index a44bbbf..4038d4d 100644
--- a/src/llvm-project/llvm/unittests/ADT/StringMapTest.cpp
+++ b/src/llvm-project/llvm/unittests/ADT/StringMapTest.cpp
@@ -1,14 +1,12 @@
 //===- llvm/unittest/ADT/StringMapMap.cpp - StringMap unit tests ----------===//
 //
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 //===----------------------------------------------------------------------===//
 
 #include "llvm/ADT/StringMap.h"
-#include "llvm/ADT/StringSet.h"
 #include "llvm/ADT/Twine.h"
 #include "llvm/Support/DataTypes.h"
 #include "gtest/gtest.h"
@@ -285,20 +283,6 @@
   EXPECT_EQ(Expected, Keys);
 }
 
-TEST_F(StringMapTest, IterSetKeys) {
-  StringSet<> Set;
-  Set.insert("A");
-  Set.insert("B");
-  Set.insert("C");
-  Set.insert("D");
-
-  auto Keys = to_vector<4>(Set.keys());
-  llvm::sort(Keys);
-
-  SmallVector<StringRef, 4> Expected = {"A", "B", "C", "D"};
-  EXPECT_EQ(Expected, Keys);
-}
-
 // Create a non-default constructable value
 struct StringMapTestStruct {
   StringMapTestStruct(int i) : i(i) {}
diff --git a/src/llvm-project/llvm/unittests/ADT/StringRefTest.cpp b/src/llvm-project/llvm/unittests/ADT/StringRefTest.cpp
index 4087d6c..a45e83c 100644
--- a/src/llvm-project/llvm/unittests/ADT/StringRefTest.cpp
+++ b/src/llvm-project/llvm/unittests/ADT/StringRefTest.cpp
@@ -1,9 +1,8 @@
 //===- llvm/unittest/ADT/StringRefTest.cpp - StringRef unit tests ---------===//
 //
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 //===----------------------------------------------------------------------===//
 
@@ -35,10 +34,6 @@
 // Check that we can't accidentally assign a temporary std::string to a
 // StringRef. (Unfortunately we can't make use of the same thing with
 // constructors.)
-//
-// Disable this check under MSVC; even MSVC 2015 isn't consistent between
-// std::is_assignable and actually writing such an assignment.
-#if !defined(_MSC_VER)
 static_assert(
     !std::is_assignable<StringRef&, std::string>::value,
     "Assigning from prvalue std::string");
@@ -57,8 +52,6 @@
 static_assert(
     std::is_assignable<StringRef&, const char * &>::value,
     "Assigning from lvalue C string");
-#endif
-
 
 namespace {
 TEST(StringRefTest, Construction) {
@@ -1062,4 +1055,6 @@
   EXPECT_EQ(StringRef("Bar"), Strings[1]);
 }
 
+static_assert(is_trivially_copyable<StringRef>::value, "trivially copyable");
+
 } // end anonymous namespace
diff --git a/src/llvm-project/llvm/unittests/ADT/StringSetTest.cpp b/src/llvm-project/llvm/unittests/ADT/StringSetTest.cpp
new file mode 100644
index 0000000..17bfa1d
--- /dev/null
+++ b/src/llvm-project/llvm/unittests/ADT/StringSetTest.cpp
@@ -0,0 +1,44 @@
+//===- llvm/unittest/ADT/StringSetTest.cpp - StringSet unit tests ----------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/ADT/StringSet.h"
+#include "gtest/gtest.h"
+using namespace llvm;
+
+namespace {
+
+// Test fixture
+class StringSetTest : public testing::Test {};
+
+TEST_F(StringSetTest, IterSetKeys) {
+  StringSet<> Set;
+  Set.insert("A");
+  Set.insert("B");
+  Set.insert("C");
+  Set.insert("D");
+
+  auto Keys = to_vector<4>(Set.keys());
+  llvm::sort(Keys);
+
+  SmallVector<StringRef, 4> Expected = {"A", "B", "C", "D"};
+  EXPECT_EQ(Expected, Keys);
+}
+
+TEST_F(StringSetTest, InsertAndCountStringMapEntry) {
+  // Test insert(StringMapEntry) and count(StringMapEntry)
+  // which are required for set_difference(StringSet, StringSet).
+  StringSet<> Set;
+  StringMapEntry<StringRef> *Element = StringMapEntry<StringRef>::Create("A");
+  Set.insert(*Element);
+  size_t Count = Set.count(*Element);
+  size_t Expected = 1;
+  EXPECT_EQ(Expected, Count);
+  Element->Destroy();
+}
+
+} // end anonymous namespace
diff --git a/src/llvm-project/llvm/unittests/ADT/StringSwitchTest.cpp b/src/llvm-project/llvm/unittests/ADT/StringSwitchTest.cpp
index 62d3a31..2ce6cdc 100644
--- a/src/llvm-project/llvm/unittests/ADT/StringSwitchTest.cpp
+++ b/src/llvm-project/llvm/unittests/ADT/StringSwitchTest.cpp
@@ -1,9 +1,8 @@
 //===- llvm/unittest/ADT/StringSwitchTest.cpp - StringSwitch unit tests ---===//
 //
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 //===----------------------------------------------------------------------===//
 
diff --git a/src/llvm-project/llvm/unittests/ADT/TestGraph.h b/src/llvm-project/llvm/unittests/ADT/TestGraph.h
index 4ddd14c..36d2982 100644
--- a/src/llvm-project/llvm/unittests/ADT/TestGraph.h
+++ b/src/llvm-project/llvm/unittests/ADT/TestGraph.h
@@ -1,9 +1,8 @@
 //===- llvm/unittest/ADT/TestGraph.h - Graph for testing ------------------===//
 //
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 //===----------------------------------------------------------------------===//
 //
diff --git a/src/llvm-project/llvm/unittests/ADT/TinyPtrVectorTest.cpp b/src/llvm-project/llvm/unittests/ADT/TinyPtrVectorTest.cpp
index cc14ccc..c8c00d9 100644
--- a/src/llvm-project/llvm/unittests/ADT/TinyPtrVectorTest.cpp
+++ b/src/llvm-project/llvm/unittests/ADT/TinyPtrVectorTest.cpp
@@ -1,9 +1,8 @@
 //===- llvm/unittest/ADT/TinyPtrVectorTest.cpp ----------------------------===//
 //
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 //===----------------------------------------------------------------------===//
 //
diff --git a/src/llvm-project/llvm/unittests/ADT/TripleTest.cpp b/src/llvm-project/llvm/unittests/ADT/TripleTest.cpp
index bc7f932..37ebe5d 100644
--- a/src/llvm-project/llvm/unittests/ADT/TripleTest.cpp
+++ b/src/llvm-project/llvm/unittests/ADT/TripleTest.cpp
@@ -1,9 +1,8 @@
 //===----------- Triple.cpp - Triple unit tests ---------------------------===//
 //
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 //===----------------------------------------------------------------------===//
 
@@ -253,11 +252,11 @@
   EXPECT_EQ(Triple::UnknownOS, T.getOS());
   EXPECT_EQ(Triple::UnknownEnvironment, T.getEnvironment());
 
-  T = Triple("wasm32-unknown-wasi-musl");
+  T = Triple("wasm32-unknown-wasi");
   EXPECT_EQ(Triple::wasm32, T.getArch());
   EXPECT_EQ(Triple::UnknownVendor, T.getVendor());
   EXPECT_EQ(Triple::WASI, T.getOS());
-  EXPECT_EQ(Triple::Musl, T.getEnvironment());
+  EXPECT_EQ(Triple::UnknownEnvironment, T.getEnvironment());
 
   T = Triple("wasm64-unknown-unknown");
   EXPECT_EQ(Triple::wasm64, T.getArch());
@@ -265,11 +264,11 @@
   EXPECT_EQ(Triple::UnknownOS, T.getOS());
   EXPECT_EQ(Triple::UnknownEnvironment, T.getEnvironment());
 
-  T = Triple("wasm64-unknown-wasi-musl");
+  T = Triple("wasm64-unknown-wasi");
   EXPECT_EQ(Triple::wasm64, T.getArch());
   EXPECT_EQ(Triple::UnknownVendor, T.getVendor());
   EXPECT_EQ(Triple::WASI, T.getOS());
-  EXPECT_EQ(Triple::Musl, T.getEnvironment());
+  EXPECT_EQ(Triple::UnknownEnvironment, T.getEnvironment());
 
   T = Triple("avr-unknown-unknown");
   EXPECT_EQ(Triple::avr, T.getArch());
@@ -553,6 +552,13 @@
   EXPECT_EQ(Triple::OpenEmbedded, T.getVendor());
   EXPECT_EQ(Triple::Linux, T.getOS());
   EXPECT_EQ(Triple::UnknownEnvironment, T.getEnvironment());
+  EXPECT_TRUE(T.isArch64Bit());
+
+  T = Triple("arm64_32-apple-ios");
+  EXPECT_EQ(Triple::aarch64_32, T.getArch());
+  EXPECT_EQ(Triple::IOS, T.getOS());
+  EXPECT_EQ(Triple::UnknownEnvironment, T.getEnvironment());
+  EXPECT_TRUE(T.isArch32Bit());
 
   T = Triple("huh");
   EXPECT_EQ(Triple::UnknownArch, T.getArch());
@@ -703,6 +709,10 @@
             Triple::normalize("i686-linux")); // i686-pc-linux-gnu
   EXPECT_EQ("arm-none-unknown-eabi",
             Triple::normalize("arm-none-eabi")); // arm-none-eabi
+  EXPECT_EQ("wasm32-unknown-wasi",
+            Triple::normalize("wasm32-wasi")); // wasm32-unknown-wasi
+  EXPECT_EQ("wasm64-unknown-wasi",
+            Triple::normalize("wasm64-wasi")); // wasm64-unknown-wasi
 }
 
 TEST(TripleTest, MutateName) {
@@ -866,11 +876,13 @@
   EXPECT_FALSE(T.isArch16Bit());
   EXPECT_TRUE(T.isArch32Bit());
   EXPECT_FALSE(T.isArch64Bit());
+  EXPECT_TRUE(T.isRISCV());
 
   T.setArch(Triple::riscv64);
   EXPECT_FALSE(T.isArch16Bit());
   EXPECT_FALSE(T.isArch32Bit());
   EXPECT_TRUE(T.isArch64Bit());
+  EXPECT_TRUE(T.isRISCV());
 }
 
 TEST(TripleTest, BitWidthArchVariants) {
@@ -1227,6 +1239,17 @@
   EXPECT_EQ((unsigned)3, Minor);
   EXPECT_EQ((unsigned)0, Micro);
   EXPECT_TRUE(T.isSimulatorEnvironment());
+  EXPECT_FALSE(T.isMacCatalystEnvironment());
+
+  T = Triple("x86_64-apple-ios13.0-macabi");
+  EXPECT_TRUE(T.isiOS());
+  T.getiOSVersion(Major, Minor, Micro);
+  EXPECT_EQ((unsigned)13, Major);
+  EXPECT_EQ((unsigned)0, Minor);
+  EXPECT_EQ((unsigned)0, Micro);
+  EXPECT_TRUE(T.getEnvironment() == Triple::MacABI);
+  EXPECT_TRUE(T.isMacCatalystEnvironment());
+  EXPECT_FALSE(T.isSimulatorEnvironment());
 }
 
 TEST(TripleTest, FileFormat) {
@@ -1247,17 +1270,28 @@
 
   EXPECT_EQ(Triple::Wasm, Triple("wasm32-unknown-unknown").getObjectFormat());
   EXPECT_EQ(Triple::Wasm, Triple("wasm64-unknown-unknown").getObjectFormat());
-  EXPECT_EQ(Triple::Wasm, Triple("wasm32-unknown-wasi-musl").getObjectFormat());
-  EXPECT_EQ(Triple::Wasm, Triple("wasm64-unknown-wasi-musl").getObjectFormat());
+  EXPECT_EQ(Triple::Wasm, Triple("wasm32-wasi").getObjectFormat());
+  EXPECT_EQ(Triple::Wasm, Triple("wasm64-wasi").getObjectFormat());
+  EXPECT_EQ(Triple::Wasm, Triple("wasm32-unknown-wasi").getObjectFormat());
+  EXPECT_EQ(Triple::Wasm, Triple("wasm64-unknown-wasi").getObjectFormat());
 
   EXPECT_EQ(Triple::Wasm,
             Triple("wasm32-unknown-unknown-wasm").getObjectFormat());
   EXPECT_EQ(Triple::Wasm,
             Triple("wasm64-unknown-unknown-wasm").getObjectFormat());
   EXPECT_EQ(Triple::Wasm,
-            Triple("wasm32-unknown-wasi-musl-wasm").getObjectFormat());
+            Triple("wasm32-wasi-wasm").getObjectFormat());
   EXPECT_EQ(Triple::Wasm,
-            Triple("wasm64-unknown-wasi-musl-wasm").getObjectFormat());
+            Triple("wasm64-wasi-wasm").getObjectFormat());
+  EXPECT_EQ(Triple::Wasm,
+            Triple("wasm32-unknown-wasi-wasm").getObjectFormat());
+  EXPECT_EQ(Triple::Wasm,
+            Triple("wasm64-unknown-wasi-wasm").getObjectFormat());
+
+  EXPECT_EQ(Triple::XCOFF, Triple("powerpc-ibm-aix").getObjectFormat());
+  EXPECT_EQ(Triple::XCOFF, Triple("powerpc64-ibm-aix").getObjectFormat());
+  EXPECT_EQ(Triple::XCOFF, Triple("powerpc---xcoff").getObjectFormat());
+  EXPECT_EQ(Triple::XCOFF, Triple("powerpc64---xcoff").getObjectFormat());
 
   Triple MSVCNormalized(Triple::normalize("i686-pc-windows-msvc-elf"));
   EXPECT_EQ(Triple::ELF, MSVCNormalized.getObjectFormat());
@@ -1277,6 +1311,9 @@
 
   T.setObjectFormat(Triple::MachO);
   EXPECT_EQ(Triple::MachO, T.getObjectFormat());
+
+  T.setObjectFormat(Triple::XCOFF);
+  EXPECT_EQ(Triple::XCOFF, T.getObjectFormat());
 }
 
 TEST(TripleTest, NormalizeWindows) {
@@ -1321,6 +1358,8 @@
 
   EXPECT_EQ("i686-pc-windows-elf",
             Triple::normalize("i686-pc-windows-elf-elf"));
+
+  EXPECT_TRUE(Triple("x86_64-pc-win32").isWindowsMSVCEnvironment());
 }
 
 TEST(TripleTest, getARMCPUForArch) {
@@ -1441,6 +1480,10 @@
     EXPECT_EQ(Triple::aarch64, T.getArch());
   }
   {
+    Triple T = Triple("arm64_32");
+    EXPECT_EQ(Triple::aarch64_32, T.getArch());
+  }
+  {
     Triple T = Triple("aarch64");
     EXPECT_EQ(Triple::aarch64, T.getArch());
   }
diff --git a/src/llvm-project/llvm/unittests/ADT/TwineTest.cpp b/src/llvm-project/llvm/unittests/ADT/TwineTest.cpp
index 950eda2..a717036 100644
--- a/src/llvm-project/llvm/unittests/ADT/TwineTest.cpp
+++ b/src/llvm-project/llvm/unittests/ADT/TwineTest.cpp
@@ -1,9 +1,8 @@
 //===- TwineTest.cpp - Twine unit tests -----------------------------------===//
 //
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 //===----------------------------------------------------------------------===//
 
diff --git a/src/llvm-project/llvm/unittests/ADT/VariadicFunctionTest.cpp b/src/llvm-project/llvm/unittests/ADT/VariadicFunctionTest.cpp
index 43db648..56cf85a 100644
--- a/src/llvm-project/llvm/unittests/ADT/VariadicFunctionTest.cpp
+++ b/src/llvm-project/llvm/unittests/ADT/VariadicFunctionTest.cpp
@@ -1,9 +1,8 @@
 //===----------- VariadicFunctionTest.cpp - VariadicFunction unit tests ---===//
 //
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 //===----------------------------------------------------------------------===//