1 # RUN: llc -mtriple powerpc64le-unknown-linux-gnu %s -o - 2>&1 \
2 # RUN: -run-pass=livevars,phi-node-elimination -verify-machineinstrs | \
4 # RUN: llc -mtriple powerpc64le-unknown-linux-gnu %s -o - 2>&1 \
5 # RUN: --passes='require<live-vars>,phi-node-elimination' -verify-each | \
9 ; Function Attrs: noreturn nounwind
10 define signext i32 @zext_free(ptr nocapture dereferenceable(8) %p) {
12 %.pre = load ptr, ptr %p, align 8
15 loop: ; preds = %loop, %if.then3, %entry
16 %0 = phi ptr [ %.pre, %entry ], [ %incdec.ptr4, %if.then3 ], [ %incdec.ptr, %loop ]
17 %1 = load i8, ptr %0, align 1
18 %tobool = icmp eq i8 %1, 0
19 %incdec.ptr = getelementptr inbounds i8, ptr %0, i64 1
20 store ptr %incdec.ptr, ptr %p, align 8
21 %2 = load i8, ptr %incdec.ptr, align 1
22 %tobool2 = icmp ne i8 %2, 0
23 %or.cond = and i1 %tobool, %tobool2
24 br i1 %or.cond, label %if.then3, label %loop
26 if.then3: ; preds = %loop
27 %incdec.ptr4 = getelementptr inbounds i8, ptr %0, i64 2
28 store ptr %incdec.ptr4, ptr %p, align 8
36 tracksRegLiveness: true
38 - { id: 0, class: g8rc, preferred-register: '' }
39 - { id: 1, class: g8rc_and_g8rc_nox0, preferred-register: '' }
40 - { id: 2, class: g8rc, preferred-register: '' }
41 - { id: 3, class: g8rc, preferred-register: '' }
42 - { id: 4, class: g8rc_and_g8rc_nox0, preferred-register: '' }
43 - { id: 5, class: gprc, preferred-register: '' }
44 - { id: 6, class: crrc, preferred-register: '' }
45 - { id: 7, class: crbitrc, preferred-register: '' }
46 - { id: 8, class: gprc, preferred-register: '' }
47 - { id: 9, class: crrc, preferred-register: '' }
48 - { id: 10, class: crbitrc, preferred-register: '' }
49 - { id: 11, class: crbitrc, preferred-register: '' }
51 - { reg: '$x3', virtual-reg: '%4' }
54 successors: %bb.1(0x80000000)
57 %4:g8rc_and_g8rc_nox0 = COPY killed $x3
58 %0:g8rc = LD 0, %4 :: (dereferenceable load (s64) from %ir.p)
61 successors: %bb.1(0x20000000), %bb.2(0x60000000)
63 %1:g8rc_and_g8rc_nox0 = PHI %0, %bb.0, %2, %bb.1, %3, %bb.3, %2, %bb.2
64 %5:gprc = LBZ 0, %1 :: (load (s8) from %ir.0)
65 %6:crrc = CMPWI killed %5, 0
66 %7:crbitrc = COPY killed %6.sub_eq
67 %2:g8rc = nuw ADDI8 %1, 1
68 STD %2, 0, %4 :: (store (s64) into %ir.p)
69 %8:gprc = LBZ 1, %1 :: (load (s8) from %ir.incdec.ptr)
74 successors: %bb.3(0x55555555), %bb.1(0x2aaaaaab)
76 %9:crrc = CMPWI killed %8, 0
77 %10:crbitrc = COPY killed %9.sub_eq
82 successors: %bb.1(0x80000000)
84 %3:g8rc = nuw ADDI8 killed %1, 2
85 STD %3, 0, %4 :: (store (s64) into %ir.p)
88 ; CHECK-LABEL: name: zext_free
90 ; CHECK: successors: %bb.1(0x80000000)
93 ; CHECK: %4:g8rc_and_g8rc_nox0 = COPY killed $x3
94 ; CHECK: %0:g8rc = LD 0, %4 :: (dereferenceable load (s64) from %ir.p)
95 ; CHECK: %12:g8rc_and_g8rc_nox0 = COPY killed %0
98 ; CHECK: successors: %bb.1(0x20000000), %bb.2(0x60000000)
100 ; CHECK: %1:g8rc_and_g8rc_nox0 = COPY killed %12
101 ; CHECK: %5:gprc = LBZ 0, %1 :: (load (s8) from %ir.0)
102 ; CHECK: %6:crrc = CMPWI killed %5, 0
103 ; CHEXK: %7:crbitrc = COPY killed %6.sub_eq
104 ; CHECK: %2:g8rc = nuw ADDI8 %1, 1
105 ; CHECK: STD %2, 0, %4 :: (store (s64) into %ir.p)
106 ; CHECK: %8:gprc = LBZ 1, %1 :: (load (s8) from %ir.incdec.ptr)
107 ; CHECK: %12:g8rc_and_g8rc_nox0 = COPY %2
108 ; CHECK: BCn killed %7, %bb.1
112 ; CHECK: successors: %bb.3(0x55555555), %bb.1(0x2aaaaaab)
114 ; CHECK: %9:crrc = CMPWI killed %8, 0
115 ; CHECK: %10:crbitrc = COPY killed %9.sub_eq
116 ; CHECK: %12:g8rc_and_g8rc_nox0 = COPY killed %2
117 ; CHECK: BC killed %10, %bb.1
120 ; CHECK: bb.3.if.then3:
121 ; CHECK: successors: %bb.1(0x80000000)
123 ; CHECK: %3:g8rc = nuw ADDI8 killed %1, 2
124 ; CHECK: STD %3, 0, %4 :: (store (s64) into %ir.p)
125 ; CHECK: %12:g8rc_and_g8rc_nox0 = COPY killed %3