; LLVM IR from AdaptiveCpp/AdaptiveCpp :: tests/pcuda/pcuda_test_suite.ll (ZN5boost9unit_test18progress_monitor_t12test_abortedEv)

; 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.boost::unit_test::utils::scope_setcolor" = type <{ ptr, i32, i8, [3 x i8] }>
%"struct.boost::unit_test::(anonymous namespace)::progress_monitor_impl" = type <{ ptr, %"class.boost::scoped_ptr", i8, [7 x i8] }>
%"class.boost::scoped_ptr" = type { ptr }

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN5boost9unit_test5utils14scope_setcolorC2EbRSoNS1_9term_attr1_ENS1_10term_color1_ES7_(ptr noundef nonnull align 8 dereferenceable(13), i1 noundef zeroext, ptr noundef nonnull align 8 dereferenceable(8), i32 noundef, i32 noundef, i32 noundef) unnamed_addr #1 align 2

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local void @_ZN5boost13ignore_unusedIJNS_9unit_test5utils14scope_setcolorEEEEvDpRKT_(ptr noundef nonnull align 8 dereferenceable(13)) #2

declare i32 @__gxx_personality_v0(...)

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

; 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
declare hidden noundef nonnull align 8 dereferenceable(17) ptr @_ZN5boost9unit_test12_GLOBAL__N_19s_pm_implEv() #1

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN5boost9unit_test18progress_monitor_t12test_abortedEv(ptr noundef nonnull align 8 dereferenceable(8) %0) unnamed_addr #1 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca ptr, align 8
  %3 = alloca %"struct.boost::unit_test::utils::scope_setcolor", align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  %6 = load ptr, ptr %2, align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr %3) #4
  %7 = call noundef nonnull align 8 dereferenceable(17) ptr @_ZN5boost9unit_test12_GLOBAL__N_19s_pm_implEv()
  %8 = getelementptr inbounds %"struct.boost::unit_test::(anonymous namespace)::progress_monitor_impl", ptr %7, i32 0, i32 2
  %9 = load i8, ptr %8, align 8, !tbaa !9, !range !13, !noundef !14
  %10 = trunc i8 %9 to i1
  %11 = call noundef nonnull align 8 dereferenceable(17) ptr @_ZN5boost9unit_test12_GLOBAL__N_19s_pm_implEv()
  %12 = getelementptr inbounds %"struct.boost::unit_test::(anonymous namespace)::progress_monitor_impl", ptr %11, i32 0, i32 0
  %13 = load ptr, ptr %12, align 8, !tbaa !15
  call void @_ZN5boost9unit_test5utils14scope_setcolorC2EbRSoNS1_9term_attr1_ENS1_10term_color1_ES7_(ptr noundef nonnull align 8 dereferenceable(13) %3, i1 noundef zeroext %10, ptr noundef nonnull align 8 dereferenceable(8) %13, i32 noundef 1, i32 noundef 5, i32 noundef 9)
  invoke void @_ZN5boost13ignore_unusedIJNS_9unit_test5utils14scope_setcolorEEEEvDpRKT_(ptr noundef nonnull align 8 dereferenceable(13) %3)
          to label %14 unwind label %27

14:                                               ; preds = %1
  %15 = invoke noundef nonnull align 8 dereferenceable(17) ptr @_ZN5boost9unit_test12_GLOBAL__N_19s_pm_implEv()
          to label %16 unwind label %27

16:                                               ; preds = %14
  %17 = getelementptr inbounds %"struct.boost::unit_test::(anonymous namespace)::progress_monitor_impl", ptr %15, i32 0, i32 1
  %18 = call noundef ptr @_ZNK5boost10scoped_ptrINS_9unit_test16progress_displayEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %17) #4
  %19 = invoke noundef i64 @_ZNK5boost9unit_test16progress_display5countEv(ptr noundef nonnull align 8 dereferenceable(36) %18)
          to label %20 unwind label %27

