[CodeGen] Fix restore blocks' BasicBlock information in branch relaxation
authorZHU Zijia <piggynl@outlook.com>
Thu, 1 Dec 2022 18:41:04 +0000 (02:41 +0800)
committerZHU Zijia <piggynl@outlook.com>
Thu, 1 Dec 2022 18:42:22 +0000 (02:42 +0800)
commit010a8f7a90bf6e6d77f07f0a02dd8a63dfeb32da
treeb9928f66c74bb8ff9fc9a18a8fd9fa1f53f41b68
parent3adf828a0e96ea18531fe74fa151fa8c087e5a21
[CodeGen] Fix restore blocks' BasicBlock information in branch relaxation

In branch relaxation pass, restore blocks are created and placed before
the jump destination if indirect branches are required. For example:

        foo
        sd      s11, 0(sp)
        jump    .restore, s11
        bar
        bar
        bar
        j       .dest
.restore:
        ld      s11, 0(sp)
.dest:
        baz

The BasicBlock information of the restore MachineBasicBlock should be
identical to the dest MachineBasicBlock.

Reviewed By: arsenm

Differential Revision: https://reviews.llvm.org/D131863
llvm/lib/CodeGen/BranchRelaxation.cpp
llvm/test/CodeGen/RISCV/branch-relaxation.ll