; LLVM IR from BitFunnel/NativeJIT :: src/CodeGen/X64CodeGenerator.ll (ZNK9NativeJIT16X64CodeGenerator20GetDiagnosticsStreamEv)

; 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.NativeJIT::X64CodeGenerator" = type { %"class.NativeJIT::CodeBuffer", ptr }
%"class.NativeJIT::CodeBuffer" = type { ptr, ptr, i32, ptr, ptr, ptr, %"class.NativeJIT::JumpTable" }
%"class.NativeJIT::JumpTable" = type { %"class.std::vector", %"class.std::vector.0" }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<const unsigned char *, std::allocator<const unsigned char *>>::_Vector_impl" }
%"struct.std::_Vector_base<const unsigned char *, std::allocator<const unsigned char *>>::_Vector_impl" = type { %"struct.std::_Vector_base<const unsigned char *, std::allocator<const unsigned char *>>::_Vector_impl_data" }
%"struct.std::_Vector_base<const unsigned char *, std::allocator<const unsigned char *>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.0" = type { %"struct.std::_Vector_base.1" }
%"struct.std::_Vector_base.1" = type { %"struct.std::_Vector_base<NativeJIT::CallSite, std::allocator<NativeJIT::CallSite>>::_Vector_impl" }
%"struct.std::_Vector_base<NativeJIT::CallSite, std::allocator<NativeJIT::CallSite>>::_Vector_impl" = type { %"struct.std::_Vector_base<NativeJIT::CallSite, std::allocator<NativeJIT::CallSite>>::_Vector_impl_data" }
%"struct.std::_Vector_base<NativeJIT::CallSite, std::allocator<NativeJIT::CallSite>>::_Vector_impl_data" = type { ptr, ptr, ptr }

@.str.36 = external hidden unnamed_addr constant [86 x i8], align 1
@__FUNCTION__._ZNK9NativeJIT16X64CodeGenerator20GetDiagnosticsStreamEv = external hidden unnamed_addr constant [21 x i8], align 1
@.str.57 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.58 = external hidden unnamed_addr constant [25 x i8], align 1

declare void @_ZN9NativeJIT12LogThrowImplEPKcS1_jS1_S1_z(ptr noundef, ptr noundef, i32 noundef, ptr noundef, ptr noundef, ...) #0

; Function Attrs: mustprogress uwtable
define dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNK9NativeJIT16X64CodeGenerator20GetDiagnosticsStreamEv(ptr noundef nonnull align 8 dereferenceable(104) %0) #1 align 2 {
  %2 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %3 = load ptr, ptr %2, align 8
  br label %4

4:                                                ; preds = %1
  %5 = getelementptr inbounds %"class.NativeJIT::X64CodeGenerator", ptr %3, i32 0, i32 1
  %6 = load ptr, ptr %5, align 8, !tbaa !9
  %7 = icmp ne ptr %6, null
  br i1 %7, label %9, label %8

8:                                                ; preds = %4
  call void (ptr, ptr, i32, ptr, ptr, ...) @_ZN9NativeJIT12LogThrowImplEPKcS1_jS1_S1_z(ptr noundef @.str.36, ptr noundef @__FUNCTION__._ZNK9NativeJIT16X64CodeGenerator20GetDiagnosticsStreamEv, i32 noundef 208, ptr noundef @.str.57, ptr noundef @.str.58)
  br label %9

9:                                                ; preds = %8, %4
  br label %10

10:                                               ; preds = %9
  %11 = getelementptr inbounds %"class.NativeJIT::X64CodeGenerator", ptr %3, i32 0, i32 1
  %12 = load ptr, ptr %11, align 8, !tbaa !9
  ret ptr %12
}

attributes #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 = { 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" }

