Index: llvm/lib/CodeGen/TargetPassConfig.cpp
--- llvm/lib/CodeGen/TargetPassConfig.cpp.orig
+++ llvm/lib/CodeGen/TargetPassConfig.cpp
@@ -977,6 +977,8 @@ void TargetPassConfig::addISelPrepare() {
   if (requiresCodeGenSCCOrder())
     addPass(new DummyCGSCCPass);
 
+  addPass(createReturnProtectorPass());
+
   // Add both the safe stack and the stack protection passes: each of them will
   // only protect functions that have corresponding attributes.
   addPass(createSafeStackPass());
