; LLVM IR from NervanaSystems/ngraph :: src/ngraph/op/convolution.ll (ZNK6ngraph2op2v123ConvolutionBackpropData10is_dynamicEv)

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

%"class.ngraph::Output" = type { %"class.std::shared_ptr.84", i64 }
%"class.std::shared_ptr.84" = type { %"class.std::__shared_ptr.85" }
%"class.std::__shared_ptr.85" = type { ptr, %"class.std::__shared_count" }
%"class.std::__shared_count" = type { ptr }

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

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN6ngraph6OutputINS_4NodeEED2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #1 align 2

declare void @_ZNK6ngraph4Node11input_valueEm(ptr dead_on_unwind writable sret(%"class.ngraph::Output") align 8, ptr noundef nonnull align 8 dereferenceable(680), i64 noundef) #2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZNK6ngraph2op2v123ConvolutionBackpropData10is_dynamicEv(ptr noundef nonnull align 8 dereferenceable(808) %0) unnamed_addr #3 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca i1, align 1
  %3 = alloca ptr, align 8
  %4 = alloca i8, align 1
  %5 = alloca %"class.ngraph::Output", align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  %9 = load ptr, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 1, ptr %4) #4
  %10 = call noundef zeroext i1 @_ZNK6ngraph4Node10is_dynamicEv(ptr noundef nonnull align 8 dereferenceable(680) %9)
  %11 = zext i1 %10 to i8
  store i8 %11, ptr %4, align 1, !tbaa !9
  %12 = call noundef i64 @_ZNK6ngraph4Node14get_input_sizeEv(ptr noundef nonnull align 8 dereferenceable(680) %9)
  %13 = icmp eq i64 %12, 3
  br i1 %13, label %14, label %27

14:                                               ; preds = %1
  %15 = load i8, ptr %4, align 1, !tbaa !9, !range !11, !noundef !12
  %16 = trunc i8 %15 to i1
  br i1 %16, label %27, label %17

17:                                               ; preds = %14
  call void @llvm.lifetime.start.p0(i64 24, ptr %5) #4
  call void @_ZNK6ngraph4Node11input_valueEm(ptr dead_on_unwind writable sret(%"class.ngraph::Output") align 8 %5, ptr noundef nonnull align 8 dereferenceable(680) %9, i64 noundef 2)
  %18 = invoke noundef ptr @_ZNK6ngraph6OutputINS_4NodeEE8get_nodeEv(ptr noundef nonnull align 8 dereferenceable(24) %5)
          to label %19 unwind label %23

19:                                               ; preds = %17
  %20 = invoke noundef zeroext i1 @_ZN6ngraph7is_typeINS_2op2v08ConstantEPNS_4NodeEEENSt9enable_ifIXsr3std14is_convertibleIDTcldtclptclsr3stdE7declvalIT0_EE13get_type_infoE11is_castablesrT_9type_infoEEbEE5valueEbE4typeES7_(ptr noundef %18)
          to label %21 unwind label %23

21:                                               ; preds = %19
  %22 = xor i1 %20, true
  store i1 %22, ptr %2, align 1
  call void @_ZN6ngraph6OutputINS_4NodeEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %5) #4
  call void @llvm.lifetime.end.p0(i64 24, ptr %5) #4
  store i32 1, ptr %8, align 4
  br label %30

23:                                               ; preds = %19, %17
  %24 = landingpad { ptr, i32 }
          cleanup
  %25 = extractvalue { ptr, i32 } %24, 0
  store ptr %25, ptr %6, align 8
  %26 = extractvalue { ptr, i32 } %24, 1
  store i32 %26, ptr %7, align 4
  call void @_ZN6ngraph6OutputINS_4NodeEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %5) #4
  call void @llvm.lifetime.end.p0(i64 24, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr %4) #4
  br label %32

27:                                               ; preds = %14, %1
  %28 = load i8, ptr %4, align 1, !tbaa !9, !range !11, !noundef !12
  %29 = trunc i8 %28 to i1
  store i1 %29, ptr %2, align 1
  store i32 1, ptr %8, align 4
  br label %30

30:                                               ; preds = %27, %21
  call void @llvm.lifetime.end.p0(i64 1, ptr %4) #4
  %31 = load i1, ptr %2, align 1
  ret i1 %31

32:                                               ; preds = %23
  %33 = load ptr, ptr %6, align 8
  %34 = load i32, ptr %7, align 4
  %35 = insertvalue { ptr, i32 } poison, ptr %33, 0
  %36 = insertvalue { ptr, i32 } %35, i32 %34, 1
  resume { ptr, i32 } %36
}

