; LLVM IR from huawei-noah/bolt :: compute/tensor/src/cpu/arm (depthwise_convolution)

; 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"

%struct.TensorDesc = type { i32, i32, i32, [20 x i32] }
%struct.ConvolutionParamSpec = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, %union.ActivationSpec, i32, i32, i32, i32 }
%union.ActivationSpec = type { %struct.ClipParamSpec }
%struct.ClipParamSpec = type { float, float }
%struct.ActivationParamSpec = type { i32, [4 x float] }

; 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 nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #1

; 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 noundef i32 @_Z25depthwise_convolution_arm10TensorDescPvS_PKv20ConvolutionParamSpec36DepthwiseConvolutionForwardAlgorithmS_S2_jS0_S_S0_19ActivationParamSpec4Arch(ptr noundef byval(%struct.TensorDesc) align 8 %0, ptr noundef %1, ptr noundef byval(%struct.TensorDesc) align 8 %2, ptr noundef %3, ptr noundef byval(%struct.ConvolutionParamSpec) align 8 %4, i32 noundef %5, ptr noundef byval(%struct.TensorDesc) align 8 %6, ptr noundef %7, i32 noundef %8, ptr noundef %9, ptr noundef byval(%struct.TensorDesc) align 8 %10, ptr noundef %11, ptr noundef byval(%struct.ActivationParamSpec) align 8 %12, i32 noundef %13) #2 {
  %15 = alloca ptr, align 8
  %16 = alloca ptr, align 8
  %17 = alloca i32, align 4
  %18 = alloca ptr, align 8
  %19 = alloca i32, align 4
  %20 = alloca ptr, align 8
  %21 = alloca ptr, align 8
  %22 = alloca i32, align 4
  %23 = alloca %struct.TensorDesc, align 4
  %24 = alloca %struct.ActivationParamSpec, align 4
  %25 = alloca %struct.TensorDesc, align 8
  %26 = alloca %struct.TensorDesc, align 8
  %27 = alloca %struct.TensorDesc, align 8
  %28 = alloca %struct.ConvolutionParamSpec, align 8
  %29 = alloca %struct.TensorDesc, align 8
  %30 = alloca %struct.TensorDesc, align 8
  %31 = alloca %struct.TensorDesc, align 8
  %32 = alloca %struct.ActivationParamSpec, align 8
  %33 = alloca %struct.ActivationParamSpec, align 8
  store ptr %1, ptr %15, align 8, !tbaa !5
  store ptr %3, ptr %16, align 8, !tbaa !5
  store i32 %5, ptr %17, align 4, !tbaa !9
  store ptr %7, ptr %18, align 8, !tbaa !5
  store i32 %8, ptr %19, align 4, !tbaa !11
  store ptr %9, ptr %20, align 8, !tbaa !5
  store ptr %11, ptr %21, align 8, !tbaa !5
  store i32 %13, ptr %22, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 92, ptr %23) #5
  call void @_ZN10TensorDescC2Ev(ptr noundef nonnull align 4 dereferenceable(92) %23) #5
  call void @llvm.lifetime.start.p0(i64 20, ptr %24) #5
  call void @_ZN19ActivationParamSpecC2Ev(ptr noundef nonnull align 4 dereferenceable(20) %24) #5
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %25, ptr align 8 %0, i64 92, i1 false), !tbaa.struct !15
  %34 = load ptr, ptr %15, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %26, ptr align 8 %2, i64 92, i1 false), !tbaa.struct !15
  %35 = load ptr, ptr %16, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %27, ptr align 4 %23, i64 92, i1 false), !tbaa.struct !15
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %28, ptr align 8 %4, i64 108, i1 false), !tbaa.struct !21
  %36 = load i32, ptr %17, align 4, !tbaa !9
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %29, ptr align 4 %23, i64 92, i1 false), !tbaa.struct !15
  %37 = load ptr, ptr %18, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %30, ptr align 8 %6, i64 92, i1 false), !tbaa.struct !15
  %38 = load i32, ptr %19, align 4, !tbaa !11
  %39 = load ptr, ptr %20, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %31, ptr align 8 %10, i64 92, i1 false), !tbaa.struct !15
  %40 = load ptr, ptr %21, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %32, ptr align 8 %12, i64 20, i1 false), !tbaa.struct !28
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %33, ptr align 4 %24, i64 20, i1 false), !tbaa.struct !28
  %41 = load i32, ptr %22, align 4, !tbaa !13
  %42 = call noundef i32 @_Z35depthwise_pointwise_convolution_arm10TensorDescPvS_PKvS_S2_20ConvolutionParamSpec36DepthwiseConvolutionForwardAlgorithmS_S2_S_S2_jS0_S_S0_19ActivationParamSpecS5_4Arch(ptr noundef byval(%struct.TensorDesc) align 8 %25, ptr noundef %34, ptr noundef byval(%struct.TensorDesc) align 8 %26, ptr noundef %35, ptr noundef byval(%struct.TensorDesc) align 8 %27, ptr noundef null, ptr noundef byval(%struct.ConvolutionParamSpec) align 8 %28, i32 noundef %36, ptr noundef byval(%struct.TensorDesc) align 8 %29, ptr noundef %37, ptr noundef byval(%struct.TensorDesc) align 8 %30, ptr noundef null, i32 noundef %38, ptr noundef %39, ptr noundef byval(%struct.TensorDesc) align 8 %31, ptr noundef %40, ptr noundef byval(%struct.ActivationParamSpec) align 8 %32, ptr noundef byval(%struct.ActivationParamSpec) align 8 %33, i32 noundef %41)
  call void @llvm.lifetime.end.p0(i64 20, ptr %24) #5
  call void @llvm.lifetime.end.p0(i64 92, ptr %23) #5
  ret i32 %42
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN10TensorDescC2Ev(ptr noundef nonnull align 4 dereferenceable(92)) unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN19ActivationParamSpecC2Ev(ptr noundef nonnull align 4 dereferenceable(20)) unnamed_addr #3 align 2

declare noundef i32 @_Z35depthwise_pointwise_convolution_arm10TensorDescPvS_PKvS_S2_20ConvolutionParamSpec36DepthwiseConvolutionForwardAlgorithmS_S2_S_S2_jS0_S_S0_19ActivationParamSpecS5_4Arch(ptr noundef byval(%struct.TensorDesc) align 8, ptr noundef, ptr noundef byval(%struct.TensorDesc) align 8, ptr noundef, ptr noundef byval(%struct.TensorDesc) align 8, ptr noundef, ptr noundef byval(%struct.ConvolutionParamSpec) align 8, i32 noundef, ptr noundef byval(%struct.TensorDesc) align 8, ptr noundef, ptr noundef byval(%struct.TensorDesc) align 8, ptr noundef, i32 noundef, ptr noundef, ptr noundef byval(%struct.TensorDesc) align 8, ptr noundef, ptr noundef byval(%struct.ActivationParamSpec) align 8, ptr noundef byval(%struct.ActivationParamSpec) align 8, i32 noundef) #4

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 = { inlinehint mustprogress nounwind 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 #4 = { "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 #5 = { 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 = !{!"_ZTS36DepthwiseConvolutionForwardAlgorithm", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"_ZTS4Arch", !7, i64 0}
!15 = !{i64 0, i64 4, !16, i64 4, i64 4, !18, i64 8, i64 4, !11, i64 12, i64 80, !20}
!16 = !{!17, !17, i64 0}
!17 = !{!"_ZTS8DataType", !7, i64 0}
!18 = !{!19, !19, i64 0}
!19 = !{!"_ZTS10DataFormat", !7, i64 0}
!20 = !{!7, !7, i64 0}
!21 = !{i64 0, i64 4, !11, i64 4, i64 4, !11, i64 8, i64 4, !11, i64 12, i64 4, !11, i64 16, i64 4, !11, i64 20, i64 4, !11, i64 24, i64 4, !11, i64 28, i64 4, !11, i64 32, i64 4, !11, i64 36, i64 4, !11, i64 40, i64 4, !11, i64 44, i64 4, !11, i64 48, i64 4, !11, i64 52, i64 4, !11, i64 56, i64 4, !11, i64 60, i64 4, !11, i64 64, i64 4, !11, i64 68, i64 4, !11, i64 72, i64 4, !22, i64 76, i64 4, !24, i64 80, i64 4, !24, i64 84, i64 8, !20, i64 92, i64 4, !26, i64 96, i64 4, !11, i64 100, i64 4, !11, i64 104, i64 4, !11}
!22 = !{!23, !23, i64 0}
!23 = !{!"_ZTS15ConvolutionMode", !7, i64 0}
!24 = !{!25, !25, i64 0}
!25 = !{!"_ZTS14ActivationMode", !7, i64 0}
!26 = !{!27, !27, i64 0}
!27 = !{!"_ZTS9RoundMode", !7, i64 0}
!28 = !{i64 0, i64 4, !24, i64 4, i64 16, !20}


; 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"

%struct.TensorDesc = type { i32, i32, i32, [20 x i32] }
%struct.ConvolutionParamSpec = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, %union.ActivationSpec, i32, i32, i32, i32 }
%union.ActivationSpec = type { %struct.ClipParamSpec }
%struct.ClipParamSpec = type { float, float }
%struct.ActivationParamSpec = type { i32, [4 x float] }

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

; Function Attrs: mustprogress 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 noundef i32 @_Z25depthwise_convolution_arm10TensorDescPvS_PKv20ConvolutionParamSpec36DepthwiseConvolutionForwardAlgorithmS_S2_jS0_S_S0_19ActivationParamSpec4Arch(ptr nocapture noundef readonly byval(%struct.TensorDesc) align 8 %0, ptr noundef %1, ptr nocapture noundef readonly byval(%struct.TensorDesc) align 8 %2, ptr noundef %3, ptr nocapture noundef readonly byval(%struct.ConvolutionParamSpec) align 8 %4, i32 noundef %5, ptr nocapture noundef readonly byval(%struct.TensorDesc) align 8 %6, ptr noundef %7, i32 noundef %8, ptr noundef %9, ptr nocapture noundef readonly byval(%struct.TensorDesc) align 8 %10, ptr noundef %11, ptr nocapture noundef readonly byval(%struct.ActivationParamSpec) align 8 %12, i32 noundef %13) local_unnamed_addr #1 {
  %15 = alloca %struct.TensorDesc, align 8
  %16 = alloca %struct.ActivationParamSpec, align 8
  call void @llvm.lifetime.start.p0(i64 92, ptr nonnull %15) #4
  call void @_ZN10TensorDescC2Ev(ptr noundef nonnull align 4 dereferenceable(92) %15) #4
  call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %16) #4
  call void @_ZN19ActivationParamSpecC2Ev(ptr noundef nonnull align 4 dereferenceable(20) %16) #4
  %17 = call noundef i32 @_Z35depthwise_pointwise_convolution_arm10TensorDescPvS_PKvS_S2_20ConvolutionParamSpec36DepthwiseConvolutionForwardAlgorithmS_S2_S_S2_jS0_S_S0_19ActivationParamSpecS5_4Arch(ptr noundef nonnull byval(%struct.TensorDesc) align 8 %0, ptr noundef %1, ptr noundef nonnull byval(%struct.TensorDesc) align 8 %2, ptr noundef %3, ptr noundef nonnull byval(%struct.TensorDesc) align 8 %15, ptr noundef null, ptr noundef nonnull byval(%struct.ConvolutionParamSpec) align 8 %4, i32 noundef %5, ptr noundef nonnull byval(%struct.TensorDesc) align 8 %15, ptr noundef %7, ptr noundef nonnull byval(%struct.TensorDesc) align 8 %6, ptr noundef null, i32 noundef %8, ptr noundef %9, ptr noundef nonnull byval(%struct.TensorDesc) align 8 %10, ptr noundef %11, ptr noundef nonnull byval(%struct.ActivationParamSpec) align 8 %12, ptr noundef nonnull byval(%struct.ActivationParamSpec) align 8 %16, i32 noundef %13)
  call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %16) #4
  call void @llvm.lifetime.end.p0(i64 92, ptr nonnull %15) #4
  ret i32 %17
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN10TensorDescC2Ev(ptr noundef nonnull align 4 dereferenceable(92)) unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN19ActivationParamSpecC2Ev(ptr noundef nonnull align 4 dereferenceable(20)) unnamed_addr #2 align 2

declare noundef i32 @_Z35depthwise_pointwise_convolution_arm10TensorDescPvS_PKvS_S2_20ConvolutionParamSpec36DepthwiseConvolutionForwardAlgorithmS_S2_S_S2_jS0_S_S0_19ActivationParamSpecS5_4Arch(ptr noundef byval(%struct.TensorDesc) align 8, ptr noundef, ptr noundef byval(%struct.TensorDesc) align 8, ptr noundef, ptr noundef byval(%struct.TensorDesc) align 8, ptr noundef, ptr noundef byval(%struct.ConvolutionParamSpec) align 8, i32 noundef, ptr noundef byval(%struct.TensorDesc) align 8, ptr noundef, ptr noundef byval(%struct.TensorDesc) align 8, ptr noundef, i32 noundef, ptr noundef, ptr noundef byval(%struct.TensorDesc) align 8, ptr noundef, ptr noundef byval(%struct.ActivationParamSpec) align 8, ptr noundef byval(%struct.ActivationParamSpec) align 8, i32 noundef) local_unnamed_addr #3

attributes #0 = { mustprogress 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 = { inlinehint mustprogress nounwind 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 = { "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 #4 = { 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)"}


; Effective O3 passes: DSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,MemCpyOptPass,PostOrderFunctionAttrsPass,SROAPass