; LLVM IR from NervanaSystems/ngraph :: src/ngraph/pass (implicit_broadcast_elimination)

; 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.std::vector.72" = type { %"struct.std::_Vector_base.73" }
%"struct.std::_Vector_base.73" = type { %"struct.std::_Vector_base<ngraph::Output<Node>, std::allocator<ngraph::Output<Node>>>::_Vector_impl" }
%"struct.std::_Vector_base<ngraph::Output<Node>, std::allocator<ngraph::Output<Node>>>::_Vector_impl" = type { %"struct.std::_Vector_base<ngraph::Output<Node>, std::allocator<ngraph::Output<Node>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<ngraph::Output<Node>, std::allocator<ngraph::Output<Node>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.ngraph::Input" = type { ptr, i64 }
%"struct.ngraph::op::AutoBroadcastSpec" = type { i32, i64 }

; 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 noundef zeroext i1 @_ZN6ngraph4pass28ImplicitBroadcastElimination11run_on_nodeESt10shared_ptrINS_4NodeEE(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef %1) unnamed_addr #1 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca i1, align 1
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca %"class.std::vector.72", align 8
  %7 = alloca i64, align 8
  %8 = alloca %"class.ngraph::Input", align 8
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  %11 = load ptr, ptr %4, align 8
  %12 = call noundef ptr @_ZNKSt19__shared_ptr_accessIN6ngraph4NodeELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %1) #4
  %13 = load ptr, ptr %12, align 8, !tbaa !9
  %14 = getelementptr inbounds ptr, ptr %13, i64 10
  %15 = load ptr, ptr %14, align 8
  %16 = call noundef zeroext i1 %15(ptr noundef nonnull align 8 dereferenceable(680) %12)
  br i1 %16, label %17, label %53

17:                                               ; preds = %2
  %18 = call noundef ptr @_ZNKSt19__shared_ptr_accessIN6ngraph4NodeELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %1) #4
  %19 = load ptr, ptr %18, align 8, !tbaa !9
  %20 = getelementptr inbounds ptr, ptr %19, i64 11
  %21 = load ptr, ptr %20, align 8
  %22 = call noundef nonnull align 8 dereferenceable(16) ptr %21(ptr noundef nonnull align 8 dereferenceable(680) %18)
  %23 = getelementptr inbounds %"struct.ngraph::op::AutoBroadcastSpec", ptr %22, i32 0, i32 0
  %24 = load i32, ptr %23, align 8, !tbaa !11
  %25 = icmp ne i32 %24, 0
  br i1 %25, label %26, label %52

26:                                               ; preds = %17
  call void @llvm.lifetime.start.p0(i64 24, ptr %6) #4
  call void @_ZN6ngraph4pass18explicit_broadcastERSt10shared_ptrINS_4NodeEE(ptr dead_on_unwind writable sret(%"class.std::vector.72") align 8 %6, ptr noundef nonnull align 8 dereferenceable(16) %1)
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  store i64 0, ptr %7, align 8, !tbaa !15
  br label %27

27:                                               ; preds = %44, %26
  %28 = load i64, ptr %7, align 8, !tbaa !15
  %29 = call noundef i64 @_ZNKSt6vectorIN6ngraph6OutputINS0_4NodeEEESaIS3_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %6) #4
  %30 = icmp ult i64 %28, %29
  br i1 %30, label %32, label %31

31:                                               ; preds = %27
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  br label %51

32:                                               ; preds = %27
  call void @llvm.lifetime.start.p0(i64 16, ptr %8) #4
  %33 = call noundef ptr @_ZNKSt19__shared_ptr_accessIN6ngraph4NodeELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %1) #4
  %34 = load i64, ptr %7, align 8, !tbaa !15
  %35 = invoke { ptr, i64 } @_ZN6ngraph4Node5inputEm(ptr noundef nonnull align 8 dereferenceable(680) %33, i64 noundef %34)
          to label %36 unwind label %47

36:                                               ; preds = %32
  %37 = getelementptr inbounds { ptr, i64 }, ptr %8, i32 0, i32 0
  %38 = extractvalue { ptr, i64 } %35, 0
  store ptr %38, ptr %37, align 8
  %39 = getelementptr inbounds { ptr, i64 }, ptr %8, i32 0, i32 1
  %40 = extractvalue { ptr, i64 } %35, 1
  store i64 %40, ptr %39, align 8
  %41 = load i64, ptr %7, align 8, !tbaa !15
  %42 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIN6ngraph6OutputINS0_4NodeEEESaIS3_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %6, i64 noundef %41) #4
  invoke void @_ZNK6ngraph5InputINS_4NodeEE21replace_source_outputERKNS_6OutputIS1_EE(ptr noundef nonnull align 8 dereferenceable(16) %8, ptr noundef nonnull align 8 dereferenceable(24) %42)
          to label %43 unwind label %47

