Home | History | Annotate | Download | only in LoopIdiom
      1 ; RUN: opt -loop-idiom < %s -S | FileCheck %s
      2 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
      3 target triple = "x86_64-unknown-linux-gnu"
      4 
      5 declare void @ff()
      6 
      7 define void @test(i8* noalias nocapture %base, i64 %size) #1 {
      8 entry:
      9   %cmp3 = icmp eq i64 %size, 0
     10   br i1 %cmp3, label %for.end, label %for.body.preheader
     11 
     12 for.body.preheader:                               ; preds = %entry
     13   br label %for.body
     14 
     15 for.body:                                         ; preds = %for.body.preheader, %for.body
     16 ; CHECK-LABEL: @test(
     17 ; CHECK-NOT: llvm.memset
     18   %indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.body ]
     19   tail call void @ff()
     20   %arrayidx = getelementptr inbounds i8, i8* %base, i64 %indvars.iv
     21   store i8 0, i8* %arrayidx, align 1
     22   %indvars.iv.next = add i64 %indvars.iv, 1
     23   %exitcond = icmp ne i64 %indvars.iv.next, %size
     24   br i1 %exitcond, label %for.body, label %for.end.loopexit
     25 
     26 for.end.loopexit:                                 ; preds = %for.body
     27   br label %for.end
     28 
     29 for.end:                                          ; preds = %for.end.loopexit, %entry
     30   ret void
     31 }
     32 
     33 attributes #1 = { uwtable }
     34