!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, !6, i64 96}
!10 = !{!"_ZTSN9NativeJIT16X64CodeGeneratorE", !11, i64 0, !6, i64 96}
!11 = !{!"_ZTSN9NativeJIT10CodeBufferE", !6, i64 8, !12, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !13, i64 48}
!12 = !{!"int", !7, i64 0}
!13 = !{!"_ZTSN9NativeJIT9JumpTableE", !14, i64 0, !18, i64 24}
!14 = !{!"_ZTSSt6vectorIPKhSaIS1_EE", !15, i64 0}
!15 = !{!"_ZTSSt12_Vector_baseIPKhSaIS1_EE", !16, i64 0}
!16 = !{!"_ZTSNSt12_Vector_baseIPKhSaIS1_EE12_Vector_implE", !17, i64 0}
!17 = !{!"_ZTSNSt12_Vector_baseIPKhSaIS1_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!18 = !{!"_ZTSSt6vectorIN9NativeJIT8CallSiteESaIS1_EE", !19, i64 0}
!19 = !{!"_ZTSSt12_Vector_baseIN9NativeJIT8CallSiteESaIS1_EE", !20, i64 0}
!20 = !{!"_ZTSNSt12_Vector_baseIN9NativeJIT8CallSiteESaIS1_EE12_Vector_implE", !21, i64 0}
!21 = !{!"_ZTSNSt12_Vector_baseIN9NativeJIT8CallSiteESaIS1_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}


; 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.36 = external hidden unnamed_addr constant [86 x i8], align 1
@__FUNCTION__._ZNK9NativeJIT16X64CodeGenerator20GetDiagnosticsStreamEv = external hidden unnamed_addr constant [21 x i8], align 1
@.str.57 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.58 = external hidden unnamed_addr constant [25 x i8], align 1

declare void @_ZN9NativeJIT12LogThrowImplEPKcS1_jS1_S1_z(ptr noundef, ptr noundef, i32 noundef, ptr noundef, ptr noundef, ...) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
define dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNK9NativeJIT16X64CodeGenerator20GetDiagnosticsStreamEv(ptr nocapture noundef nonnull readonly align 8 dereferenceable(104) %0) local_unnamed_addr #1 align 2 {
  %2 = getelementptr inbounds i8, ptr %0, i64 96
  %3 = load ptr, ptr %2, align 8, !tbaa !5
  %.not = icmp eq ptr %3, null
  br i1 %.not, label %4, label %5

4:                                                ; preds = %1
  tail call void (ptr, ptr, i32, ptr, ptr, ...) @_ZN9NativeJIT12LogThrowImplEPKcS1_jS1_S1_z(ptr noundef nonnull @.str.36, ptr noundef nonnull @__FUNCTION__._ZNK9NativeJIT16X64CodeGenerator20GetDiagnosticsStreamEv, i32 noundef 208, ptr noundef nonnull @.str.57, ptr noundef nonnull @.str.58)
  %.pre = load ptr, ptr %2, align 8, !tbaa !5
  br label %5

5:                                                ; preds = %1, %4
  %6 = phi ptr [ %3, %1 ], [ %.pre, %4 ]
  ret ptr %6
}

attributes #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 = { 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" }

!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, !8, i64 96}
!6 = !{!"_ZTSN9NativeJIT16X64CodeGeneratorE", !7, i64 0, !8, i64 96}
!7 = !{!"_ZTSN9NativeJIT10CodeBufferE", !8, i64 8, !11, i64 16, !8, i64 24, !8, i64 32, !8, i64 40, !12, i64 48}
!8 = !{!"any pointer", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = !{!"int", !9, i64 0}
!12 = !{!"_ZTSN9NativeJIT9JumpTableE", !13, i64 0, !17, i64 24}
!13 = !{!"_ZTSSt6vectorIPKhSaIS1_EE", !14, i64 0}
!14 = !{!"_ZTSSt12_Vector_baseIPKhSaIS1_EE", !15, i64 0}
!15 = !{!"_ZTSNSt12_Vector_baseIPKhSaIS1_EE12_Vector_implE", !16, i64 0}
!16 = !{!"_ZTSNSt12_Vector_baseIPKhSaIS1_EE17_Vector_impl_dataE", !8, i64 0, !8, i64 8, !8, i64 16}
!17 = !{!"_ZTSSt6vectorIN9NativeJIT8CallSiteESaIS1_EE", !18, i64 0}
!18 = !{!"_ZTSSt12_Vector_baseIN9NativeJIT8CallSiteESaIS1_EE", !19, i64 0}
!19 = !{!"_ZTSNSt12_Vector_baseIN9NativeJIT8CallSiteESaIS1_EE12_Vector_implE", !20, i64 0}
!20 = !{!"_ZTSNSt12_Vector_baseIN9NativeJIT8CallSiteESaIS1_EE17_Vector_impl_dataE", !8, i64 0, !8, i64 8, !8, i64 16}


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