20:                                               ; preds = %16
  %21 = invoke noundef nonnull align 8 dereferenceable(17) ptr @_ZN5boost9unit_test12_GLOBAL__N_19s_pm_implEv()
          to label %22 unwind label %27

22:                                               ; preds = %20
  %23 = getelementptr inbounds %"struct.boost::unit_test::(anonymous namespace)::progress_monitor_impl", ptr %21, i32 0, i32 1
  %24 = call noundef nonnull align 8 dereferenceable(36) ptr @_ZNK5boost10scoped_ptrINS_9unit_test16progress_displayEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %23) #4
  %25 = invoke noundef i64 @_ZN5boost9unit_test16progress_displaypLEm(ptr noundef nonnull align 8 dereferenceable(36) %24, i64 noundef %19)
          to label %26 unwind label %27

26:                                               ; preds = %22
  call void @_ZN5boost9unit_test5utils14scope_setcolorD2Ev(ptr noundef nonnull align 8 dereferenceable(13) %3) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr %3) #4
  ret void

27:                                               ; preds = %22, %20, %16, %14, %1
  %28 = landingpad { ptr, i32 }
          cleanup
  %29 = extractvalue { ptr, i32 } %28, 0
  store ptr %29, ptr %4, align 8
  %30 = extractvalue { ptr, i32 } %28, 1
  store i32 %30, ptr %5, align 4
  call void @_ZN5boost9unit_test5utils14scope_setcolorD2Ev(ptr noundef nonnull align 8 dereferenceable(13) %3) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr %3) #4
  br label %31

31:                                               ; preds = %27
  %32 = load ptr, ptr %4, align 8
  %33 = load i32, ptr %5, align 4
  %34 = insertvalue { ptr, i32 } poison, ptr %32, 0
  %35 = insertvalue { ptr, i32 } %34, i32 %33, 1
  resume { ptr, i32 } %35
}

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(36) ptr @_ZNK5boost10scoped_ptrINS_9unit_test16progress_displayEEdeEv(ptr noundef nonnull align 8 dereferenceable(8)) #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_ZN5boost9unit_test16progress_displaypLEm(ptr noundef nonnull align 8 dereferenceable(36), i64 noundef) #1 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 = { alwaysinline 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 = { 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 = { 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, !12, i64 16}
!10 = !{!"_ZTSN5boost9unit_test12_GLOBAL__N_121progress_monitor_implE", !6, i64 0, !11, i64 8, !12, i64 16}
!11 = !{!"_ZTSN5boost10scoped_ptrINS_9unit_test16progress_displayEEE", !6, i64 0}
!12 = !{!"bool", !7, i64 0}
!13 = !{i8 0, i8 2}
!14 = !{}
!15 = !{!10, !6, i64 0}


; 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.boost::unit_test::utils::scope_setcolor" = type <{ ptr, i32, i8, [3 x i8] }>

; 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 uwtable
declare dso_local void @_ZN5boost9unit_test5utils14scope_setcolorC2EbRSoNS1_9term_attr1_ENS1_10term_color1_ES7_(ptr noundef nonnull align 8 dereferenceable(13), i1 noundef zeroext, ptr noundef nonnull align 8 dereferenceable(8), i32 noundef, i32 noundef, i32 noundef) unnamed_addr #1 align 2

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local void @_ZN5boost13ignore_unusedIJNS_9unit_test5utils14scope_setcolorEEEEvDpRKT_(ptr noundef nonnull align 8 dereferenceable(13)) local_unnamed_addr #2

declare i32 @__gxx_personality_v0(...)

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

; 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
declare hidden noundef nonnull align 8 dereferenceable(17) ptr @_ZN5boost9unit_test12_GLOBAL__N_19s_pm_implEv() local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN5boost9unit_test18progress_monitor_t12test_abortedEv(ptr nocapture noundef nonnull readnone align 8 dereferenceable(8) %0) unnamed_addr #1 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca %"struct.boost::unit_test::utils::scope_setcolor", align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %2) #4
  %3 = tail call noundef nonnull align 8 dereferenceable(17) ptr @_ZN5boost9unit_test12_GLOBAL__N_19s_pm_implEv()
  %4 = getelementptr inbounds i8, ptr %3, i64 16
  %5 = load i8, ptr %4, align 8, !tbaa !5, !range !12, !noundef !13
  %6 = trunc nuw i8 %5 to i1
  %7 = tail call noundef nonnull align 8 dereferenceable(17) ptr @_ZN5boost9unit_test12_GLOBAL__N_19s_pm_implEv()
  %8 = load ptr, ptr %7, align 8, !tbaa !14
  call void @_ZN5boost9unit_test5utils14scope_setcolorC2EbRSoNS1_9term_attr1_ENS1_10term_color1_ES7_(ptr noundef nonnull align 8 dereferenceable(13) %2, i1 noundef zeroext %6, ptr noundef nonnull align 8 dereferenceable(8) %8, i32 noundef 1, i32 noundef 5, i32 noundef 9)
  call void @_ZN5boost13ignore_unusedIJNS_9unit_test5utils14scope_setcolorEEEEvDpRKT_(ptr noundef nonnull align 8 dereferenceable(13) %2)
  %9 = invoke noundef nonnull align 8 dereferenceable(17) ptr @_ZN5boost9unit_test12_GLOBAL__N_19s_pm_implEv()
          to label %10 unwind label %20

10:                                               ; preds = %1
  %11 = getelementptr inbounds i8, ptr %9, i64 8
  %12 = call noundef ptr @_ZNK5boost10scoped_ptrINS_9unit_test16progress_displayEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %11) #4
  %13 = call noundef i64 @_ZNK5boost9unit_test16progress_display5countEv(ptr noundef nonnull align 8 dereferenceable(36) %12)
  %14 = invoke noundef nonnull align 8 dereferenceable(17) ptr @_ZN5boost9unit_test12_GLOBAL__N_19s_pm_implEv()
          to label %15 unwind label %20

15:                                               ; preds = %10
  %16 = getelementptr inbounds i8, ptr %14, i64 8
  %17 = call noundef nonnull align 8 dereferenceable(36) ptr @_ZNK5boost10scoped_ptrINS_9unit_test16progress_displayEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %16) #4
  %18 = invoke noundef i64 @_ZN5boost9unit_test16progress_displaypLEm(ptr noundef nonnull align 8 dereferenceable(36) %17, i64 noundef %13)
          to label %19 unwind label %20

19:                                               ; preds = %15
  call void @_ZN5boost9unit_test5utils14scope_setcolorD2Ev(ptr noundef nonnull align 8 dereferenceable(13) %2) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %2) #4
  ret void

20:                                               ; preds = %15, %10, %1
  %21 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN5boost9unit_test5utils14scope_setcolorD2Ev(ptr noundef nonnull align 8 dereferenceable(13) %2) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %2) #4
  resume { ptr, i32 } %21
}

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(36) ptr @_ZNK5boost10scoped_ptrINS_9unit_test16progress_displayEEdeEv(ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_ZN5boost9unit_test16progress_displaypLEm(ptr noundef nonnull align 8 dereferenceable(36), i64 noundef) local_unnamed_addr #1 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 = { alwaysinline 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 = { 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 = { 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, !11, i64 16}
!6 = !{!"_ZTSN5boost9unit_test12_GLOBAL__N_121progress_monitor_implE", !7, i64 0, !10, i64 8, !11, i64 16}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"_ZTSN5boost10scoped_ptrINS_9unit_test16progress_displayEEE", !7, i64 0}
!11 = !{!"bool", !8, i64 0}
!12 = !{i8 0, i8 2}
!13 = !{}
!14 = !{!6, !7, i64 0}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass