[llvm-dev] Update control flow graph when splitting a machine basic block? (original) (raw)
Friedman, Eli via llvm-dev llvm-dev at lists.llvm.org
Tue Nov 14 11:56:18 PST 2017
- Previous message: [llvm-dev] Update control flow graph when splitting a machine basic block?
- Next message: [llvm-dev] Less aggressive on the first allocation of CSR if detecting an early exit
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 11/13/2017 6:58 PM, 章明 wrote:
It looks like what's happening is that IfConversion makes the return conditional, then that gets merged with the following block. I mean, I would say it's a bug in that there's a "terminator" in a position not at the end of the block, but a return doesn't have any CFG successors, so I'm not sure it has any practical effect.
I think we won't merge with the following block for an indirect branch which is not a return. I believe MachineBasicBlock::getFirstTerminator, MachineBasicBlock::getFirstInstrTerminator, and Methods/functions that use these methods will break on a machine basic block like this, although I have not tested these with such a machine basic block. I don't know whether MachineBasicBlock::getFirstTerminator and MachineBasicBlock::getFirstInstrTerminator are intended to be used in a late stage like just before code emission or not.
If you really want to prevent the merge, it's probably not hard. See the handling for isReturn() in ARMBaseInstrInfo::analyzeBranch, which intentionally ignores predicated return instructions. But it's probably simpler from your perspective to do the same thing that analyzeBranch does, and ignore predicated return instructions.
-Eli
-- Employee of Qualcomm Innovation Center, Inc. Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project
- Previous message: [llvm-dev] Update control flow graph when splitting a machine basic block?
- Next message: [llvm-dev] Less aggressive on the first allocation of CSR if detecting an early exit
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]