43:                                               ; preds = %36
  call void @llvm.lifetime.end.p0(i64 16, ptr %8) #4
  br label %44

44:                                               ; preds = %43
  %45 = load i64, ptr %7, align 8, !tbaa !15
  %46 = add i64 %45, 1
  store i64 %46, ptr %7, align 8, !tbaa !15
  br label %27, !llvm.loop !16

47:                                               ; preds = %36, %32
  %48 = landingpad { ptr, i32 }
          cleanup
  %49 = extractvalue { ptr, i32 } %48, 0
  store ptr %49, ptr %9, align 8
  %50 = extractvalue { ptr, i32 } %48, 1
  store i32 %50, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 16, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  call void @_ZNSt6vectorIN6ngraph6OutputINS0_4NodeEEESaIS3_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %6) #4
  call void @llvm.lifetime.end.p0(i64 24, ptr %6) #4
  br label %56

51:                                               ; preds = %31
  store i1 true, ptr %3, align 1
  call void @_ZNSt6vectorIN6ngraph6OutputINS0_4NodeEEESaIS3_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %6) #4
  call void @llvm.lifetime.end.p0(i64 24, ptr %6) #4
  br label %54

52:                                               ; preds = %17
  br label %53

53:                                               ; preds = %52, %2
  store i1 false, ptr %3, align 1
  br label %54

54:                                               ; preds = %53, %51
  %55 = load i1, ptr %3, align 1
  ret i1 %55

56:                                               ; preds = %47
  %57 = load ptr, ptr %9, align 8
  %58 = load i32, ptr %10, align 4
  %59 = insertvalue { ptr, i32 } poison, ptr %57, 0
  %60 = insertvalue { ptr, i32 } %59, i32 %58, 1
  resume { ptr, i32 } %60
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNKSt19__shared_ptr_accessIN6ngraph4NodeELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1)) #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6ngraph4pass18explicit_broadcastERSt10shared_ptrINS_4NodeEE(ptr dead_on_unwind noalias writable sret(%"class.std::vector.72") align 8, ptr noundef nonnull align 8 dereferenceable(16)) #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorIN6ngraph6OutputINS0_4NodeEEESaIS3_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) #2 align 2

declare { ptr, i64 } @_ZN6ngraph4Node5inputEm(ptr noundef nonnull align 8 dereferenceable(680), i64 noundef) #3

declare i32 @__gxx_personality_v0(...)

declare void @_ZNK6ngraph5InputINS_4NodeEE21replace_source_outputERKNS_6OutputIS1_EE(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(24)) #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIN6ngraph6OutputINS0_4NodeEEESaIS3_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIN6ngraph6OutputINS0_4NodeEEESaIS3_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #2 align 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 = { 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)"}
!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 = !{!"vtable pointer", !8, i64 0}
!11 = !{!12, !13, i64 0}
!12 = !{!"_ZTSN6ngraph2op17AutoBroadcastSpecE", !13, i64 0, !14, i64 8}
!13 = !{!"_ZTSN6ngraph2op17AutoBroadcastTypeE", !7, i64 0}
!14 = !{!"long", !7, i64 0}
!15 = !{!14, !14, i64 0}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}


; 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.std::vector.72" = type { %"struct.std::_Vector_base.73" }
%"struct.std::_Vector_base.73" = type { %"struct.std::_Vector_base<ngraph::Output<Node>, std::allocator<ngraph::Output<Node>>>::_Vector_impl" }
%"struct.std::_Vector_base<ngraph::Output<Node>, std::allocator<ngraph::Output<Node>>>::_Vector_impl" = type { %"struct.std::_Vector_base<ngraph::Output<Node>, std::allocator<ngraph::Output<Node>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<ngraph::Output<Node>, std::allocator<ngraph::Output<Node>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.ngraph::Input" = type { ptr, i64 }

; 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 zeroext i1 @_ZN6ngraph4pass28ImplicitBroadcastElimination11run_on_nodeESt10shared_ptrINS_4NodeEE(ptr nocapture noundef nonnull readnone align 8 dereferenceable(24) %0, ptr noundef nonnull %1) unnamed_addr #1 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca %"class.std::vector.72", align 8
  %4 = alloca %"class.ngraph::Input", align 8
  %5 = tail call noundef ptr @_ZNKSt19__shared_ptr_accessIN6ngraph4NodeELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %1) #4
  %6 = load ptr, ptr %5, align 8, !tbaa !5
  %7 = getelementptr inbounds i8, ptr %6, i64 80
  %8 = load ptr, ptr %7, align 8
  %9 = tail call noundef zeroext i1 %8(ptr noundef nonnull align 8 dereferenceable(680) %5)
  br i1 %9, label %10, label %33

