1 # RUN: llc -mtriple powerpc64le-unknown-linux-gnu %s -o - 2>&1 \
2 # RUN: -run-pass=livevars,phi-node-elimination -verify-machineinstrs | \
6 ; Function Attrs: noreturn nounwind
7 define signext i32 @zext_free(ptr nocapture dereferenceable(8) %p) {
9 %.pre = load ptr, ptr %p, align 8
12 loop: ; preds = %loop, %if.then3, %entry
13 %0 = phi ptr [ %.pre, %entry ], [ %incdec.ptr4, %if.then3 ], [ %incdec.ptr, %loop ]
14 %1 = load i8, ptr %0, align 1
15 %tobool = icmp eq i8 %1, 0
16 %incdec.ptr = getelementptr inbounds i8, ptr %0, i64 1
17 store ptr %incdec.ptr, ptr %p, align 8
18 %2 = load i8, ptr %incdec.ptr, align 1
19 %tobool2 = icmp ne i8 %2, 0
20 %or.cond = and i1 %tobool, %tobool2
21 br i1 %or.cond, label %if.then3, label %loop
23 if.then3: ; preds = %loop
24 %incdec.ptr4 = getelementptr inbounds i8, ptr %0, i64 2
25 store ptr %incdec.ptr4, ptr %p, align 8
33 tracksRegLiveness: true
35 - { id: 0, class: g8rc, preferred-register: '' }
36 - { id: 1, class: g8rc_and_g8rc_nox0, preferred-register: '' }
37 - { id: 2, class: g8rc, preferred-register: '' }
38 - { id: 3, class: g8rc, preferred-register: '' }
39 - { id: 4, class: g8rc_and_g8rc_nox0, preferred-register: '' }
40 - { id: 5, class: gprc, preferred-register: '' }
41 - { id: 6, class: crrc, preferred-register: '' }
42 - { id: 7, class: crbitrc, preferred-register: '' }
43 - { id: 8, class: gprc, preferred-register: '' }
44 - { id: 9, class: crrc, preferred-register: '' }
45 - { id: 10, class: crbitrc, preferred-register: '' }
46 - { id: 11, class: crbitrc, preferred-register: '' }
48 - { reg: '$x3', virtual-reg: '%4' }
51 successors: %bb.1(0x80000000)
54 %4:g8rc_and_g8rc_nox0 = COPY killed $x3
55 %0:g8rc = LD 0, %4 :: (dereferenceable load (s64) from %ir.p)
58 successors: %bb.1(0x20000000), %bb.2(0x60000000)
60 %1:g8rc_and_g8rc_nox0 = PHI %0, %bb.0, %2, %bb.1, %3, %bb.3, %2, %bb.2
61 %5:gprc = LBZ 0, %1 :: (load (s8) from %ir.0)
62 %6:crrc = CMPWI killed %5, 0
63 %7:crbitrc = COPY killed %6.sub_eq
64 %2:g8rc = nuw ADDI8 %1, 1
65 STD %2, 0, %4 :: (store (s64) into %ir.p)
66 %8:gprc = LBZ 1, %1 :: (load (s8) from %ir.incdec.ptr)
71 successors: %bb.3(0x55555555), %bb.1(0x2aaaaaab)
73 %9:crrc = CMPWI killed %8, 0
74 %10:crbitrc = COPY killed %9.sub_eq
79 successors: %bb.1(0x80000000)
81 %3:g8rc = nuw ADDI8 killed %1, 2
82 STD %3, 0, %4 :: (store (s64) into %ir.p)
85 ; CHECK-LABEL: name: zext_free
87 ; CHECK: successors: %bb.1(0x80000000)
90 ; CHECK: %4:g8rc_and_g8rc_nox0 = COPY killed $x3
91 ; CHECK: %0:g8rc = LD 0, %4 :: (dereferenceable load (s64) from %ir.p)
92 ; CHECK: %12:g8rc_and_g8rc_nox0 = COPY killed %0
95 ; CHECK: successors: %bb.1(0x20000000), %bb.2(0x60000000)
97 ; CHECK: %1:g8rc_and_g8rc_nox0 = COPY killed %12
98 ; CHECK: %5:gprc = LBZ 0, %1 :: (load (s8) from %ir.0)
99 ; CHECK: %6:crrc = CMPWI killed %5, 0
100 ; CHEXK: %7:crbitrc = COPY killed %6.sub_eq
101 ; CHECK: %2:g8rc = nuw ADDI8 %1, 1
102 ; CHECK: STD %2, 0, %4 :: (store (s64) into %ir.p)
103 ; CHECK: %8:gprc = LBZ 1, %1 :: (load (s8) from %ir.incdec.ptr)
104 ; CHECK: %12:g8rc_and_g8rc_nox0 = COPY %2
105 ; CHECK: BCn killed %7, %bb.1
109 ; CHECK: successors: %bb.3(0x55555555), %bb.1(0x2aaaaaab)
111 ; CHECK: %9:crrc = CMPWI killed %8, 0
112 ; CHECK: %10:crbitrc = COPY killed %9.sub_eq
113 ; CHECK: %12:g8rc_and_g8rc_nox0 = COPY killed %2
114 ; CHECK: BC killed %10, %bb.1
117 ; CHECK: bb.3.if.then3:
118 ; CHECK: successors: %bb.1(0x80000000)
120 ; CHECK: %3:g8rc = nuw ADDI8 killed %1, 2
121 ; CHECK: STD %3, 0, %4 :: (store (s64) into %ir.p)
122 ; CHECK: %12:g8rc_and_g8rc_nox0 = COPY killed %3