1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140
|
; RUN: llc < %s -frame-pointer=all -verify-coalescing
; PR13414
;
; During coalescing, remat triggers DCE which deletes the penultimate use of a
; load. This load should not be folded into the remaining use because it is not
; safe to move, and it would extend the live range of the address.
;
; LiveRangeEdit::foldAsLoad() doesn't extend live ranges, so -verify-coalescing
; catches the problem.
target triple = "i386-unknown-linux-gnu"
%type_a = type { ptr, %type_b }
%type_b = type { %type_c, i32 }
%type_c = type { i32, %type_d }
%type_d = type { i64 }
%type_e = type { %type_c, i64 }
declare void @llvm.memcpy.p0.p0.i32(ptr nocapture, ptr nocapture, i32, i1) nounwind
define linkonce_odr void @test() nounwind {
entry:
br i1 undef, label %while.end.while.end26_crit_edge, label %while.body12.lr.ph
while.end.while.end26_crit_edge: ; preds = %entry
br label %while.end26
while.body12.lr.ph: ; preds = %entry
br label %while.body12
while.body12: ; preds = %if.end24, %while.body12.lr.ph
%tmp = phi ptr [ undef, %while.body12.lr.ph ], [ %tmp18, %if.end24 ]
%ins151154161 = phi i128 [ 0, %while.body12.lr.ph ], [ %phitmp, %if.end24 ]
%ins135156160 = phi i128 [ 0, %while.body12.lr.ph ], [ %phitmp158, %if.end24 ]
%ins151 = or i128 0, %ins151154161
%cmp.i.i.i.i.i67 = icmp sgt i32 undef, 8
br i1 %cmp.i.i.i.i.i67, label %if.then.i.i.i.i71, label %if.else.i.i.i.i74
if.then.i.i.i.i71: ; preds = %while.body12
%call4.i.i.i.i68 = call noalias ptr @malloc(i32 undef) nounwind
%tmp1 = getelementptr inbounds %type_a, ptr %tmp, i32 0, i32 1, i32 0, i32 1
%tmp2 = load ptr, ptr %tmp1, align 4
call void @llvm.memcpy.p0.p0.i32(ptr undef, ptr %tmp2, i32 undef, i1 false) nounwind
unreachable
if.else.i.i.i.i74: ; preds = %while.body12
%i_.i.i.i.i72 = getelementptr inbounds %type_a, ptr %tmp, i32 0, i32 1, i32 0, i32 1, i32 0
%tmp3 = load i64, ptr %i_.i.i.i.i72, align 4
%tmp4 = zext i64 %tmp3 to i128
%tmp5 = shl nuw nsw i128 %tmp4, 32
%ins148 = or i128 %tmp5, %ins151
%second3.i.i76 = getelementptr inbounds %type_a, ptr %tmp, i32 0, i32 1, i32 1
%tmp6 = load i32, ptr %second3.i.i76, align 4
%tmp7 = zext i32 %tmp6 to i128
%tmp8 = shl nuw i128 %tmp7, 96
%mask144 = and i128 %ins148, 79228162495817593519834398720
%tmp9 = load ptr, ptr undef, align 4
%tmp10 = load i32, ptr %tmp9, align 4
%tmp11 = zext i32 %tmp10 to i128
%ins135 = or i128 %tmp11, %ins135156160
%cmp.i.i.i.i.i88 = icmp sgt i32 %tmp10, 8
br i1 %cmp.i.i.i.i.i88, label %if.then.i.i.i.i92, label %if.else.i.i.i.i95
if.then.i.i.i.i92: ; preds = %if.else.i.i.i.i74
%call4.i.i.i.i89 = call noalias ptr @malloc(i32 %tmp10) nounwind
%ins126 = or i128 0, %ins135
%tmp12 = getelementptr inbounds %type_e, ptr %tmp9, i32 0, i32 0, i32 1
%tmp13 = load ptr, ptr %tmp12, align 4
call void @llvm.memcpy.p0.p0.i32(ptr %call4.i.i.i.i89, ptr %tmp13, i32 %tmp10, i1 false) nounwind
br label %A
if.else.i.i.i.i95: ; preds = %if.else.i.i.i.i74
%i_.i.i.i.i93 = getelementptr inbounds %type_e, ptr %tmp9, i32 0, i32 0, i32 1, i32 0
br label %A
A: ; preds = %if.else.i.i.i.i95, %if.then.i.i.i.i92
%ins135157 = phi i128 [ %ins126, %if.then.i.i.i.i92 ], [ undef, %if.else.i.i.i.i95 ]
%second3.i.i97 = getelementptr inbounds %type_e, ptr %tmp9, i32 0, i32 1
%tmp14 = load i64, ptr %second3.i.i97, align 4
%tmp15 = trunc i64 %tmp14 to i32
%cmp.i99 = icmp sgt i32 %tmp6, %tmp15
%tmp16 = trunc i128 %ins135157 to i32
%cmp.i.i.i.i.i.i101 = icmp sgt i32 %tmp16, 8
br i1 %cmp.i.i.i.i.i.i101, label %if.then.i.i.i.i.i103, label %B
if.then.i.i.i.i.i103: ; preds = %A
unreachable
B: ; preds = %A
%tmp17 = trunc i128 %ins148 to i32
%cmp.i.i.i.i.i.i83 = icmp sgt i32 %tmp17, 8
br i1 %cmp.i.i.i.i.i.i83, label %if.then.i.i.i.i.i85, label %C
if.then.i.i.i.i.i85: ; preds = %B
unreachable
C: ; preds = %B
br i1 %cmp.i99, label %if.then17, label %if.end24
if.then17: ; preds = %C
br i1 false, label %if.then.i.i.i.i.i43, label %D
if.then.i.i.i.i.i43: ; preds = %if.then17
unreachable
D: ; preds = %if.then17
br i1 undef, label %if.then.i.i.i.i.i, label %E
if.then.i.i.i.i.i: ; preds = %D
unreachable
E: ; preds = %D
br label %if.end24
if.end24: ; preds = %E, %C
%phitmp = or i128 %tmp8, %mask144
%phitmp158 = or i128 undef, undef
%tmp18 = load ptr, ptr undef, align 4
%tmp19 = load ptr, ptr undef, align 4
%cmp.i49 = icmp eq ptr %tmp18, %tmp19
br i1 %cmp.i49, label %while.cond10.while.end26_crit_edge, label %while.body12
while.cond10.while.end26_crit_edge: ; preds = %if.end24
%.pre = load ptr, ptr undef, align 4
br label %while.end26
while.end26: ; preds = %while.cond10.while.end26_crit_edge, %while.end.while.end26_crit_edge
br i1 undef, label %while.body.lr.ph.i, label %F
while.body.lr.ph.i: ; preds = %while.end26
br label %while.body.i
while.body.i: ; preds = %while.body.i, %while.body.lr.ph.i
br i1 false, label %while.body.i, label %F
F: ; preds = %while.body.i, %while.end26
ret void
}
declare noalias ptr @malloc(i32) nounwind
|