 diff -r c06933b0e3e6 llvm-trunk/lib/Target/ARM/CMakeLists.txt
 --- a/llvm-trunk/lib/Target/ARM/CMakeLists.txt
 +++ b/llvm-trunk/lib/Target/ARM/CMakeLists.txt
-@@ -25,6 +25,7 @@
+@@ -25,6 +25,8 @@
    ARMLoadStoreOptimizer.cpp
    ARMMCAsmInfo.cpp
    ARMRegisterInfo.cpp
 +  ARMSFIPlacement.cpp
++  ARMSFIBranch.cpp
    ARMSubtarget.cpp
    ARMTargetMachine.cpp
    NEONMoveFix.cpp

 
 static const MCAsmInfo *createMCAsmInfo(const Target &T, StringRef TT) {
   Triple TheTriple(TT);
@@ -128,6 +134,13 @@
   }
 
   PM.add(createARMConstantIslandPass());
+
+  // @LOCALMOD-START
+  if (FlagSfiStore || FlagSfiBranch) {
+    PM.add(createARMSFIPlacementPass());
+  }
+  // @LOCALMOD-END
+
   return true;
 }
 
@@ -190,4 +203,3 @@
   PM.add(createARMObjectCodeEmitterPass(*this, OCE));
   return false;
 }

+  }
+}
+
+static bool IsDangerousStore(const MachineInstr &MI, int *AddrIdx) {
+  unsigned Opcode = MI.getOpcode();
+  switch (Opcode) {
