; LLVM IR from yangfengzzz/Arche-webgpu :: vox.geometry/fdm_linear_system2.ll (ZN3vox8FdmBlas23dotERKNS_5ArrayIdLm2EEES4_)

; 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.vox::Size2" = type { i64, i64 }

@.str = external hidden unnamed_addr constant [17 x i8], align 1
@_ZTISt16invalid_argument = external constant ptr

; 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(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: mustprogress uwtable
define dso_local noundef double @_ZN3vox8FdmBlas23dotERKNS_5ArrayIdLm2EEES4_(ptr noundef nonnull align 8 dereferenceable(40) %0, ptr noundef nonnull align 8 dereferenceable(40) %1) #1 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca %"struct.vox::Size2", align 8
  %6 = alloca %"struct.vox::Size2", align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca double, align 8
  %10 = alloca i64, align 8
  %11 = alloca i32, align 4
  %12 = alloca i64, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr %5) #7
  %13 = load ptr, ptr %3, align 8, !tbaa !5
  %14 = call { i64, i64 } @_ZNK3vox5ArrayIdLm2EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(40) %13)
  %15 = getelementptr inbounds { i64, i64 }, ptr %5, i32 0, i32 0
  %16 = extractvalue { i64, i64 } %14, 0
  store i64 %16, ptr %15, align 8
  %17 = getelementptr inbounds { i64, i64 }, ptr %5, i32 0, i32 1
  %18 = extractvalue { i64, i64 } %14, 1
  store i64 %18, ptr %17, align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr %6) #7
  %19 = load ptr, ptr %4, align 8, !tbaa !5
  %20 = call { i64, i64 } @_ZNK3vox5ArrayIdLm2EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(40) %19)
  %21 = getelementptr inbounds { i64, i64 }, ptr %6, i32 0, i32 0
  %22 = extractvalue { i64, i64 } %20, 0
  store i64 %22, ptr %21, align 8
  %23 = getelementptr inbounds { i64, i64 }, ptr %6, i32 0, i32 1
  %24 = extractvalue { i64, i64 } %20, 1
  store i64 %24, ptr %23, align 8
  %25 = call noundef zeroext i1 @_ZNK3vox5Size2neERKS0_(ptr noundef nonnull align 8 dereferenceable(16) %5, ptr noundef nonnull align 8 dereferenceable(16) %6)
  call void @llvm.lifetime.end.p0(i64 16, ptr %6) #7
  br i1 %25, label %26, label %33

26:                                               ; preds = %2
  %27 = call ptr @__cxa_allocate_exception(i64 16) #7
  invoke void @_ZNSt16invalid_argumentC1EPKc(ptr noundef nonnull align 8 dereferenceable(16) %27, ptr noundef @.str)
          to label %28 unwind label %29

28:                                               ; preds = %26
  call void @__cxa_throw(ptr %27, ptr @_ZTISt16invalid_argument, ptr @_ZNSt16invalid_argumentD1Ev) #8
  unreachable

29:                                               ; preds = %26
  %30 = landingpad { ptr, i32 }
          cleanup
  %31 = extractvalue { ptr, i32 } %30, 0
  store ptr %31, ptr %7, align 8
  %32 = extractvalue { ptr, i32 } %30, 1
  store i32 %32, ptr %8, align 4
  call void @__cxa_free_exception(ptr %27) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr %5) #7
  br label %69

33:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #7
  store double 0.000000e+00, ptr %9, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #7
  store i64 0, ptr %10, align 8, !tbaa !11
  br label %34

34:                                               ; preds = %64, %33
  %35 = load i64, ptr %10, align 8, !tbaa !11
  %36 = getelementptr inbounds %"struct.vox::Size2", ptr %5, i32 0, i32 1
  %37 = load i64, ptr %36, align 8, !tbaa !13
  %38 = icmp ult i64 %35, %37
  br i1 %38, label %40, label %39

39:                                               ; preds = %34
  store i32 2, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #7
  br label %67

40:                                               ; preds = %34
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #7
  store i64 0, ptr %12, align 8, !tbaa !11
  br label %41

41:                                               ; preds = %60, %40
  %42 = load i64, ptr %12, align 8, !tbaa !11
  %43 = getelementptr inbounds %"struct.vox::Size2", ptr %5, i32 0, i32 0
  %44 = load i64, ptr %43, align 8, !tbaa !15
  %45 = icmp ult i64 %42, %44
  br i1 %45, label %47, label %46

46:                                               ; preds = %41
  store i32 5, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #7
  br label %63

47:                                               ; preds = %41
  %48 = load ptr, ptr %3, align 8, !tbaa !5
  %49 = load i64, ptr %12, align 8, !tbaa !11
  %50 = load i64, ptr %10, align 8, !tbaa !11
  %51 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK3vox5ArrayIdLm2EEclEmm(ptr noundef nonnull align 8 dereferenceable(40) %48, i64 noundef %49, i64 noundef %50)
  %52 = load double, ptr %51, align 8, !tbaa !9
  %53 = load ptr, ptr %4, align 8, !tbaa !5
  %54 = load i64, ptr %12, align 8, !tbaa !11
  %55 = load i64, ptr %10, align 8, !tbaa !11
  %56 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK3vox5ArrayIdLm2EEclEmm(ptr noundef nonnull align 8 dereferenceable(40) %53, i64 noundef %54, i64 noundef %55)
  %57 = load double, ptr %56, align 8, !tbaa !9
  %58 = load double, ptr %9, align 8, !tbaa !9
  %59 = call double @llvm.fmuladd.f64(double %52, double %57, double %58)
  store double %59, ptr %9, align 8, !tbaa !9
  br label %60

60:                                               ; preds = %47
  %61 = load i64, ptr %12, align 8, !tbaa !11
  %62 = add i64 %61, 1
  store i64 %62, ptr %12, align 8, !tbaa !11
  br label %41, !llvm.loop !16

63:                                               ; preds = %46
  br label %64

64:                                               ; preds = %63
  %65 = load i64, ptr %10, align 8, !tbaa !11
  %66 = add i64 %65, 1
  store i64 %66, ptr %10, align 8, !tbaa !11
  br label %34, !llvm.loop !18

67:                                               ; preds = %39
  %68 = load double, ptr %9, align 8, !tbaa !9
  store i32 1, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr %5) #7
  ret double %68

69:                                               ; preds = %29
  %70 = load ptr, ptr %7, align 8
  %71 = load i32, ptr %8, align 4
  %72 = insertvalue { ptr, i32 } poison, ptr %70, 0
  %73 = insertvalue { ptr, i32 } %72, i32 %71, 1
  resume { ptr, i32 } %73
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local { i64, i64 } @_ZNK3vox5ArrayIdLm2EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(40)) #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZNK3vox5Size2neERKS0_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) #3 align 2

declare ptr @__cxa_allocate_exception(i64)

declare void @_ZNSt16invalid_argumentC1EPKc(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef) unnamed_addr #4

declare i32 @__gxx_personality_v0(...)

declare void @__cxa_free_exception(ptr)

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

declare void @__cxa_throw(ptr, ptr, ptr)

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNK3vox5ArrayIdLm2EEclEmm(ptr noundef nonnull align 8 dereferenceable(40), i64 noundef, i64 noundef) #2 align 2

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #6

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 = { 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { nounwind }
attributes #8 = { noreturn }

!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 = !{!"double", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!14, !12, i64 8}
!14 = !{!"_ZTSN3vox5Size2E", !12, i64 0, !12, i64 8}
!15 = !{!14, !12, i64 0}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}
!18 = distinct !{!18, !17}


; 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.vox::Size2" = type { i64, i64 }

@.str = external hidden unnamed_addr constant [17 x i8], align 1
@_ZTISt16invalid_argument = external constant ptr

; 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 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 noundef double @_ZN3vox8FdmBlas23dotERKNS_5ArrayIdLm2EEES4_(ptr noundef nonnull align 8 dereferenceable(40) %0, ptr noundef nonnull align 8 dereferenceable(40) %1) local_unnamed_addr #1 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca %"struct.vox::Size2", align 8
  %4 = alloca %"struct.vox::Size2", align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %3) #7
  %5 = tail call { i64, i64 } @_ZNK3vox5ArrayIdLm2EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(40) %0)
  %6 = extractvalue { i64, i64 } %5, 0
  store i64 %6, ptr %3, align 8
  %7 = getelementptr inbounds i8, ptr %3, i64 8
  %8 = extractvalue { i64, i64 } %5, 1
  store i64 %8, ptr %7, align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %4) #7
  %9 = tail call { i64, i64 } @_ZNK3vox5ArrayIdLm2EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(40) %1)
  %10 = extractvalue { i64, i64 } %9, 0
  store i64 %10, ptr %4, align 8
  %11 = getelementptr inbounds i8, ptr %4, i64 8
  %12 = extractvalue { i64, i64 } %9, 1
  store i64 %12, ptr %11, align 8
  %13 = call noundef zeroext i1 @_ZNK3vox5Size2neERKS0_(ptr noundef nonnull align 8 dereferenceable(16) %3, ptr noundef nonnull align 8 dereferenceable(16) %4)
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #7
  br i1 %13, label %16, label %.preheader17

.preheader17:                                     ; preds = %2
  %14 = load i64, ptr %7, align 8, !tbaa !5
  %.not = icmp eq i64 %14, 0
  %15 = load i64, ptr %3, align 8
  %.not24 = icmp eq i64 %15, 0
  %or.cond = select i1 %.not, i1 true, i1 %.not24
  br i1 %or.cond, label %._crit_edge22, label %.preheader

