[LLVMdev] Question about MachineBlockPlacement Pass in LLVM

Haishan hndxvon at 163.com
Mon Aug 18 07:21:00 PDT 2014


Hi,
    Now, MachineBlockPlacement Pass is inserted after Control Flow Optimizer(CFO).
    As I known, CFO will eliminates a lot of unconditional branch instructions. So, in the MachineBlockPlacement pass, 
AnalyzeBranch which is target-dependence is used to analyse FBB and TBB of a conditional branch instruction.
For example, a machine block written as:
BB#0:
            ......
            brcond  <BB#2>
           Successors according to CFG: BB#2(12)  BB#1 (20)
BB#1:
            ......
            Successors according to CFG: BB#2
BB#2:
            ret
    In this case, FBB would be set NULL, and TBB is BB#2. Then, MachineBlockPlacement cannot handle this case.
If MachineBlockPlacement is inserted before Control Flow Optimizer, it can handle more cases. But I'm not sure about this is the best way.
    Any suggestion will be appreciate.
    Thank you in advance.
-Haishan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140818/e887e6a2/attachment.html>


More information about the llvm-dev mailing list