; LLVM IR from alibaba/BladeDISC :: tao_compiler/mlir/ral (ral_api)

; 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.anon.19 = type { i8 }
%"struct.tao::ral::internal::Voidifier" = type { i8 }
%"class.tao::ral::internal::LogMessage" = type { %"class.std::__cxx11::basic_ostringstream.base", ptr, i32, i32, %"class.std::basic_ios" }
%"class.std::__cxx11::basic_ostringstream.base" = type { %"class.std::basic_ostream.base", %"class.std::__cxx11::basic_stringbuf" }
%"class.std::basic_ostream.base" = type { ptr }
%"class.std::__cxx11::basic_stringbuf" = type { %"class.std::basic_streambuf", i32, %"class.std::__cxx11::basic_string" }
%"class.std::basic_streambuf" = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, %"class.std::locale" }
%"class.std::locale" = type { ptr }
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }

@.str.1 = external hidden unnamed_addr constant [84 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [42 x i8], align 1

; 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(none)
declare i64 @llvm.expect.i64(i64, i64) #1

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(128) ptr @_ZStlsIN3tao3ral8internal10LogMessageEPvEOT_S6_RKT0_(ptr noundef nonnull align 8 dereferenceable(128), ptr noundef nonnull align 8 dereferenceable(8)) #3

declare void @_ZN3tao3ral8internal10LogMessageC1EPKcii(ptr noundef nonnull align 8 dereferenceable(128), ptr noundef, i32 noundef, i32 noundef) unnamed_addr #4

declare i32 @__gxx_personality_v0(...)

; Function Attrs: nounwind
declare void @_ZN3tao3ral8internal10LogMessageD1Ev(ptr noundef nonnull align 8 dereferenceable(128)) unnamed_addr #5

; 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 void @tao_ral_clear_error(ptr noundef %0) #6 personality ptr @__gxx_personality_v0 {
  %2 = alloca ptr, align 8
  %3 = alloca %class.anon.19, align 1
  %4 = alloca %"struct.tao::ral::internal::Voidifier", align 1
  %5 = alloca %"class.tao::ral::internal::LogMessage", align 8
  %6 = alloca i1, align 1
  %7 = alloca i1, align 1
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1, ptr %3) #7
  %11 = call noundef zeroext i1 @"_ZZ19tao_ral_clear_errorENK3$_0clEiPKc"(ptr noundef nonnull align 1 dereferenceable(1) %3, i32 noundef 1, ptr noundef @.str.1)
  %12 = xor i1 %11, true
  %13 = xor i1 %12, true
  %14 = xor i1 %13, true
  %15 = zext i1 %14 to i64
  %16 = call i64 @llvm.expect.i64(i64 %15, i64 1)
  %17 = icmp ne i64 %16, 0
  call void @llvm.lifetime.start.p0(i64 1, ptr %4) #7
  store i1 false, ptr %6, align 1
  store i1 false, ptr %7, align 1
  br i1 %17, label %18, label %19

18:                                               ; preds = %1
  br label %25

19:                                               ; preds = %1
  call void @llvm.lifetime.start.p0(i64 392, ptr %5) #7
  store i1 true, ptr %6, align 1
  call void @_ZN3tao3ral8internal10LogMessageC1EPKcii(ptr noundef nonnull align 8 dereferenceable(128) %5, ptr noundef @.str.1, i32 noundef 47, i32 noundef 0)
  store i1 true, ptr %7, align 1
  %20 = invoke noundef nonnull align 8 dereferenceable(128) ptr @_ZStlsIN3tao3ral8internal10LogMessageEA42_cEOT_S6_RKT0_(ptr noundef nonnull align 8 dereferenceable(128) %5, ptr noundef nonnull align 1 dereferenceable(42) @.str.6)
          to label %21 unwind label %34

21:                                               ; preds = %19
  %22 = invoke noundef nonnull align 8 dereferenceable(128) ptr @_ZStlsIN3tao3ral8internal10LogMessageEPvEOT_S6_RKT0_(ptr noundef nonnull align 8 dereferenceable(128) %20, ptr noundef nonnull align 8 dereferenceable(8) %2)
          to label %23 unwind label %34

23:                                               ; preds = %21
  invoke void @_ZNK3tao3ral8internal9VoidifieranINS1_10LogMessageEEEvRKT_(ptr noundef nonnull align 1 dereferenceable(1) %4, ptr noundef nonnull align 8 dereferenceable(128) %22)
          to label %24 unwind label %34

24:                                               ; preds = %23
  br label %25

25:                                               ; preds = %24, %18
  %26 = load i1, ptr %7, align 1
  br i1 %26, label %27, label %28

27:                                               ; preds = %25
  call void @_ZN3tao3ral8internal10LogMessageD1Ev(ptr noundef nonnull align 8 dereferenceable(128) %5) #7
  br label %28

28:                                               ; preds = %27, %25
  %29 = load i1, ptr %6, align 1
  br i1 %29, label %30, label %31

30:                                               ; preds = %28
  call void @llvm.lifetime.end.p0(i64 392, ptr %5) #7
  br label %31

31:                                               ; preds = %30, %28
  call void @llvm.lifetime.end.p0(i64 1, ptr %4) #7
  call void @llvm.lifetime.end.p0(i64 1, ptr %3) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #7
  %32 = load ptr, ptr %2, align 8, !tbaa !5
  store ptr %32, ptr %10, align 8, !tbaa !5
  %33 = load ptr, ptr %10, align 8, !tbaa !5
  call void @_ZN3tao3ral7Context10clearErrorEv(ptr noundef nonnull align 8 dereferenceable(56) %33)
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #7
  ret void

34:                                               ; preds = %23, %21, %19
  %35 = landingpad { ptr, i32 }
          cleanup
  %36 = extractvalue { ptr, i32 } %35, 0
  store ptr %36, ptr %8, align 8
  %37 = extractvalue { ptr, i32 } %35, 1
  store i32 %37, ptr %9, align 4
  %38 = load i1, ptr %7, align 1
  br i1 %38, label %39, label %40

39:                                               ; preds = %34
  call void @_ZN3tao3ral8internal10LogMessageD1Ev(ptr noundef nonnull align 8 dereferenceable(128) %5) #7
  br label %40

40:                                               ; preds = %39, %34
  %41 = load i1, ptr %6, align 1
  br i1 %41, label %42, label %43

42:                                               ; preds = %40
  call void @llvm.lifetime.end.p0(i64 392, ptr %5) #7
  br label %43

43:                                               ; preds = %42, %40
  call void @llvm.lifetime.end.p0(i64 1, ptr %4) #7
  call void @llvm.lifetime.end.p0(i64 1, ptr %3) #7
  br label %44

44:                                               ; preds = %43
  %45 = load ptr, ptr %8, align 8
  %46 = load i32, ptr %9, align 4
  %47 = insertvalue { ptr, i32 } poison, ptr %45, 0
  %48 = insertvalue { ptr, i32 } %47, i32 %46, 1
  resume { ptr, i32 } %48
}

; Function Attrs: inlinehint mustprogress uwtable
declare hidden noundef zeroext i1 @"_ZZ19tao_ral_clear_errorENK3$_0clEiPKc"(ptr noundef nonnull align 1 dereferenceable(1), i32 noundef, ptr noundef) #3 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(128) ptr @_ZStlsIN3tao3ral8internal10LogMessageEA42_cEOT_S6_RKT0_(ptr noundef nonnull align 8 dereferenceable(128), ptr noundef nonnull align 1 dereferenceable(42)) #3

declare void @_ZN3tao3ral7Context10clearErrorEv(ptr noundef nonnull align 8 dereferenceable(56)) #4

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(none) }
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 = { 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 #4 = { "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 #5 = { 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 #6 = { 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 #7 = { 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"}


; 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.anon.19 = type { i8 }
%"struct.tao::ral::internal::Voidifier" = type { i8 }
%"class.tao::ral::internal::LogMessage" = type { %"class.std::__cxx11::basic_ostringstream.base", ptr, i32, i32, %"class.std::basic_ios" }
%"class.std::__cxx11::basic_ostringstream.base" = type { %"class.std::basic_ostream.base", %"class.std::__cxx11::basic_stringbuf" }
%"class.std::basic_ostream.base" = type { ptr }
%"class.std::__cxx11::basic_stringbuf" = type { %"class.std::basic_streambuf", i32, %"class.std::__cxx11::basic_string" }
%"class.std::basic_streambuf" = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, %"class.std::locale" }
%"class.std::locale" = type { ptr }
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }

@.str.1 = external hidden unnamed_addr constant [84 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [42 x i8], align 1

; 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 nounwind uwtable
declare dso_local void @_ZNK3tao3ral8internal9VoidifieranINS1_10LogMessageEEEvRKT_(ptr noundef nonnull align 1 dereferenceable(1), ptr noundef nonnull align 8 dereferenceable(128)) local_unnamed_addr #1 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(128) ptr @_ZStlsIN3tao3ral8internal10LogMessageEPvEOT_S6_RKT0_(ptr noundef nonnull align 8 dereferenceable(128), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #2

declare void @_ZN3tao3ral8internal10LogMessageC1EPKcii(ptr noundef nonnull align 8 dereferenceable(128), ptr noundef, i32 noundef, i32 noundef) unnamed_addr #3

declare i32 @__gxx_personality_v0(...)

; Function Attrs: nounwind
declare void @_ZN3tao3ral8internal10LogMessageD1Ev(ptr noundef nonnull align 8 dereferenceable(128)) unnamed_addr #4

; 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 void @tao_ral_clear_error(ptr noundef %0) local_unnamed_addr #5 personality ptr @__gxx_personality_v0 {
  %2 = alloca ptr, align 8
  %3 = alloca %class.anon.19, align 1
  %4 = alloca %"struct.tao::ral::internal::Voidifier", align 1
  %5 = alloca %"class.tao::ral::internal::LogMessage", align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %3) #6
  %6 = call noundef zeroext i1 @"_ZZ19tao_ral_clear_errorENK3$_0clEiPKc"(ptr noundef nonnull align 1 dereferenceable(1) %3, i32 noundef 1, ptr noundef nonnull @.str.1)
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %4) #6
  br i1 %6, label %7, label %.critedge7, !prof !9

7:                                                ; preds = %1
  call void @llvm.lifetime.start.p0(i64 392, ptr nonnull %5) #6
  call void @_ZN3tao3ral8internal10LogMessageC1EPKcii(ptr noundef nonnull align 8 dereferenceable(128) %5, ptr noundef nonnull @.str.1, i32 noundef 47, i32 noundef 0)
  %8 = invoke noundef nonnull align 8 dereferenceable(128) ptr @_ZStlsIN3tao3ral8internal10LogMessageEA42_cEOT_S6_RKT0_(ptr noundef nonnull align 8 dereferenceable(128) %5, ptr noundef nonnull align 1 dereferenceable(42) @.str.6)
          to label %9 unwind label %12

9:                                                ; preds = %7
  %10 = invoke noundef nonnull align 8 dereferenceable(128) ptr @_ZStlsIN3tao3ral8internal10LogMessageEPvEOT_S6_RKT0_(ptr noundef nonnull align 8 dereferenceable(128) %8, ptr noundef nonnull align 8 dereferenceable(8) %2)
          to label %.critedge unwind label %12

.critedge:                                        ; preds = %9
  call void @_ZNK3tao3ral8internal9VoidifieranINS1_10LogMessageEEEvRKT_(ptr noundef nonnull align 1 dereferenceable(1) %4, ptr noundef nonnull align 8 dereferenceable(128) %10)
  call void @_ZN3tao3ral8internal10LogMessageD1Ev(ptr noundef nonnull align 8 dereferenceable(128) %5) #6
  call void @llvm.lifetime.end.p0(i64 392, ptr nonnull %5) #6
  %.pre = load ptr, ptr %2, align 8, !tbaa !5
  br label %.critedge7

.critedge7:                                       ; preds = %1, %.critedge
  %11 = phi ptr [ %0, %1 ], [ %.pre, %.critedge ]
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %4) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %3) #6
  call void @_ZN3tao3ral7Context10clearErrorEv(ptr noundef nonnull align 8 dereferenceable(56) %11)
  ret void

12:                                               ; preds = %9, %7
  %13 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN3tao3ral8internal10LogMessageD1Ev(ptr noundef nonnull align 8 dereferenceable(128) %5) #6
  call void @llvm.lifetime.end.p0(i64 392, ptr nonnull %5) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %4) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %3) #6
  resume { ptr, i32 } %13
}

; Function Attrs: inlinehint mustprogress uwtable
declare hidden noundef zeroext i1 @"_ZZ19tao_ral_clear_errorENK3$_0clEiPKc"(ptr noundef nonnull align 1 dereferenceable(1), i32 noundef, ptr noundef) local_unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(128) ptr @_ZStlsIN3tao3ral8internal10LogMessageEA42_cEOT_S6_RKT0_(ptr noundef nonnull align 8 dereferenceable(128), ptr noundef nonnull align 1 dereferenceable(42)) local_unnamed_addr #2

declare void @_ZN3tao3ral7Context10clearErrorEv(ptr noundef nonnull align 8 dereferenceable(56)) local_unnamed_addr #3

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 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 "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 #5 = { 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 #6 = { 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 = !{!"branch_weights", !"expected", i32 1, i32 2000}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LowerExpectIntrinsicPass,SROAPass,SimplifyCFGPass