| 1 |
; RUN: llc < %s -mtriple=thumbv7-apple-ios -relocation-model=pic -frame-pointer=all -mcpu=cortex-a8 | FileCheck %s |
| 2 |
; rdar://10676853 |
| 3 |
|
| 4 |
%struct.Dict_node_struct = type { ptr, ptr, ptr, ptr, ptr } |
| 5 |
%struct.Word_file_struct = type { [60 x i8], i32, ptr } |
| 6 |
%struct.Exp_struct = type { i8, i8, i8, i8, %union.anon } |
| 7 |
%union.anon = type { ptr } |
| 8 |
%struct.E_list_struct = type { ptr, ptr } |
| 9 |
|
| 10 |
@lookup_list = external hidden unnamed_addr global ptr, align 4 |
| 11 |
|
| 12 |
declare void @llvm.memcpy.p0.p0.i32(ptr nocapture, ptr nocapture, i32, i1) nounwind |
| 13 |
|
| 14 |
define hidden fastcc void @rdictionary_lookup(ptr %dn, ptr nocapture %s) nounwind ssp { |
| 15 |
; CHECK-LABEL: rdictionary_lookup: |
| 16 |
entry: |
| 17 |
br label %tailrecurse |
| 18 |
|
| 19 |
tailrecurse: ; preds = %if.then10, %entry |
| 20 |
%dn.tr = phi ptr [ %dn, %entry ], [ %9, %if.then10 ] |
| 21 |
%cmp = icmp eq ptr %dn.tr, null |
| 22 |
br i1 %cmp, label %if.end11, label %if.end |
| 23 |
|
| 24 |
if.end: ; preds = %tailrecurse |
| 25 |
%string = getelementptr inbounds %struct.Dict_node_struct, ptr %dn.tr, i32 0, i32 0 |
| 26 |
%0 = load ptr, ptr %string, align 4 |
| 27 |
br label %while.cond.i |
| 28 |
|
| 29 |
while.cond.i: ; preds = %while.body.i, %if.end |
| 30 |
%1 = phi ptr [ %s, %if.end ], [ %incdec.ptr.i, %while.body.i ] |
| 31 |
%storemerge.i = phi ptr [ %0, %if.end ], [ %incdec.ptr6.i, %while.body.i ] |
| 32 |
%2 = load i8, ptr %1, align 1 |
| 33 |
%cmp.i = icmp eq i8 %2, 0 |
| 34 |
%.pre.i = load i8, ptr %storemerge.i, align 1 |
| 35 |
br i1 %cmp.i, label %lor.lhs.false.i, label %land.end.i |
| 36 |
|
| 37 |
land.end.i: ; preds = %while.cond.i |
| 38 |
%cmp4.i = icmp eq i8 %2, %.pre.i |
| 39 |
br i1 %cmp4.i, label %while.body.i, label %while.end.i |
| 40 |
|
| 41 |
while.body.i: ; preds = %land.end.i |
| 42 |
%incdec.ptr.i = getelementptr inbounds i8, ptr %1, i32 1 |
| 43 |
%incdec.ptr6.i = getelementptr inbounds i8, ptr %storemerge.i, i32 1 |
| 44 |
br label %while.cond.i |
| 45 |
|
| 46 |
while.end.i: ; preds = %land.end.i |
| 47 |
%cmp8.i = icmp eq i8 %2, 42 |
| 48 |
br i1 %cmp8.i, label %if.end3, label %lor.lhs.false.i |
| 49 |
|
| 50 |
lor.lhs.false.i: ; preds = %while.end.i, %while.cond.i |
| 51 |
%3 = phi i8 [ %2, %while.end.i ], [ 0, %while.cond.i ] |
| 52 |
%cmp11.i = icmp eq i8 %.pre.i, 42 |
| 53 |
br i1 %cmp11.i, label %if.end3, label %dict_match.exit |
| 54 |
|
| 55 |
dict_match.exit: ; preds = %lor.lhs.false.i |
| 56 |
%cmp14.i = icmp eq i8 %3, 46 |
| 57 |
%conv16.i = sext i8 %3 to i32 |
| 58 |
%.conv16.i = select i1 %cmp14.i, i32 0, i32 %conv16.i |
| 59 |
%cmp18.i = icmp eq i8 %.pre.i, 46 |
| 60 |
%conv22.i = sext i8 %.pre.i to i32 |
| 61 |
%cond24.i = select i1 %cmp18.i, i32 0, i32 %conv22.i |
| 62 |
%sub.i = sub nsw i32 %.conv16.i, %cond24.i |
| 63 |
%cmp1 = icmp sgt i32 %sub.i, -1 |
| 64 |
br i1 %cmp1, label %if.end3, label %if.then10 |
| 65 |
|
| 66 |
if.end3: ; preds = %dict_match.exit, %lor.lhs.false.i, %while.end.i |
| 67 |
; CHECK: %if.end3 |
| 68 |
; CHECK: cmp |
| 69 |
; CHECK-NOT: cbnz |
| 70 |
%storemerge1.i3 = phi i32 [ %sub.i, %dict_match.exit ], [ 0, %lor.lhs.false.i ], [ 0, %while.end.i ] |
| 71 |
%right = getelementptr inbounds %struct.Dict_node_struct, ptr %dn.tr, i32 0, i32 4 |
| 72 |
%4 = load ptr, ptr %right, align 4 |
| 73 |
tail call fastcc void @rdictionary_lookup(ptr %4, ptr %s) |
| 74 |
%cmp4 = icmp eq i32 %storemerge1.i3, 0 |
| 75 |
br i1 %cmp4, label %if.then5, label %if.end8 |
| 76 |
|
| 77 |
if.then5: ; preds = %if.end3 |
| 78 |
%call6 = tail call fastcc ptr @xalloc(i32 20) |
| 79 |
%5 = bitcast ptr %call6 to ptr |
| 80 |
%6 = bitcast ptr %dn.tr to ptr |
| 81 |
tail call void @llvm.memcpy.p0.p0.i32(ptr align 4 %call6, ptr align 4 %6, i32 16, i1 false) |
| 82 |
%7 = load ptr, ptr @lookup_list, align 4 |
| 83 |
%right7 = getelementptr inbounds i8, ptr %call6, i32 16 |
| 84 |
%8 = bitcast ptr %right7 to ptr |
| 85 |
store ptr %7, ptr %8, align 4 |
| 86 |
store ptr %5, ptr @lookup_list, align 4 |
| 87 |
br label %if.then10 |
| 88 |
|
| 89 |
if.end8: ; preds = %if.end3 |
| 90 |
%cmp9 = icmp slt i32 %storemerge1.i3, 1 |
| 91 |
br i1 %cmp9, label %if.then10, label %if.end11 |
| 92 |
|
| 93 |
if.then10: ; preds = %if.end8, %if.then5, %dict_match.exit |
| 94 |
%left = getelementptr inbounds %struct.Dict_node_struct, ptr %dn.tr, i32 0, i32 3 |
| 95 |
%9 = load ptr, ptr %left, align 4 |
| 96 |
br label %tailrecurse |
| 97 |
|
| 98 |
if.end11: ; preds = %if.end8, %tailrecurse |
| 99 |
ret void |
| 100 |
} |
| 101 |
|
| 102 |
; Materializable |
| 103 |
declare hidden fastcc ptr @xalloc(i32) nounwind ssp |