16:                                               ; preds = %2
  %17 = call ptr @__cxa_allocate_exception(i64 16) #7
  invoke void @_ZNSt16invalid_argumentC1EPKc(ptr noundef nonnull align 8 dereferenceable(16) %17, ptr noundef nonnull @.str)
          to label %18 unwind label %19

18:                                               ; preds = %16
  call void @__cxa_throw(ptr nonnull %17, ptr nonnull @_ZTISt16invalid_argument, ptr nonnull @_ZNSt16invalid_argumentD1Ev) #8
  unreachable

19:                                               ; preds = %16
  %20 = landingpad { ptr, i32 }
          cleanup
  call void @__cxa_free_exception(ptr %17) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %3) #7
  resume { ptr, i32 } %20

.preheader:                                       ; preds = %.preheader17, %._crit_edge
  %21 = phi i64 [ %23, %._crit_edge ], [ %14, %.preheader17 ]
  %22 = phi i64 [ %24, %._crit_edge ], [ 1, %.preheader17 ]
  %.01521 = phi i64 [ %25, %._crit_edge ], [ 0, %.preheader17 ]
  %.01620 = phi double [ %.1.lcssa, %._crit_edge ], [ 0.000000e+00, %.preheader17 ]
  %.not25 = icmp eq i64 %22, 0
  br i1 %.not25, label %._crit_edge, label %.lr.ph

._crit_edge22:                                    ; preds = %._crit_edge, %.preheader17
  %.016.lcssa = phi double [ 0.000000e+00, %.preheader17 ], [ %.1.lcssa, %._crit_edge ]
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %3) #7
  ret double %.016.lcssa

._crit_edge.loopexit:                             ; preds = %.lr.ph
  %.pre = load i64, ptr %7, align 8, !tbaa !5
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %.preheader
  %23 = phi i64 [ %21, %.preheader ], [ %.pre, %._crit_edge.loopexit ]
  %24 = phi i64 [ 0, %.preheader ], [ %33, %._crit_edge.loopexit ]
  %.1.lcssa = phi double [ %.01620, %.preheader ], [ %31, %._crit_edge.loopexit ]
  %25 = add nuw i64 %.01521, 1
  %26 = icmp ult i64 %25, %23
  br i1 %26, label %.preheader, label %._crit_edge22, !llvm.loop !10

.lr.ph:                                           ; preds = %.preheader, %.lr.ph
  %.019 = phi i64 [ %32, %.lr.ph ], [ 0, %.preheader ]
  %.118 = phi double [ %31, %.lr.ph ], [ %.01620, %.preheader ]
  %27 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK3vox5ArrayIdLm2EEclEmm(ptr noundef nonnull align 8 dereferenceable(40) %0, i64 noundef %.019, i64 noundef %.01521)
  %28 = load double, ptr %27, align 8, !tbaa !13
  %29 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK3vox5ArrayIdLm2EEclEmm(ptr noundef nonnull align 8 dereferenceable(40) %1, i64 noundef %.019, i64 noundef %.01521)
  %30 = load double, ptr %29, align 8, !tbaa !13
  %31 = call double @llvm.fmuladd.f64(double %28, double %30, double %.118)
  %32 = add nuw i64 %.019, 1
  %33 = load i64, ptr %3, align 8, !tbaa !15
  %34 = icmp ult i64 %32, %33
  br i1 %34, label %.lr.ph, label %._crit_edge.loopexit, !llvm.loop !16
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local { i64, i64 } @_ZNK3vox5ArrayIdLm2EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(40)) local_unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZNK3vox5Size2neERKS0_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #3 align 2

declare ptr @__cxa_allocate_exception(i64) local_unnamed_addr

declare void @_ZNSt16invalid_argumentC1EPKc(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef) unnamed_addr #4

declare i32 @__gxx_personality_v0(...)

declare void @__cxa_free_exception(ptr) local_unnamed_addr

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

declare void @__cxa_throw(ptr, ptr, ptr) local_unnamed_addr

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNK3vox5ArrayIdLm2EEclEmm(ptr noundef nonnull align 8 dereferenceable(40), i64 noundef, i64 noundef) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #6

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 = { 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 nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { nounwind }
attributes #8 = { noreturn }

!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, !7, i64 8}
!6 = !{!"_ZTSN3vox5Size2E", !7, i64 0, !7, i64 8}
!7 = !{!"long", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = distinct !{!10, !11, !12}
!11 = !{!"llvm.loop.mustprogress"}
!12 = !{!"llvm.loop.unswitch.partial.disable"}
!13 = !{!14, !14, i64 0}
!14 = !{!"double", !8, i64 0}
!15 = !{!6, !7, i64 0}
!16 = distinct !{!16, !11}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopInstSimplifyPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimpleLoopUnswitchPass,SimplifyCFGPass,TailCallElimPass