; LLVM IR from jrouwe/JoltPhysics :: TestFramework/Renderer/Font.ll (ZN4FontC2EP8Renderer)

; 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.Font = type { %"class.JPH::RefTarget", %"class.std::__cxx11::basic_string", i32, i32, i32, [224 x i16], [224 x i16], [224 x i8], [224 x [224 x i8]], ptr, %"class.JPH::Ref", %"class.std::unique_ptr" }
%"class.JPH::RefTarget" = type { %"struct.std::atomic" }
%"struct.std::atomic" = type { %"struct.std::__atomic_base" }
%"struct.std::__atomic_base" = type { i32 }
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char, std::char_traits<char>, JPH::STLAllocator<char>>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char, std::char_traits<char>, JPH::STLAllocator<char>>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"class.JPH::Ref" = type { ptr }
%"class.std::unique_ptr" = type { %"struct.std::__uniq_ptr_data" }
%"struct.std::__uniq_ptr_data" = type { %"class.std::__uniq_ptr_impl" }
%"class.std::__uniq_ptr_impl" = type { %"class.std::tuple" }
%"class.std::tuple" = type { %"struct.std::_Tuple_impl" }
%"struct.std::_Tuple_impl" = type { %"struct.std::_Head_base.1" }
%"struct.std::_Head_base.1" = type { ptr }

declare i32 @__gxx_personality_v0(...)

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #0

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4FontC2EP8Renderer(ptr noundef nonnull align 8 dereferenceable(51376) %0, ptr noundef %1) unnamed_addr #1 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %7 = load ptr, ptr %3, align 8
  call void @_ZN3JPH9RefTargetI4FontEC2Ev(ptr noundef nonnull align 4 dereferenceable(4) %7) #4
  %8 = getelementptr inbounds %class.Font, ptr %7, i32 0, i32 1
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcEN3JPH12STLAllocatorIcEEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %8) #4
  %9 = getelementptr inbounds %class.Font, ptr %7, i32 0, i32 5
  %10 = getelementptr inbounds i16, ptr %9, i64 224
  br label %11

11:                                               ; preds = %11, %2
  %12 = phi ptr [ %9, %2 ], [ %13, %11 ]
  store i16 0, ptr %12, align 2, !tbaa !9
  %13 = getelementptr inbounds i16, ptr %12, i64 1
  %14 = icmp eq ptr %13, %10
  br i1 %14, label %15, label %11

15:                                               ; preds = %11
  %16 = getelementptr inbounds %class.Font, ptr %7, i32 0, i32 6
  %17 = getelementptr inbounds i16, ptr %16, i64 224
  br label %18

18:                                               ; preds = %18, %15
  %19 = phi ptr [ %16, %15 ], [ %20, %18 ]
  store i16 0, ptr %19, align 2, !tbaa !9
  %20 = getelementptr inbounds i16, ptr %19, i64 1
  %21 = icmp eq ptr %20, %17
  br i1 %21, label %22, label %18

22:                                               ; preds = %18
  %23 = getelementptr inbounds %class.Font, ptr %7, i32 0, i32 7
  %24 = getelementptr inbounds i8, ptr %23, i64 224
  br label %25

25:                                               ; preds = %25, %22
  %26 = phi ptr [ %23, %22 ], [ %27, %25 ]
  store i8 0, ptr %26, align 1, !tbaa !11
  %27 = getelementptr inbounds i8, ptr %26, i64 1
  %28 = icmp eq ptr %27, %24
  br i1 %28, label %29, label %25

29:                                               ; preds = %25
  %30 = getelementptr inbounds %class.Font, ptr %7, i32 0, i32 8
  %31 = getelementptr inbounds [224 x i8], ptr %30, i64 224
  br label %32

32:                                               ; preds = %32, %29
  %33 = phi ptr [ %30, %29 ], [ %34, %32 ]
  call void @llvm.memset.p0.i64(ptr align 4 %33, i8 0, i64 224, i1 false)
  %34 = getelementptr inbounds [224 x i8], ptr %33, i64 1
  %35 = icmp eq ptr %34, %31
  br i1 %35, label %36, label %32

36:                                               ; preds = %32
  %37 = getelementptr inbounds %class.Font, ptr %7, i32 0, i32 9
  %38 = load ptr, ptr %4, align 8, !tbaa !5
  store ptr %38, ptr %37, align 8, !tbaa !12
  %39 = getelementptr inbounds %class.Font, ptr %7, i32 0, i32 10
  invoke void @_ZN3JPH3RefI7TextureEC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %39)
          to label %40 unwind label %42

40:                                               ; preds = %36
  %41 = getelementptr inbounds %class.Font, ptr %7, i32 0, i32 11
  call void @_ZNSt10unique_ptrI13PipelineStateSt14default_deleteIS0_EEC2IS2_vEEv(ptr noundef nonnull align 8 dereferenceable(8) %41) #4
  ret void

42:                                               ; preds = %36
  %43 = landingpad { ptr, i32 }
          cleanup
  %44 = extractvalue { ptr, i32 } %43, 0
  store ptr %44, ptr %5, align 8
  %45 = extractvalue { ptr, i32 } %43, 1
  store i32 %45, ptr %6, align 4
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcEN3JPH12STLAllocatorIcEEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %8) #4
  call void @_ZN3JPH9RefTargetI4FontED2Ev(ptr noundef nonnull align 4 dereferenceable(4) %7) #4
  br label %46

46:                                               ; preds = %42
  %47 = load ptr, ptr %5, align 8
  %48 = load i32, ptr %6, align 4
  %49 = insertvalue { ptr, i32 } poison, ptr %47, 0
  %50 = insertvalue { ptr, i32 } %49, i32 %48, 1
  resume { ptr, i32 } %50
}

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

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

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

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

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

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

attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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 = { 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, !10, i64 0}
!10 = !{!"short", !7, i64 0}
!11 = !{!7, !7, i64 0}
!12 = !{!13, !6, i64 51352}
!13 = !{!"_ZTS4Font", !14, i64 0, !18, i64 8, !17, i64 40, !17, i64 44, !17, i64 48, !7, i64 52, !7, i64 500, !7, i64 948, !7, i64 1172, !6, i64 51352, !21, i64 51360, !22, i64 51368}
!14 = !{!"_ZTSN3JPH9RefTargetI4FontEE", !15, i64 0}
!15 = !{!"_ZTSSt6atomicIjE", !16, i64 0}
!16 = !{!"_ZTSSt13__atomic_baseIjE", !17, i64 0}
!17 = !{!"int", !7, i64 0}
!18 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcEN3JPH12STLAllocatorIcEEEE", !19, i64 0, !20, i64 8, !7, i64 16}
!19 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcEN3JPH12STLAllocatorIcEEE12_Alloc_hiderE", !6, i64 0}
!20 = !{!"long", !7, i64 0}
!21 = !{!"_ZTSN3JPH3RefI7TextureEE", !6, i64 0}
!22 = !{!"_ZTSSt10unique_ptrI13PipelineStateSt14default_deleteIS0_EE", !23, i64 0}
!23 = !{!"_ZTSSt15__uniq_ptr_dataI13PipelineStateSt14default_deleteIS0_ELb1ELb1EE", !24, i64 0}
!24 = !{!"_ZTSSt15__uniq_ptr_implI13PipelineStateSt14default_deleteIS0_EE", !25, i64 0}
!25 = !{!"_ZTSSt5tupleIJP13PipelineStateSt14default_deleteIS0_EEE", !26, i64 0}
!26 = !{!"_ZTSSt11_Tuple_implILm0EJP13PipelineStateSt14default_deleteIS0_EEE", !27, i64 0}
!27 = !{!"_ZTSSt10_Head_baseILm0EP13PipelineStateLb0EE", !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"

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #0

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN4FontC2EP8Renderer(ptr noundef nonnull align 8 dereferenceable(51376) %0, ptr noundef %1) unnamed_addr #1 align 2 personality ptr @__gxx_personality_v0 {
.preheader20.preheader:
  tail call void @_ZN3JPH9RefTargetI4FontEC2Ev(ptr noundef nonnull align 4 dereferenceable(4) %0) #3
  %2 = getelementptr inbounds i8, ptr %0, i64 8
  tail call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcEN3JPH12STLAllocatorIcEEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %2) #3
  %scevgep = getelementptr inbounds i8, ptr %0, i64 52
  %3 = getelementptr inbounds i8, ptr %0, i64 51352
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(51296) %scevgep, i8 0, i64 51296, i1 false)
  store ptr %1, ptr %3, align 8, !tbaa !5
  %4 = getelementptr inbounds i8, ptr %0, i64 51360
  tail call void @_ZN3JPH3RefI7TextureEC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %4)
  %5 = getelementptr inbounds i8, ptr %0, i64 51368
  tail call void @_ZNSt10unique_ptrI13PipelineStateSt14default_deleteIS0_EEC2IS2_vEEv(ptr noundef nonnull align 8 dereferenceable(8) %5) #3
  ret void
}

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

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

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

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

attributes #0 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #1 = { 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 = { 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 = { 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, !15, i64 51352}
!6 = !{!"_ZTS4Font", !7, i64 0, !13, i64 8, !10, i64 40, !10, i64 44, !10, i64 48, !11, i64 52, !11, i64 500, !11, i64 948, !11, i64 1172, !15, i64 51352, !17, i64 51360, !18, i64 51368}
!7 = !{!"_ZTSN3JPH9RefTargetI4FontEE", !8, i64 0}
!8 = !{!"_ZTSSt6atomicIjE", !9, i64 0}
!9 = !{!"_ZTSSt13__atomic_baseIjE", !10, i64 0}
!10 = !{!"int", !11, i64 0}
!11 = !{!"omnipotent char", !12, i64 0}
!12 = !{!"Simple C++ TBAA"}
!13 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcEN3JPH12STLAllocatorIcEEEE", !14, i64 0, !16, i64 8, !11, i64 16}
!14 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcEN3JPH12STLAllocatorIcEEE12_Alloc_hiderE", !15, i64 0}
!15 = !{!"any pointer", !11, i64 0}
!16 = !{!"long", !11, i64 0}
!17 = !{!"_ZTSN3JPH3RefI7TextureEE", !15, i64 0}
!18 = !{!"_ZTSSt10unique_ptrI13PipelineStateSt14default_deleteIS0_EE", !19, i64 0}
!19 = !{!"_ZTSSt15__uniq_ptr_dataI13PipelineStateSt14default_deleteIS0_ELb1ELb1EE", !20, i64 0}
!20 = !{!"_ZTSSt15__uniq_ptr_implI13PipelineStateSt14default_deleteIS0_EE", !21, i64 0}
!21 = !{!"_ZTSSt5tupleIJP13PipelineStateSt14default_deleteIS0_EEE", !22, i64 0}
!22 = !{!"_ZTSSt11_Tuple_implILm0EJP13PipelineStateSt14default_deleteIS0_EEE", !23, i64 0}
!23 = !{!"_ZTSSt10_Head_baseILm0EP13PipelineStateLb0EE", !15, i64 0}


; Effective O3 passes: GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,LoopIdiomRecognizePass,LoopSimplifyPass,MemCpyOptPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass