https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93996
--- Comment #10 from Jeffrey A. Law <law at redhat dot com> --- So what seems to be happening here for the original test is we have something like this just before split3: (insn 14 13 28 2 (parallel [ (set (mem/v:SI (reg/f:DI 0 x0 [97]) [-1 S4 A32]) (unspec_volatile:SI [ (plus:SI (mem/v:SI (reg/f:DI 0 x0 [97]) [-1 S4 A32]) (const_int 1 [0x1])) (const_int 5 [0x5]) ] UNSPECV_ATOMIC_OP)) (clobber (reg:CC 66 cc)) (clobber (reg:SI 1 x1 [98])) (clobber (reg:SI 2 x2 [99])) ]) "k.c":2:17 3913 {aarch64_atomic_addsi} (expr_list:REG_DEAD (reg/f:DI 0 x0 [97]) (expr_list:REG_UNUSED (reg:CC 66 cc) (expr_list:REG_UNUSED (reg:SI 2 x2 [99]) (expr_list:REG_UNUSED (reg:SI 1 x1 [98]) (nil)))))) (note 28 14 23 2 NOTE_INSN_EPILOGUE_BEG) (insn 23 28 24 2 (use (reg:DI 30 x30)) "k.c":2:1 -1 (nil)) That would work fine in terms of what's after the NOTE_INSN_EPILOGUE_BEG. insn 14 gets split into a loop and we end up with a block note after the epilogue begin note: ;; basic block 3, loop depth 0, count 3221225464 (estimated locally), maybe hot ;; Invalid sum of incoming counts 1075352416 (estimated locally), should be 3221225464 (estimated locally) ;; prev block 2, next block 4, flags: (NEW, RTL, MODIFIED) ;; pred: 2 [always] count:1073741824 (estimated locally) (FALLTHRU) ;; 3 [0.0% (guessed)] count:1610592 (estimated locally) ;; bb 3 artificial_defs: { } ;; bb 3 artificial_uses: { u-1(31){ }} ;; lr in ;; lr use ;; lr def ;; live in ;; live gen ;; live kill (code_label 29 13 34 3 3 (nil) [1 uses]) (note 34 29 30 3 [bb 3] NOTE_INSN_BASIC_BLOCK) (insn 30 34 31 3 (set (reg:SI 1 x1 [98]) (unspec_volatile:SI [ (mem/v:SI (reg/f:DI 0 x0 [97]) [-1 S4 A32]) (const_int 5 [0x5]) ] UNSPECV_LX)) "k.c":2:17 4017 {aarch64_load_exclusivesi} (nil)) (insn 31 30 32 3 (set (reg:SI 1 x1 [98]) (plus:SI (reg:SI 1 x1 [98]) (const_int 1 [0x1]))) "k.c":2:17 120 {*addsi3_aarch64} (nil)) (insn 32 31 33 3 (parallel [ (set (reg:SI 2 x2 [99]) (unspec_volatile:SI [ (const_int 0 [0]) ] UNSPECV_SX)) (set (mem/v:SI (reg/f:DI 0 x0 [97]) [-1 S4 A32]) (unspec_volatile:SI [ (reg:SI 1 x1 [98]) (const_int 5 [0x5]) ] UNSPECV_SX)) ]) "k.c":2:17 4022 {aarch64_store_exclusivesi} (nil)) (jump_insn 33 32 28 3 (set (pc) (if_then_else (ne (reg:SI 2 x2 [99]) (const_int 0 [0])) (label_ref:DI 29) (pc))) "k.c":2:17 31 {*cbnesi1} (int_list:REG_BR_PROB 536868 (nil)) -> 29) ;; succ: 3 [0.0% (guessed)] count:1610592 (estimated locally) ;; 4 [100.0% (guessed)] count:3219614872 (estimated locally) (FALLTHRU) ;; lr out ;; live out (note 28 33 35 NOTE_INSN_EPILOGUE_BEG) ;; basic block 4, loop depth 0, count 3219614872 (estimated locally), maybe hot ;; prev block 3, next block 1, flags: (NEW, RTL, MODIFIED) ;; pred: 3 [100.0% (guessed)] count:3219614872 (estimated locally) (FALLTHRU) ;; bb 4 artificial_defs: { } ;; bb 4 artificial_uses: { u-1(31){ }} ;; lr in ;; lr use ;; lr def ;; live in ;; live gen ;; live kill (note 35 28 23 4 [bb 4] NOTE_INSN_BASIC_BLOCK) (insn 23 35 24 4 (use (reg:DI 30 x30)) "k.c":2:1 -1 (nil)) The second testcase is essentially the same. We're splitting at atomic_add that appears immediately before the EPILOGUE_BEG note.