Home | History | Annotate | Download | only in LoopUnroll
      1 ; RUN: opt < %s -S -loop-unroll -unroll-max-iteration-count-to-analyze=100 -unroll-dynamic-cost-savings-discount=1000 -unroll-threshold=10 -unroll-percent-dynamic-cost-saved-threshold=60 | FileCheck %s
      2 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
      3 
      4 ; When examining gep-instructions we shouldn't consider them simplified if the
      5 ; corresponding memory access isn't simplified. Doing the opposite might bias
      6 ; our estimate, so that we might decide to unroll even a simple memcpy loop.
      7 ;
      8 ; Thus, the following loop shouldn't be unrolled:
      9 ; CHECK-LABEL: @not_simplified_geps
     10 ; CHECK: br i1 %
     11 ; CHECK: ret void
     12 define void @not_simplified_geps(i32* noalias %b, i32* noalias %c) {
     13 entry:
     14   br label %for.body
     15 
     16 for.body:
     17   %iv.0 = phi i64 [ 0, %entry ], [ %iv.1, %for.body ]
     18   %arrayidx1 = getelementptr inbounds i32, i32* %b, i64 %iv.0
     19   %x1 = load i32, i32* %arrayidx1, align 4
     20   %arrayidx2 = getelementptr inbounds i32, i32* %c, i64 %iv.0
     21   store i32 %x1, i32* %arrayidx2, align 4
     22   %iv.1 = add nuw nsw i64 %iv.0, 1
     23   %exitcond = icmp eq i64 %iv.1, 10
     24   br i1 %exitcond, label %for.end, label %for.body
     25 
     26 for.end:
     27   ret void
     28 }
     29