Merge pull request #12662 from eeckstein/globalopt-assert

diff --git a/lib/SILOptimizer/IPO/GlobalOpt.cpp b/lib/SILOptimizer/IPO/GlobalOpt.cpp
index 2af564f..6f39a33 100644
--- a/lib/SILOptimizer/IPO/GlobalOpt.cpp
+++ b/lib/SILOptimizer/IPO/GlobalOpt.cpp
@@ -1273,6 +1273,10 @@
   DEBUG(llvm::dbgs() << "Outline global variable in " <<
         ARI->getFunction()->getName() << '\n');
 
+  assert(Cl->hasFixedLayout(Module->getSwiftModule(),
+                            ResilienceExpansion::Minimal) &&
+    "constructor call of resilient class should prevent static allocation");
+
   // Create a name for the outlined global variable.
   GlobalVariableMangler Mangler;
   std::string GlobName =