This allows a number of optimisation passes to work.
E.g. BranchFolding and MachineBlockPlacement.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Just passed by, you can ignore my comments.
llvm/lib/Target/LoongArch/LoongArchInstrInfo.cpp | ||
---|---|---|
168 | How is this possible to have instructions after an unconditional terminator? I think it should be asserted that there are none. | |
179 | This check seems superfluous, the code below will filter out this case. | |
216 | This is impossible condition, because this function is only called if analyzeBranch returned success, and that returns success only if the last instruction was an (un-)conditional branch. |
Thanks for your comments.
llvm/lib/Target/LoongArch/LoongArchInstrInfo.cpp | ||
---|---|---|
168 | Agree with you, but this situation really needs to be handled here. Because`insertBranch` will add an unconditional branch with BranchFolder pass. | |
179 | Yes, I will remove it. | |
216 | analyzeBranch will return success when the block has no branches (nothing to be removed). isBranch() condition maybe ok? if (!I->getDesc().isBranch()) return 0; |
How is this possible to have instructions after an unconditional terminator? I think it should be asserted that there are none.