10:                                               ; preds = %2
  %11 = tail call noundef ptr @_ZNKSt19__shared_ptr_accessIN6ngraph4NodeELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %1) #4
  %12 = load ptr, ptr %11, align 8, !tbaa !5
  %13 = getelementptr inbounds i8, ptr %12, i64 88
  %14 = load ptr, ptr %13, align 8
  %15 = tail call noundef nonnull align 8 dereferenceable(16) ptr %14(ptr noundef nonnull align 8 dereferenceable(680) %11)
  %16 = load i32, ptr %15, align 8, !tbaa !8
  %.not = icmp eq i32 %16, 0
  br i1 %.not, label %33, label %17

17:                                               ; preds = %10
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %3) #4
  call void @_ZN6ngraph4pass18explicit_broadcastERSt10shared_ptrINS_4NodeEE(ptr dead_on_unwind nonnull writable sret(%"class.std::vector.72") align 8 %3, ptr noundef nonnull align 8 dereferenceable(16) %1)
  %18 = call noundef i64 @_ZNKSt6vectorIN6ngraph6OutputINS0_4NodeEEESaIS3_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %3) #4
  %.not9 = icmp eq i64 %18, 0
  br i1 %.not9, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %17
  %19 = getelementptr inbounds i8, ptr %4, i64 8
  br label %20

._crit_edge:                                      ; preds = %27, %17
  call void @_ZNSt6vectorIN6ngraph6OutputINS0_4NodeEEESaIS3_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %3) #4
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %3) #4
  br label %33

20:                                               ; preds = %.lr.ph, %27
  %.078 = phi i64 [ 0, %.lr.ph ], [ %28, %27 ]
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %4) #4
  %21 = call noundef ptr @_ZNKSt19__shared_ptr_accessIN6ngraph4NodeELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %1) #4
  %22 = invoke { ptr, i64 } @_ZN6ngraph4Node5inputEm(ptr noundef nonnull align 8 dereferenceable(680) %21, i64 noundef %.078)
          to label %23 unwind label %31

23:                                               ; preds = %20
  %24 = extractvalue { ptr, i64 } %22, 0
  store ptr %24, ptr %4, align 8
  %25 = extractvalue { ptr, i64 } %22, 1
  store i64 %25, ptr %19, align 8
  %26 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIN6ngraph6OutputINS0_4NodeEEESaIS3_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %3, i64 noundef %.078) #4
  invoke void @_ZNK6ngraph5InputINS_4NodeEE21replace_source_outputERKNS_6OutputIS1_EE(ptr noundef nonnull align 8 dereferenceable(16) %4, ptr noundef nonnull align 8 dereferenceable(24) %26)
          to label %27 unwind label %31

27:                                               ; preds = %23
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #4
  %28 = add nuw i64 %.078, 1
  %29 = call noundef i64 @_ZNKSt6vectorIN6ngraph6OutputINS0_4NodeEEESaIS3_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %3) #4
  %30 = icmp ult i64 %28, %29
  br i1 %30, label %20, label %._crit_edge, !llvm.loop !13

31:                                               ; preds = %23, %20
  %32 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #4
  call void @_ZNSt6vectorIN6ngraph6OutputINS0_4NodeEEESaIS3_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %3) #4
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %3) #4
  resume { ptr, i32 } %32

33:                                               ; preds = %2, %10, %._crit_edge
  %.0 = phi i1 [ true, %._crit_edge ], [ false, %10 ], [ false, %2 ]
  ret i1 %.0
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNKSt19__shared_ptr_accessIN6ngraph4NodeELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6ngraph4pass18explicit_broadcastERSt10shared_ptrINS_4NodeEE(ptr dead_on_unwind noalias writable sret(%"class.std::vector.72") align 8, ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorIN6ngraph6OutputINS0_4NodeEEESaIS3_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #2 align 2

declare { ptr, i64 } @_ZN6ngraph4Node5inputEm(ptr noundef nonnull align 8 dereferenceable(680), i64 noundef) local_unnamed_addr #3

declare i32 @__gxx_personality_v0(...)

declare void @_ZNK6ngraph5InputINS_4NodeEE21replace_source_outputERKNS_6OutputIS1_EE(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIN6ngraph6OutputINS0_4NodeEEESaIS3_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #2 align 2

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

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 = { 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)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !10, i64 0}
!9 = !{!"_ZTSN6ngraph2op17AutoBroadcastSpecE", !10, i64 0, !12, i64 8}
!10 = !{!"_ZTSN6ngraph2op17AutoBroadcastTypeE", !11, i64 0}
!11 = !{!"omnipotent char", !7, i64 0}
!12 = !{!"long", !11, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass