[PATCH] D21811: [MBB] add a missing corner case in UpdateTerminator()

Haicheng Wu via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 28 12:14:10 PDT 2016


haicheng created this revision.
haicheng added reviewers: majnemer, mcrosier, mssimpso, uabelho.
haicheng added a subscriber: llvm-commits.
haicheng set the repository for this revision to rL LLVM.
Herald added a subscriber: mcrosier.

If the layout after the block placement is like this 

```
BB#8: 
        ......
        JGE_1 <BB#9>, %EFLAGS<imp-use>
    Successors according to CFG: BB#9(0x80000000 / 0x80000000 = 100.00%)

BB#10:
        ......
```

where BB#8 ends with a conditional branch, but the next block is not its successor.  The conditional branch should be changed to unconditional branch in MachineBasicBlock::UpdateTerminator(), but this case is missing.  

In cases like above example, the results returned by AnalyzeBranch() are: TBB = branch target; FBB = nullptr; Cond = branch condition (not empty)

This corner cases happens if a block (e.g. BB#8) branches and fallthourghs into the same block (e.g. BB#9) before the block placement, and the block placement moves this successor (e.g. BB#9) somewhere else.  

Repository:
  rL LLVM

http://reviews.llvm.org/D21811

Files:
  lib/CodeGen/MachineBasicBlock.cpp
  test/CodeGen/X86/update-terminator.mir

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D21811.62121.patch
Type: text/x-patch
Size: 3038 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160628/bf1f34c1/attachment.bin>


More information about the llvm-commits mailing list