Home | History | Annotate | Download | only in ARM
      1 ; RUN: llc -regalloc=greedy < %s | FileCheck %s
      2 
      3 ; LSR shouldn't introduce more induction variables than needed, increasing
      4 ; register pressure and therefore spilling. There is more room for improvement
      5 ; here.
      6 
      7 ; CHECK: sub sp, #{{32|28|24}}
      8 
      9 ; CHECK: %for.inc
     10 ; CHECK: ldr{{(.w)?}} r{{.*}}, [sp, #
     11 ; CHECK: ldr{{(.w)?}} r{{.*}}, [sp, #
     12 ; CHECK: ldr{{(.w)?}} r{{.*}}, [sp, #
     13 ; CHECK: add
     14 
     15 target datalayout = "e-p:32:32:32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-i64:32:32-f32:32:32-f64:32:32-v64:32:64-v128:32:128-a0:0:32-n32"
     16 target triple = "thumbv7-apple-macosx10.7.0"
     17 
     18 %struct.partition_entry = type { i32, i32, i64, i64 }
     19 
     20 define i32 @partition_overlap_check(%struct.partition_entry* nocapture %part, i32 %num_entries) nounwind readonly optsize ssp {
     21 entry:
     22   %cmp79 = icmp sgt i32 %num_entries, 0
     23   br i1 %cmp79, label %outer.loop, label %for.end72
     24 
     25 outer.loop:                                 ; preds = %for.inc69, %entry
     26   %overlap.081 = phi i32 [ %overlap.4, %for.inc69 ], [ 0, %entry ]
     27   %0 = phi i32 [ %inc71, %for.inc69 ], [ 0, %entry ]
     28   %offset = getelementptr %struct.partition_entry* %part, i32 %0, i32 2
     29   %len = getelementptr %struct.partition_entry* %part, i32 %0, i32 3
     30   %tmp5 = load i64* %offset, align 4, !tbaa !0
     31   %tmp15 = load i64* %len, align 4, !tbaa !0
     32   %add = add nsw i64 %tmp15, %tmp5
     33   br label %inner.loop
     34 
     35 inner.loop:                                       ; preds = %for.inc, %outer.loop
     36   %overlap.178 = phi i32 [ %overlap.081, %outer.loop ], [ %overlap.4, %for.inc ]
     37   %1 = phi i32 [ 0, %outer.loop ], [ %inc, %for.inc ]
     38   %cmp23 = icmp eq i32 %0, %1
     39   br i1 %cmp23, label %for.inc, label %if.end
     40 
     41 if.end:                                           ; preds = %inner.loop
     42   %len39 = getelementptr %struct.partition_entry* %part, i32 %1, i32 3
     43   %offset28 = getelementptr %struct.partition_entry* %part, i32 %1, i32 2
     44   %tmp29 = load i64* %offset28, align 4, !tbaa !0
     45   %tmp40 = load i64* %len39, align 4, !tbaa !0
     46   %add41 = add nsw i64 %tmp40, %tmp29
     47   %cmp44 = icmp sge i64 %tmp29, %tmp5
     48   %cmp47 = icmp slt i64 %tmp29, %add
     49   %or.cond = and i1 %cmp44, %cmp47
     50   %overlap.2 = select i1 %or.cond, i32 1, i32 %overlap.178
     51   %cmp52 = icmp sle i64 %add41, %add
     52   %cmp56 = icmp sgt i64 %add41, %tmp5
     53   %or.cond74 = and i1 %cmp52, %cmp56
     54   %overlap.3 = select i1 %or.cond74, i32 1, i32 %overlap.2
     55   %cmp61 = icmp sgt i64 %tmp29, %tmp5
     56   %cmp65 = icmp slt i64 %add41, %add
     57   %or.cond75 = or i1 %cmp61, %cmp65
     58   br i1 %or.cond75, label %for.inc, label %if.then66
     59 
     60 if.then66:                                        ; preds = %if.end
     61   br label %for.inc
     62 
     63 for.inc:                                          ; preds = %if.end, %if.then66, %inner.loop
     64   %overlap.4 = phi i32 [ %overlap.178, %inner.loop ], [ 1, %if.then66 ], [ %overlap.3, %if.end ]
     65   %inc = add nsw i32 %1, 1
     66   %exitcond = icmp eq i32 %inc, %num_entries
     67   br i1 %exitcond, label %for.inc69, label %inner.loop
     68 
     69 for.inc69:                                        ; preds = %for.inc
     70   %inc71 = add nsw i32 %0, 1
     71   %exitcond83 = icmp eq i32 %inc71, %num_entries
     72   br i1 %exitcond83, label %for.end72, label %outer.loop
     73 
     74 for.end72:                                        ; preds = %for.inc69, %entry
     75   %overlap.0.lcssa = phi i32 [ 0, %entry ], [ %overlap.4, %for.inc69 ]
     76   ret i32 %overlap.0.lcssa
     77 }
     78 
     79 !0 = metadata !{metadata !"long long", metadata !1}
     80 !1 = metadata !{metadata !"omnipotent char", metadata !2}
     81 !2 = metadata !{metadata !"Simple C/C++ TBAA", null}
     82