; LLVM IR from ermig1979/Simd :: src/Simd/SimdBaseNeural.ll (ZN4Simd4Base30NeuralAddConvolution2x2ForwardEPKfmmmS2_Pfm)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4Simd4Base30NeuralAddConvolution2x2ForwardEPKfmmmS2_Pfm(ptr noundef %0, i64 noundef %1, i64 noundef %2, i64 noundef %3, ptr noundef %4, ptr noundef %5, i64 noundef %6) #1 {
  %8 = alloca ptr, align 8
  %9 = alloca i64, align 8
  %10 = alloca i64, align 8
  %11 = alloca i64, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca i64, align 8
  %15 = alloca i64, align 8
  %16 = alloca i32, align 4
  %17 = alloca i64, align 8
  store ptr %0, ptr %8, align 8, !tbaa !5
  store i64 %1, ptr %9, align 8, !tbaa !9
  store i64 %2, ptr %10, align 8, !tbaa !9
  store i64 %3, ptr %11, align 8, !tbaa !9
  store ptr %4, ptr %12, align 8, !tbaa !5
  store ptr %5, ptr %13, align 8, !tbaa !5
  store i64 %6, ptr %14, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #3
  store i64 0, ptr %15, align 8, !tbaa !9
  br label %18

18:                                               ; preds = %51, %7
  %19 = load i64, ptr %15, align 8, !tbaa !9
  %20 = load i64, ptr %11, align 8, !tbaa !9
  %21 = icmp ult i64 %19, %20
  br i1 %21, label %23, label %22

22:                                               ; preds = %18
  store i32 2, ptr %16, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #3
  br label %54

23:                                               ; preds = %18
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #3
  store i64 0, ptr %17, align 8, !tbaa !9
  br label %24

24:                                               ; preds = %41, %23
  %25 = load i64, ptr %17, align 8, !tbaa !9
  %26 = load i64, ptr %10, align 8, !tbaa !9
  %27 = icmp ult i64 %25, %26
  br i1 %27, label %29, label %28

28:                                               ; preds = %24
  store i32 5, ptr %16, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #3
  br label %44

29:                                               ; preds = %24
  %30 = load ptr, ptr %8, align 8, !tbaa !5
  %31 = load i64, ptr %17, align 8, !tbaa !9
  %32 = getelementptr inbounds float, ptr %30, i64 %31
  %33 = load i64, ptr %9, align 8, !tbaa !9
  %34 = load ptr, ptr %12, align 8, !tbaa !5
  %35 = call noundef float @_ZN4Simd4Base21Convolution2x2ForwardEPKfmS2_(ptr noundef %32, i64 noundef %33, ptr noundef %34)
  %36 = load ptr, ptr %13, align 8, !tbaa !5
  %37 = load i64, ptr %17, align 8, !tbaa !9
  %38 = getelementptr inbounds float, ptr %36, i64 %37
  %39 = load float, ptr %38, align 4, !tbaa !11
  %40 = fadd float %39, %35
  store float %40, ptr %38, align 4, !tbaa !11
  br label %41

41:                                               ; preds = %29
  %42 = load i64, ptr %17, align 8, !tbaa !9
  %43 = add i64 %42, 1
  store i64 %43, ptr %17, align 8, !tbaa !9
  br label %24, !llvm.loop !13

44:                                               ; preds = %28
  %45 = load i64, ptr %9, align 8, !tbaa !9
  %46 = load ptr, ptr %8, align 8, !tbaa !5
  %47 = getelementptr inbounds float, ptr %46, i64 %45
  store ptr %47, ptr %8, align 8, !tbaa !5
  %48 = load i64, ptr %14, align 8, !tbaa !9
  %49 = load ptr, ptr %13, align 8, !tbaa !5
  %50 = getelementptr inbounds float, ptr %49, i64 %48
  store ptr %50, ptr %13, align 8, !tbaa !5
  br label %51

51:                                               ; preds = %44
  %52 = load i64, ptr %15, align 8, !tbaa !9
  %53 = add i64 %52, 1
  store i64 %53, ptr %15, align 8, !tbaa !9
  br label %18, !llvm.loop !15

54:                                               ; preds = %22
  ret void
}

; Function Attrs: alwaysinline mustprogress uwtable
declare dso_local noundef float @_ZN4Simd4Base21Convolution2x2ForwardEPKfmS2_(ptr noundef, i64 noundef, ptr noundef) #2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { alwaysinline mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"float", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4Simd4Base30NeuralAddConvolution2x2ForwardEPKfmmmS2_Pfm(ptr noundef %0, i64 noundef %1, i64 noundef %2, i64 noundef %3, ptr noundef %4, ptr nocapture noundef %5, i64 noundef %6) local_unnamed_addr #0 {
  %.not = icmp eq i64 %3, 0
  %.not23 = icmp eq i64 %2, 0
  %or.cond = or i1 %.not, %.not23
  br i1 %or.cond, label %._crit_edge22, label %.preheader.us

.preheader.us:                                    ; preds = %7, %._crit_edge.us
  %.01521.us = phi i64 [ %17, %._crit_edge.us ], [ 0, %7 ]
  %.01620.us = phi ptr [ %15, %._crit_edge.us ], [ %0, %7 ]
  %.01719.us = phi ptr [ %16, %._crit_edge.us ], [ %5, %7 ]
  br label %8

8:                                                ; preds = %.preheader.us, %8
  %.018.us = phi i64 [ 0, %.preheader.us ], [ %14, %8 ]
  %9 = getelementptr inbounds float, ptr %.01620.us, i64 %.018.us
  %10 = tail call noundef float @_ZN4Simd4Base21Convolution2x2ForwardEPKfmS2_(ptr noundef %9, i64 noundef %1, ptr noundef %4)
  %11 = getelementptr inbounds float, ptr %.01719.us, i64 %.018.us
  %12 = load float, ptr %11, align 4, !tbaa !5
  %13 = fadd float %10, %12
  store float %13, ptr %11, align 4, !tbaa !5
  %14 = add nuw i64 %.018.us, 1
  %exitcond.not = icmp eq i64 %14, %2
  br i1 %exitcond.not, label %._crit_edge.us, label %8, !llvm.loop !9

._crit_edge.us:                                   ; preds = %8
  %15 = getelementptr inbounds float, ptr %.01620.us, i64 %1
  %16 = getelementptr inbounds float, ptr %.01719.us, i64 %6
  %17 = add nuw i64 %.01521.us, 1
  %exitcond25.not = icmp eq i64 %17, %3
  br i1 %exitcond25.not, label %._crit_edge22, label %.preheader.us, !llvm.loop !11

._crit_edge22:                                    ; preds = %._crit_edge.us, %7
  ret void
}

; Function Attrs: alwaysinline mustprogress uwtable
declare dso_local noundef float @_ZN4Simd4Base21Convolution2x2ForwardEPKfmS2_(ptr noundef, i64 noundef, ptr noundef) local_unnamed_addr #1

attributes #0 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { alwaysinline mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"float", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}


; Effective O3 passes: CorrelatedValuePropagationPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass