1# RUN: not --crash llc -run-pass=machineverifier %s -o - 2>&1 | FileCheck %s 2# REQUIRES: aarch64-registered-target 3 4--- | 5 target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128" 6 target triple = "aarch64--" 7 define void @valid(i8* %addr) { 8 entry: 9 br i1 0, label %if, label %else 10 if: 11 br label %exit 12 else: 13 br label %exit 14 exit: 15 ret void 16 } 17 18 define void @broken(i8* %addr) { 19 entry: 20 br i1 0, label %if, label %exit 21 if: 22 br label %exit 23 exit: 24 ret void 25 } 26... 27 28--- 29name: valid 30tracksRegLiveness: true 31body: | 32 bb.0.entry: 33 liveins: $w1 34 successors: %bb.1(0x40000000), %bb.2(0x40000000); %bb.1(50.00%), %bb.2(50.00%) 35 %1:_(s32) = COPY $w1 36 %2:_(s32) = G_CONSTANT i32 1 37 %3:_(s1) = G_ICMP intpred(ne), %1:_(s32), %2:_ 38 G_BRCOND %3:_(s1), %bb.1 39 G_BR %bb.2.else 40 bb.1.if: 41 successors: %bb.3(0x80000000) 42 %4:_(s32) = G_CONSTANT i32 1 43 %5:_(s8) = G_TRUNC %4 44 G_BR %bb.3.exit 45 bb.2.else: 46 successors: %bb.3(0x80000000) 47 %6:_(s32) = G_CONSTANT i32 1 48 %7:_(s8) = G_TRUNC %6 49 G_BR %bb.3.exit 50 bb.3.exit: 51 %8:_(s8) = G_PHI %5:_(s8), %bb.1, %7:_(s8), %bb.2 52 %9:_(s32) = G_ZEXT %8 53 $w1 = COPY %9 54... 55 56--- 57name: broken 58tracksRegLiveness: true 59body: | 60 bb.0.entry: 61 liveins: $w1 62 successors: %bb.1(0x40000000), %bb.2(0x40000000); %bb.1(50.00%), %bb.2(50.00%) 63 %1:_(s32) = COPY $w1 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 69 G_BR %bb.2.exit 70 bb.1.if: 71 successors: %bb.2(0x80000000) 72 G_BR %bb.2.exit 73 bb.2.exit: 74 %5:_(s8) = G_TRUNC %4 75 %8:_(s8) = G_PHI %5:_(s8), %bb.0, %6:_(s8), %bb.1 76 %9:_(s32) = G_ZEXT %8 77 $w1 = COPY %9 78... 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 85