1; RUN: llc -mtriple x86_64-- -stop-before peephole-opt -o %t.mir %s
2; RUN: llc -mtriple x86_64-- -run-pass none %t.mir -verify-machineinstrs -o - | FileCheck %s
3
4; Unreachable blocks in the machine instr representation are these
5; weird empty blocks with no successors.
6; The MIR printer used to not print empty lists of successors. However,
7; the MIR parser now treats non-printed list of successors as "please
8; guess it for me". As a result, the parser tries to guess the list of
9; successors and given the block is empty, just assumes it falls through
10; the next block.
11;
12; The following test case used to fail the verifier because the false
13; path ended up falling through split.true and now, the definition of
14; %v does not dominate all its uses.
15; Indeed, we go from the following CFG:
16;          entry
17;         /      \
18;    true (def)   false
19;        |
20;  split.true (use)
21;
22; To this one:
23;          entry
24;         /      \
25;    true (def)   false
26;        |        /  <-- invalid edge
27;  split.true (use)
28;
29; Because of the invalid edge, we get the "def does not
30; dominate all uses" error.
31;
32; CHECK-LABEL: name: foo
33; CHECK-LABEL: bb.{{[0-9]+}}.false:
34; CHECK-NEXT: successors:
35; CHECK-NOT: %bb.{{[0-9]+}}.split.true
36; CHECK-LABEL: bb.{{[0-9]+}}.split.true:
37define void @foo(i32* %bar) {
38  br i1 undef, label %true, label %false
39true:
40  %v = load i32, i32* %bar
41  br label %split.true
42false:
43  unreachable
44split.true:
45  %vInc = add i32 %v, 1
46  store i32 %vInc, i32* %bar
47  ret void
48}
49