1# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2# RUN: llc -debugify-and-strip-all-safe -O0 -mtriple=aarch64-unknown-unknown -verify-machineinstrs -run-pass=legalizer %s -o - | FileCheck %s
3--- |
4  target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
5
6  define void @snork() {
7  bb:
8    br label %bb1
9
10  bb1:                                              ; preds = %bb3, %bb
11    %lsr.iv = phi i16* [ %scevgep, %bb3 ], [ undef, %bb ]
12    %tmp = phi i1 [ %tmp9, %bb3 ], [ undef, %bb ]
13    br i1 %tmp, label %bb10, label %bb3
14
15  bb3:                                              ; preds = %bb1
16    %tmp5 = getelementptr i16, i16* null, i64 2
17    %tmp6 = load i16, i16* %lsr.iv, align 2, !tbaa !0
18    %tmp7 = icmp eq i16 %tmp6, -1
19    %tmp8 = load i16, i16* %tmp5, align 2, !tbaa !0
20    %tmp9 = icmp eq i16 %tmp8, -1
21    %scevgep = getelementptr i16, i16* %lsr.iv, i64 2
22    br i1 %tmp7, label %bb10, label %bb1
23
24  bb10:                                             ; preds = %bb3, %bb1
25    ret void
26  }
27
28  !0 = !{!1, !1, i64 0}
29  !1 = !{!"short", !2, i64 0}
30  !2 = !{!"omnipotent char", !3, i64 0}
31  !3 = !{!"Simple C/C++ TBAA"}
32
33...
34---
35name:            snork
36alignment:       16
37tracksRegLiveness: true
38frameInfo:
39  maxAlignment:    1
40body:             |
41  ; CHECK-LABEL: name: snork
42  ; CHECK: bb.0.bb:
43  ; CHECK:   successors: %bb.1(0x80000000)
44  ; CHECK:   [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 0
45  ; CHECK:   [[INTTOPTR:%[0-9]+]]:_(p0) = G_INTTOPTR [[C]](s64)
46  ; CHECK:   [[DEF:%[0-9]+]]:_(p0) = G_IMPLICIT_DEF
47  ; CHECK:   [[DEF1:%[0-9]+]]:_(s16) = G_IMPLICIT_DEF
48  ; CHECK: bb.1.bb1:
49  ; CHECK:   successors: %bb.3(0x40000000), %bb.2(0x40000000)
50  ; CHECK:   [[PHI:%[0-9]+]]:_(p0) = G_PHI %6(p0), %bb.2, [[DEF]](p0), %bb.0
51  ; CHECK:   [[PHI1:%[0-9]+]]:_(s16) = G_PHI %20(s16), %bb.2, [[DEF1]](s16), %bb.0
52  ; CHECK:   [[TRUNC:%[0-9]+]]:_(s1) = G_TRUNC [[PHI1]](s16)
53  ; CHECK:   G_BRCOND [[TRUNC]](s1), %bb.3
54  ; CHECK: bb.2.bb3:
55  ; CHECK:   successors: %bb.3(0x40000000), %bb.1(0x40000000)
56  ; CHECK:   [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 4
57  ; CHECK:   [[GEP:%[0-9]+]]:_(p0) = G_PTR_ADD [[INTTOPTR]], [[C1]](s64)
58  ; CHECK:   [[LOAD:%[0-9]+]]:_(s16) = G_LOAD [[PHI]](p0) :: (load 2 from %ir.lsr.iv)
59  ; CHECK:   [[ZEXT:%[0-9]+]]:_(s32) = G_ZEXT [[LOAD]](s16)
60  ; CHECK:   [[C2:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535
61  ; CHECK:   [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(eq), [[ZEXT]](s32), [[C2]]
62  ; CHECK:   [[TRUNC1:%[0-9]+]]:_(s1) = G_TRUNC [[ICMP]](s32)
63  ; CHECK:   [[LOAD1:%[0-9]+]]:_(s16) = G_LOAD [[GEP]](p0) :: (load 2 from %ir.tmp5)
64  ; CHECK:   [[ZEXT1:%[0-9]+]]:_(s32) = G_ZEXT [[LOAD1]](s16)
65  ; CHECK:   [[COPY:%[0-9]+]]:_(s32) = COPY [[C2]](s32)
66  ; CHECK:   [[ICMP1:%[0-9]+]]:_(s32) = G_ICMP intpred(eq), [[ZEXT1]](s32), [[COPY]]
67  ; CHECK:   [[GEP1:%[0-9]+]]:_(p0) = G_PTR_ADD [[PHI]], [[C1]](s64)
68  ; CHECK:   [[TRUNC2:%[0-9]+]]:_(s16) = G_TRUNC [[ICMP1]](s32)
69  ; CHECK:   G_BRCOND [[TRUNC1]](s1), %bb.3
70  ; CHECK:   G_BR %bb.1
71  ; CHECK: bb.3.bb10:
72  ; CHECK:   RET_ReallyLR
73  bb.1.bb:
74    %3:_(s64) = G_CONSTANT i64 0
75    %2:_(p0) = G_INTTOPTR %3(s64)
76    %7:_(s16) = G_CONSTANT i16 -1
77    %12:_(p0) = G_IMPLICIT_DEF
78    %13:_(s1) = G_IMPLICIT_DEF
79
80  bb.2.bb1:
81    %0:_(p0) = G_PHI %11(p0), %bb.3, %12(p0), %bb.1
82    %1:_(s1) = G_PHI %10(s1), %bb.3, %13(s1), %bb.1
83    G_BRCOND %1(s1), %bb.4
84
85  bb.3.bb3:
86    %4:_(s64) = G_CONSTANT i64 4
87    %5:_(p0) = G_PTR_ADD %2, %4(s64)
88    %6:_(s16) = G_LOAD %0(p0) :: (load 2 from %ir.lsr.iv)
89    %8:_(s1) = G_ICMP intpred(eq), %6(s16), %7
90    %9:_(s16) = G_LOAD %5(p0) :: (load 2 from %ir.tmp5)
91    %10:_(s1) = G_ICMP intpred(eq), %9(s16), %7
92    %11:_(p0) = G_PTR_ADD %0, %4(s64)
93    G_BRCOND %8(s1), %bb.4
94    G_BR %bb.2
95
96  bb.4.bb10:
97    RET_ReallyLR
98
99...
100