; LLVM IR from NVIDIA/DALI :: dali/pipeline/executor (source_info_propagation)

; 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.dali::CPUBackend" = type { i8 }
%"class.dali::GPUBackend" = type { i8 }

@.str = external hidden unnamed_addr constant [31 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [95 x i8], align 1
@__PRETTY_FUNCTION__._ZN4dali21ClearOutputSourceInfoERNS_9WorkspaceE = external hidden unnamed_addr constant [46 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4dali21ClearOutputSourceInfoERNS_9WorkspaceE(ptr noundef nonnull align 8 dereferenceable(664) %0) #0 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  %4 = alloca %"class.dali::CPUBackend", align 1
  %5 = alloca %"class.dali::GPUBackend", align 1
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #4
  store i32 0, ptr %3, align 4, !tbaa !9
  br label %6

6:                                                ; preds = %32, %1
  %7 = load i32, ptr %3, align 4, !tbaa !9
  %8 = load ptr, ptr %2, align 8, !tbaa !5
  %9 = call noundef i32 @_ZNK4dali13WorkspaceBaseINS_10TensorListESt10shared_ptrE9NumOutputEv(ptr noundef nonnull align 8 dereferenceable(664) %8)
  %10 = icmp slt i32 %7, %9
  br i1 %10, label %12, label %11

11:                                               ; preds = %6
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #4
  br label %35

12:                                               ; preds = %6
  %13 = load ptr, ptr %2, align 8, !tbaa !5
  %14 = load i32, ptr %3, align 4, !tbaa !9
  %15 = call noundef zeroext i1 @_ZNK4dali13WorkspaceBaseINS_10TensorListESt10shared_ptrE12OutputIsTypeINS_10CPUBackendEEEbi(ptr noundef nonnull align 8 dereferenceable(664) %13, i32 noundef %14)
  br i1 %15, label %16, label %20

16:                                               ; preds = %12
  %17 = load ptr, ptr %2, align 8, !tbaa !5
  %18 = load i32, ptr %3, align 4, !tbaa !9
  %19 = call noundef nonnull align 8 dereferenceable(304) ptr @_ZNK4dali13WorkspaceBaseINS_10TensorListESt10shared_ptrE6OutputINS_10CPUBackendEEERDaiT_(ptr noundef nonnull align 8 dereferenceable(664) %17, i32 noundef %18)
  call void @_ZN4dali12_GLOBAL__N_115ClearSourceInfoINS_10CPUBackendEEEvRNS_10TensorListIT_EE(ptr noundef nonnull align 8 dereferenceable(304) %19)
  br label %31

20:                                               ; preds = %12
  %21 = load ptr, ptr %2, align 8, !tbaa !5
  %22 = load i32, ptr %3, align 4, !tbaa !9
  %23 = call noundef zeroext i1 @_ZNK4dali13WorkspaceBaseINS_10TensorListESt10shared_ptrE12OutputIsTypeINS_10GPUBackendEEEbi(ptr noundef nonnull align 8 dereferenceable(664) %21, i32 noundef %22)
  br i1 %23, label %24, label %25

24:                                               ; preds = %20
  br label %27

25:                                               ; preds = %20
  call void @__assert_fail(ptr noundef @.str, ptr noundef @.str.1, i32 noundef 72, ptr noundef @__PRETTY_FUNCTION__._ZN4dali21ClearOutputSourceInfoERNS_9WorkspaceE) #5
  unreachable

26:                                               ; No predecessors!
  br label %27

27:                                               ; preds = %26, %24
  %28 = load ptr, ptr %2, align 8, !tbaa !5
  %29 = load i32, ptr %3, align 4, !tbaa !9
  %30 = call noundef nonnull align 8 dereferenceable(304) ptr @_ZNK4dali13WorkspaceBaseINS_10TensorListESt10shared_ptrE6OutputINS_10GPUBackendEEERDaiT_(ptr noundef nonnull align 8 dereferenceable(664) %28, i32 noundef %29)
  call void @_ZN4dali12_GLOBAL__N_115ClearSourceInfoINS_10GPUBackendEEEvRNS_10TensorListIT_EE(ptr noundef nonnull align 8 dereferenceable(304) %30)
  br label %31

31:                                               ; preds = %27, %16
  br label %32

32:                                               ; preds = %31
  %33 = load i32, ptr %3, align 4, !tbaa !9
  %34 = add nsw i32 %33, 1
  store i32 %34, ptr %3, align 4, !tbaa !9
  br label %6, !llvm.loop !11

35:                                               ; preds = %11
  ret void
}

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_ZNK4dali13WorkspaceBaseINS_10TensorListESt10shared_ptrE9NumOutputEv(ptr noundef nonnull align 8 dereferenceable(664)) #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZNK4dali13WorkspaceBaseINS_10TensorListESt10shared_ptrE12OutputIsTypeINS_10CPUBackendEEEbi(ptr noundef nonnull align 8 dereferenceable(664), i32 noundef) #0 align 2

; Function Attrs: mustprogress uwtable
declare hidden void @_ZN4dali12_GLOBAL__N_115ClearSourceInfoINS_10CPUBackendEEEvRNS_10TensorListIT_EE(ptr noundef nonnull align 8 dereferenceable(304)) #0

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(304) ptr @_ZNK4dali13WorkspaceBaseINS_10TensorListESt10shared_ptrE6OutputINS_10CPUBackendEEERDaiT_(ptr noundef nonnull align 8 dereferenceable(664), i32 noundef) #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZNK4dali13WorkspaceBaseINS_10TensorListESt10shared_ptrE12OutputIsTypeINS_10GPUBackendEEEbi(ptr noundef nonnull align 8 dereferenceable(664), i32 noundef) #0 align 2

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #3

; Function Attrs: mustprogress uwtable
declare hidden void @_ZN4dali12_GLOBAL__N_115ClearSourceInfoINS_10GPUBackendEEEvRNS_10TensorListIT_EE(ptr noundef nonnull align 8 dereferenceable(304)) #0

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(304) ptr @_ZNK4dali13WorkspaceBaseINS_10TensorListESt10shared_ptrE6OutputINS_10GPUBackendEEERDaiT_(ptr noundef nonnull align 8 dereferenceable(664), i32 noundef) #0 align 2

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { inlinehint 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 = { noreturn nounwind "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 }
attributes #5 = { noreturn 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 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"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"

@.str = external hidden unnamed_addr constant [31 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [95 x i8], align 1
@__PRETTY_FUNCTION__._ZN4dali21ClearOutputSourceInfoERNS_9WorkspaceE = external hidden unnamed_addr constant [46 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4dali21ClearOutputSourceInfoERNS_9WorkspaceE(ptr noundef nonnull align 8 dereferenceable(664) %0) local_unnamed_addr #0 {
  %2 = tail call noundef i32 @_ZNK4dali13WorkspaceBaseINS_10TensorListESt10shared_ptrE9NumOutputEv(ptr noundef nonnull align 8 dereferenceable(664) %0)
  %3 = icmp sgt i32 %2, 0
  br i1 %3, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %12, %1
  ret void

.lr.ph:                                           ; preds = %1, %12
  %.010 = phi i32 [ %13, %12 ], [ 0, %1 ]
  %4 = tail call noundef zeroext i1 @_ZNK4dali13WorkspaceBaseINS_10TensorListESt10shared_ptrE12OutputIsTypeINS_10CPUBackendEEEbi(ptr noundef nonnull align 8 dereferenceable(664) %0, i32 noundef %.010)
  br i1 %4, label %5, label %7

5:                                                ; preds = %.lr.ph
  %6 = tail call noundef nonnull align 8 dereferenceable(304) ptr @_ZNK4dali13WorkspaceBaseINS_10TensorListESt10shared_ptrE6OutputINS_10CPUBackendEEERDaiT_(ptr noundef nonnull align 8 dereferenceable(664) %0, i32 noundef %.010)
  tail call void @_ZN4dali12_GLOBAL__N_115ClearSourceInfoINS_10CPUBackendEEEvRNS_10TensorListIT_EE(ptr noundef nonnull align 8 dereferenceable(304) %6)
  br label %12

7:                                                ; preds = %.lr.ph
  %8 = tail call noundef zeroext i1 @_ZNK4dali13WorkspaceBaseINS_10TensorListESt10shared_ptrE12OutputIsTypeINS_10GPUBackendEEEbi(ptr noundef nonnull align 8 dereferenceable(664) %0, i32 noundef %.010)
  br i1 %8, label %10, label %9

9:                                                ; preds = %7
  tail call void @__assert_fail(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 72, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN4dali21ClearOutputSourceInfoERNS_9WorkspaceE) #3
  unreachable

10:                                               ; preds = %7
  %11 = tail call noundef nonnull align 8 dereferenceable(304) ptr @_ZNK4dali13WorkspaceBaseINS_10TensorListESt10shared_ptrE6OutputINS_10GPUBackendEEERDaiT_(ptr noundef nonnull align 8 dereferenceable(664) %0, i32 noundef %.010)
  tail call void @_ZN4dali12_GLOBAL__N_115ClearSourceInfoINS_10GPUBackendEEEvRNS_10TensorListIT_EE(ptr noundef nonnull align 8 dereferenceable(304) %11)
  br label %12

12:                                               ; preds = %5, %10
  %13 = add nuw nsw i32 %.010, 1
  %14 = tail call noundef i32 @_ZNK4dali13WorkspaceBaseINS_10TensorListESt10shared_ptrE9NumOutputEv(ptr noundef nonnull align 8 dereferenceable(664) %0)
  %15 = icmp slt i32 %13, %14
  br i1 %15, label %.lr.ph, label %._crit_edge, !llvm.loop !5
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_ZNK4dali13WorkspaceBaseINS_10TensorListESt10shared_ptrE9NumOutputEv(ptr noundef nonnull align 8 dereferenceable(664)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZNK4dali13WorkspaceBaseINS_10TensorListESt10shared_ptrE12OutputIsTypeINS_10CPUBackendEEEbi(ptr noundef nonnull align 8 dereferenceable(664), i32 noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare hidden void @_ZN4dali12_GLOBAL__N_115ClearSourceInfoINS_10CPUBackendEEEvRNS_10TensorListIT_EE(ptr noundef nonnull align 8 dereferenceable(304)) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(304) ptr @_ZNK4dali13WorkspaceBaseINS_10TensorListESt10shared_ptrE6OutputINS_10CPUBackendEEERDaiT_(ptr noundef nonnull align 8 dereferenceable(664), i32 noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZNK4dali13WorkspaceBaseINS_10TensorListESt10shared_ptrE12OutputIsTypeINS_10GPUBackendEEEbi(ptr noundef nonnull align 8 dereferenceable(664), i32 noundef) local_unnamed_addr #0 align 2

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
declare hidden void @_ZN4dali12_GLOBAL__N_115ClearSourceInfoINS_10GPUBackendEEEvRNS_10TensorListIT_EE(ptr noundef nonnull align 8 dereferenceable(304)) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(304) ptr @_ZNK4dali13WorkspaceBaseINS_10TensorListESt10shared_ptrE6OutputINS_10GPUBackendEEERDaiT_(ptr noundef nonnull align 8 dereferenceable(664), i32 noundef) local_unnamed_addr #0 align 2

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 = { inlinehint 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 = { noreturn nounwind "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 = { noreturn 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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}


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