declare noundef zeroext i1 @_ZNK6ngraph4Node10is_dynamicEv(ptr noundef nonnull align 8 dereferenceable(680)) unnamed_addr #2

declare noundef i64 @_ZNK6ngraph4Node14get_input_sizeEv(ptr noundef nonnull align 8 dereferenceable(680)) #2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN6ngraph7is_typeINS_2op2v08ConstantEPNS_4NodeEEENSt9enable_ifIXsr3std14is_convertibleIDTcldtclptclsr3stdE7declvalIT0_EE13get_type_infoE11is_castablesrT_9type_infoEEbEE5valueEbE4typeES7_(ptr noundef) #3

declare noundef ptr @_ZNK6ngraph6OutputINS_4NodeEE8get_nodeEv(ptr noundef nonnull align 8 dereferenceable(24)) #2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { "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 = { 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 #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)"}
!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 = !{!"bool", !7, i64 0}
!11 = !{i8 0, i8 2}
!12 = !{}


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

%"class.ngraph::Output" = type { %"class.std::shared_ptr.84", i64 }
%"class.std::shared_ptr.84" = type { %"class.std::__shared_ptr.85" }
%"class.std::__shared_ptr.85" = type { ptr, %"class.std::__shared_count" }
%"class.std::__shared_count" = type { ptr }

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

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN6ngraph6OutputINS_4NodeEED2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #1 align 2

declare void @_ZNK6ngraph4Node11input_valueEm(ptr dead_on_unwind writable sret(%"class.ngraph::Output") align 8, ptr noundef nonnull align 8 dereferenceable(680), i64 noundef) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZNK6ngraph2op2v123ConvolutionBackpropData10is_dynamicEv(ptr noundef nonnull align 8 dereferenceable(808) %0) unnamed_addr #3 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca %"class.ngraph::Output", align 8
  %3 = tail call noundef zeroext i1 @_ZNK6ngraph4Node10is_dynamicEv(ptr noundef nonnull align 8 dereferenceable(680) %0)
  %4 = tail call noundef i64 @_ZNK6ngraph4Node14get_input_sizeEv(ptr noundef nonnull align 8 dereferenceable(680) %0)
  %5 = icmp ne i64 %4, 3
  %brmerge = or i1 %3, %5
  br i1 %brmerge, label %14, label %6

6:                                                ; preds = %1
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %2) #4
  call void @_ZNK6ngraph4Node11input_valueEm(ptr dead_on_unwind nonnull writable sret(%"class.ngraph::Output") align 8 %2, ptr noundef nonnull align 8 dereferenceable(680) %0, i64 noundef 2)
  %7 = invoke noundef ptr @_ZNK6ngraph6OutputINS_4NodeEE8get_nodeEv(ptr noundef nonnull align 8 dereferenceable(24) %2)
          to label %8 unwind label %12

8:                                                ; preds = %6
  %9 = invoke noundef zeroext i1 @_ZN6ngraph7is_typeINS_2op2v08ConstantEPNS_4NodeEEENSt9enable_ifIXsr3std14is_convertibleIDTcldtclptclsr3stdE7declvalIT0_EE13get_type_infoE11is_castablesrT_9type_infoEEbEE5valueEbE4typeES7_(ptr noundef %7)
          to label %10 unwind label %12

10:                                               ; preds = %8
  %11 = xor i1 %9, true
  call void @_ZN6ngraph6OutputINS_4NodeEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %2) #4
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %2) #4
  br label %14

12:                                               ; preds = %8, %6
  %13 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN6ngraph6OutputINS_4NodeEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %2) #4
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %2) #4
  resume { ptr, i32 } %13

14:                                               ; preds = %1, %10
  %.0 = phi i1 [ %11, %10 ], [ %3, %1 ]
  ret i1 %.0
}

declare noundef zeroext i1 @_ZNK6ngraph4Node10is_dynamicEv(ptr noundef nonnull align 8 dereferenceable(680)) unnamed_addr #2

declare noundef i64 @_ZNK6ngraph4Node14get_input_sizeEv(ptr noundef nonnull align 8 dereferenceable(680)) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN6ngraph7is_typeINS_2op2v08ConstantEPNS_4NodeEEENSt9enable_ifIXsr3std14is_convertibleIDTcldtclptclsr3stdE7declvalIT0_EE13get_type_infoE11is_castablesrT_9type_infoEEbEE5valueEbE4typeES7_(ptr noundef) local_unnamed_addr #3

declare noundef ptr @_ZNK6ngraph6OutputINS_4NodeEE8get_nodeEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #2

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { "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 = { 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 #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: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass