Home | History | Annotate | Download | only in LoopStrengthReduce
      1 ; RUN: opt < %s -loop-reduce -gvn -S | FileCheck %s
      2 
      3 target datalayout = "e-i64:64-v16:16-v32:32-n16:32:64"
      4 
      5 define void @_Z3fooPfll(float* nocapture readonly %input, i64 %n, i64 %s) {
      6 ; CHECK-LABEL: @_Z3fooPfll(
      7 entry:
      8   %mul = shl nsw i64 %s, 2
      9 ; CHECK: %mul = shl i64 %s, 2
     10   tail call void @_Z3bazl(i64 %mul) #2
     11 ; CHECK-NEXT: call void @_Z3bazl(i64 %mul)
     12   %cmp.5 = icmp sgt i64 %n, 0
     13   br i1 %cmp.5, label %for.body.preheader, label %for.cond.cleanup
     14 
     15 for.body.preheader:                               ; preds = %entry
     16   br label %for.body
     17 
     18 for.cond.cleanup.loopexit:                        ; preds = %for.body
     19   br label %for.cond.cleanup
     20 
     21 for.cond.cleanup:                                 ; preds = %for.cond.cleanup.loopexit, %entry
     22   ret void
     23 
     24 for.body:                                         ; preds = %for.body.preheader, %for.body
     25   %i.06 = phi i64 [ %add, %for.body ], [ 0, %for.body.preheader ]
     26   %arrayidx = getelementptr inbounds float, float* %input, i64 %i.06
     27 ; LoopStrengthReduce should reuse %mul as the stride.
     28 ; CHECK: getelementptr i1, i1* {{[^,]+}}, i64 %mul
     29   %0 = load float, float* %arrayidx, align 4
     30   tail call void @_Z3barf(float %0) #2
     31   %add = add nsw i64 %i.06, %s
     32   %cmp = icmp slt i64 %add, %n
     33   br i1 %cmp, label %for.body, label %for.cond.cleanup.loopexit
     34 }
     35 
     36 declare void @_Z3bazl(i64)
     37 
     38 declare void @_Z3barf(float)
     39