; ModuleID = 'byte-fill.before.ll'
source_filename = "byte-fill.before.ll"
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

define void @byte_fill(ptr %dst, i64 %n, i8 %value) {
entry:
  %empty = icmp eq i64 %n, 0
  br i1 %empty, label %exit, label %loop.preheader

loop.preheader:                                   ; preds = %entry
  call void @llvm.memset.p0.i64(ptr align 1 %dst, i8 %value, i64 %n, i1 false)
  br label %loop

loop:                                             ; preds = %loop.preheader, %loop
  %i = phi i64 [ %next, %loop ], [ 0, %loop.preheader ]
  %cell = getelementptr i8, ptr %dst, i64 %i
  %next = add nuw i64 %i, 1
  %more = icmp ult i64 %next, %n
  br i1 %more, label %loop, label %exit.loopexit

exit.loopexit:                                    ; preds = %loop
  br label %exit

exit:                                             ; preds = %exit.loopexit, %entry
  ret void
}

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr writeonly captures(none), i8, i64, i1 immarg) #0

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: write) }
