OSDN Git Service

[MIRPrinter] Print empty successor lists when they cannot be guessed
authorQuentin Colombet <qcolombet@apple.com>
Tue, 19 Sep 2017 23:34:12 +0000 (23:34 +0000)
committerQuentin Colombet <qcolombet@apple.com>
Tue, 19 Sep 2017 23:34:12 +0000 (23:34 +0000)
commit8726dc54e63349735411226b622d8b2eafea3f84
tree8f6d37169ca77e2e7fb7d77178598039c2541665
parent6199cad8679718337bc60eb62ec85bcacfa7237d
[MIRPrinter] Print empty successor lists when they cannot be guessed

This re-applies commit r313685, this time with the proper updates to
the test cases.

Original commit message:
Unreachable blocks in the machine instr representation are these
weird empty blocks with no successors.
The MIR printer used to not print empty lists of successors. However,
the MIR parser now treats non-printed list of successors as "please
guess it for me". As a result, the parser tries to guess the list of
successors and given the block is empty, just assumes it falls through
the next block (if any).

For instance, the following test case used to fail the verifier.
The MIR printer would print

         entry
        /      \
   true (def)   false (no list of successors)
       |
 split.true (use)

The MIR parser would understand this:

         entry
        /      \
   true (def)   false
       |        /  <-- invalid edge
 split.true (use)

Because of the invalid edge, we get the "def does not
dominate all uses" error.

The fix consists in printing empty successor lists, so that the parser
knows what to do for unreachable blocks.

rdar://problem/34022159

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313696 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/MIRPrinter.cpp
test/CodeGen/MIR/ARM/ifcvt_canFallThroughTo.mir
test/CodeGen/MIR/X86/unreachable_block.ll [new file with mode: 0644]