1 # RUN: not llc -run-pass=machineverifier %s -o - 2>&1 | FileCheck %s
2 # REQUIRES: aarch64-registered-target
5 target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"
6 target triple = "aarch64--"
7 define void @valid(i8* %addr) {
9 br i1 0, label %if, label %else
18 define void @broken(i8* %addr) {
20 br i1 0, label %if, label %exit
30 tracksRegLiveness: true
34 successors: %bb.1(0x40000000), %bb.2(0x40000000); %bb.1(50.00%), %bb.2(50.00%)
36 %2:_(s32) = G_CONSTANT i32 1
37 %3:_(s1) = G_ICMP intpred(ne), %1:_(s32), %2:_
38 G_BRCOND %3:_(s1), %bb.1
41 successors: %bb.3(0x80000000)
42 %4:_(s32) = G_CONSTANT i32 1
46 successors: %bb.3(0x80000000)
47 %6:_(s32) = G_CONSTANT i32 1
51 %8:_(s8) = G_PHI %5:_(s8), %bb.1, %7:_(s8), %bb.2
58 tracksRegLiveness: true
62 successors: %bb.1(0x40000000), %bb.2(0x40000000); %bb.1(50.00%), %bb.2(50.00%)
64 %2:_(s32) = G_CONSTANT i32 1
65 %3:_(s1) = G_ICMP intpred(ne), %1:_(s32), %2:_
66 %4:_(s32) = G_CONSTANT i32 1
67 %6:_(s8) = G_CONSTANT i8 2
68 G_BRCOND %3:_(s1), %bb.1
71 successors: %bb.2(0x80000000)
75 %8:_(s8) = G_PHI %5:_(s8), %bb.0, %6:_(s8), %bb.1
79 # CHECK-NOT: Bad machine code
80 # CHECK-LABEL: Bad machine code: Found PHI instruction after non-PHI
81 # CHECK-NEXT: - function: broken
82 # CHECK-NEXT: - basic block: %bb.2 exit
83 # CHECK-NEXT: - instruction: %6:_(s8) = G_PHI %5:_(s8), %bb.0, %4:_(s8), %bb.1
84 # CHECK-NOT: Bad machine code