llvm-project
84 строки · 2.0 Кб
1# RUN: not --crash llc -run-pass=machineverifier %s -o - 2>&1 | FileCheck %s
2# REQUIRES: aarch64-registered-target
3
4--- |5target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"
6target triple = "aarch64--"
7define void @valid(i8* %addr) {
8entry:
9br i1 0, label %if, label %else
10if:
11br label %exit
12else:
13br label %exit
14exit:
15ret void
16}
17
18define void @broken(i8* %addr) {19entry:20br i1 0, label %if, label %exit21if:22br label %exit
23exit:24ret void
25}26...
27
28---
29name: valid30tracksRegLiveness: true31body: |32bb.0.entry:
33liveins: $w1
34successors: %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:_
38G_BRCOND %3:_(s1), %bb.1
39G_BR %bb.2.else
40bb.1.if:
41successors: %bb.3(0x80000000)
42%4:_(s32) = G_CONSTANT i32 1
43%5:_(s8) = G_TRUNC %4
44G_BR %bb.3.exit
45bb.2.else:
46successors: %bb.3(0x80000000)
47%6:_(s32) = G_CONSTANT i32 1
48%7:_(s8) = G_TRUNC %6
49G_BR %bb.3.exit
50bb.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: broken58tracksRegLiveness: true59body: |60bb.0.entry:
61liveins: $w1
62successors: %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
68G_BRCOND %3:_(s1), %bb.1
69G_BR %bb.2.exit
70bb.1.if:
71successors: %bb.2(0x80000000)
72G_BR %bb.2.exit
73bb.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