    for (unsigned i = 0, e = JTBBs.size(); i != e; ++i) {
      MachineBasicBlock *MBB = JTBBs[i];
      bool isNew = JTSets.insert(MBB);
-@@ -1158,6 +1318,252 @@
+@@ -1158,6 +1318,253 @@
  
      // FIXME: Should we signal R9 usage?
    }

-                IIC_Br, "blx\t$func",
+// @LOCALMOD-START
+//                IIC_Br, "blx\t$func",
+                IIC_Br, "sfi_call_preamble\n\tblx\t$func",
+// @LOCALMOD-END
                 [(ARMcall GPR:$func)]>,
             Requires<[IsARM, HasV5T, IsNotDarwin]> {
     let Inst{7-4}   = 0b0011;
@@ -701,7 +719,10 @@
 
   // ARMv4T
   def BX : ABXIx2<(outs), (ins GPR:$func, variable_ops),
-                  IIC_Br, "mov\tlr, pc\n\tbx\t$func",
+// @LOCALMOD-START
+//                  IIC_Br, "mov\tlr, pc\n\tbx\t$func",
+                  IIC_Br, "sfi_call_preamble\n\tmov\tlr, pc\n\tbx\t$func",
+// @LOCALMOD-END
                   [(ARMcall_nolink GPR:$func)]>,
            Requires<[IsARM, IsNotDarwin]> {
     let Inst{7-4}   = 0b0001;
@@ -717,19 +738,28 @@
           D16, D17, D18, D19, D20, D21, D22, D23,
           D24, D25, D26, D27, D28, D29, D30, D31, CPSR, FPSCR] in {
   def BLr9  : ABXI<0b1011, (outs), (ins i32imm:$func, variable_ops),

 // ADD and SUB with 's' bit set.
 defm ADDS : AI1_bin_s_irs<0b0100, "adds",
                           BinOpFrag<(addc node:$LHS, node:$RHS)>, 1>;
@@ -1551,7 +1618,10 @@
 let isCall = 1,
   Defs = [R0, R12, LR, CPSR] in {
   def TPsoft : ABXI<0b1011, (outs), (ins), IIC_Br,
