Index: llvm/lib/Target/ARM/ARMFrameLowering.cpp =================================================================== --- llvm/lib/Target/ARM/ARMFrameLowering.cpp +++ llvm/lib/Target/ARM/ARMFrameLowering.cpp @@ -2570,6 +2570,9 @@ for (MachineBasicBlock *MBB : BeforePrologueRegion) { // Make sure the LiveIns are still sorted and unique. MBB->sortUniqueLiveIns(); + // Only update for immediate predecessors. + if (!PrologueMBB.isPredecessor(MBB)) + continue; // Replace the edges to PrologueMBB by edges to the sequences // we are about to add. MBB->ReplaceUsesOfBlockWith(&PrologueMBB, AddedBlocks[0]);