; LLVM IR from yangfengzzz/DigitalVox3 :: vox.geometry/fdm_linear_system2.ll (ZN3vox8geometry8FdmBlas28lInfNormERKNS0_5ArrayIdLm2EEE)

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3vox8geometry6MatrixImLm2ELm1EEC2ERKS2_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #0 align 2

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(16) ptr @_ZNK3vox8geometry9ArrayBaseIdLm2ENS0_5ArrayIdLm2EEEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32)) #0 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local noundef double @_ZN3vox8geometry8FdmBlas28lInfNormERKNS0_5ArrayIdLm2EEE(ptr noundef nonnull align 8 dereferenceable(56) %0) #2 align 2 {
  %2 = alloca ptr, align 8
  %3 = alloca %"class.vox::geometry::Matrix", align 8
  %4 = alloca double, align 8
  %5 = alloca i64, align 8
  %6 = alloca i32, align 4
  %7 = alloca i64, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr %3) #4
  %8 = load ptr, ptr %2, align 8, !tbaa !5
  %9 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNK3vox8geometry9ArrayBaseIdLm2ENS0_5ArrayIdLm2EEEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) %8)
  call void @_ZN3vox8geometry6MatrixImLm2ELm1EEC2ERKS2_(ptr noundef nonnull align 8 dereferenceable(16) %3, ptr noundef nonnull align 8 dereferenceable(16) %9)
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #4
  store double 0.000000e+00, ptr %4, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #4
  store i64 0, ptr %5, align 8, !tbaa !11
  br label %10

10:                                               ; preds = %35, %1
  %11 = load i64, ptr %5, align 8, !tbaa !11
  %12 = getelementptr inbounds %"class.vox::geometry::Matrix", ptr %3, i32 0, i32 1
  %13 = load i64, ptr %12, align 8, !tbaa !13
  %14 = icmp ult i64 %11, %13
  br i1 %14, label %16, label %15

15:                                               ; preds = %10
  store i32 2, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #4
  br label %38

16:                                               ; preds = %10
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  store i64 0, ptr %7, align 8, !tbaa !11
  br label %17

17:                                               ; preds = %31, %16
  %18 = load i64, ptr %7, align 8, !tbaa !11
  %19 = getelementptr inbounds %"class.vox::geometry::Matrix", ptr %3, i32 0, i32 0
  %20 = load i64, ptr %19, align 8, !tbaa !15
  %21 = icmp ult i64 %18, %20
  br i1 %21, label %23, label %22

22:                                               ; preds = %17
  store i32 5, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  br label %34

23:                                               ; preds = %17
  %24 = load double, ptr %4, align 8, !tbaa !9
  %25 = load ptr, ptr %2, align 8, !tbaa !5
  %26 = load i64, ptr %7, align 8, !tbaa !11
  %27 = load i64, ptr %5, align 8, !tbaa !11
  %28 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK3vox8geometry9ArrayBaseIdLm2ENS0_5ArrayIdLm2EEEEclIJmEEERKdmDpT_(ptr noundef nonnull align 8 dereferenceable(32) %25, i64 noundef %26, i64 noundef %27)
  %29 = load double, ptr %28, align 8, !tbaa !9
  %30 = call noundef double @_ZN3vox8geometry6absmaxIdEENSt9enable_ifIXsr3std13is_arithmeticIT_EE5valueES3_E4typeES3_S3_(double noundef %24, double noundef %29)
  store double %30, ptr %4, align 8, !tbaa !9
  br label %31

31:                                               ; preds = %23
  %32 = load i64, ptr %7, align 8, !tbaa !11
  %33 = add i64 %32, 1
  store i64 %33, ptr %7, align 8, !tbaa !11
  br label %17, !llvm.loop !16

34:                                               ; preds = %22
  br label %35

35:                                               ; preds = %34
  %36 = load i64, ptr %5, align 8, !tbaa !11
  %37 = add i64 %36, 1
  store i64 %37, ptr %5, align 8, !tbaa !11
  br label %10, !llvm.loop !18

38:                                               ; preds = %15
  %39 = load double, ptr %4, align 8, !tbaa !9
  %40 = call double @llvm.fabs.f64(double %39)
  store i32 1, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr %3) #4
  ret double %40
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef double @_ZN3vox8geometry6absmaxIdEENSt9enable_ifIXsr3std13is_arithmeticIT_EE5valueES3_E4typeES3_S3_(double noundef, double noundef) #0

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

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = !{!"double", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!14, !12, i64 8}
!14 = !{!"_ZTSN3vox8geometry6MatrixImLm2ELm1EEE", !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"

%"class.vox::geometry::Matrix" = type { i64, i64 }

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3vox8geometry6MatrixImLm2ELm1EEC2ERKS2_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #0 align 2

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(16) ptr @_ZNK3vox8geometry9ArrayBaseIdLm2ENS0_5ArrayIdLm2EEEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #0 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local noundef double @_ZN3vox8geometry8FdmBlas28lInfNormERKNS0_5ArrayIdLm2EEE(ptr noundef nonnull align 8 dereferenceable(56) %0) local_unnamed_addr #2 align 2 {
  %2 = alloca %"class.vox::geometry::Matrix", align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %2) #4
  %3 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNK3vox8geometry9ArrayBaseIdLm2ENS0_5ArrayIdLm2EEEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) %0)
  call void @_ZN3vox8geometry6MatrixImLm2ELm1EEC2ERKS2_(ptr noundef nonnull align 8 dereferenceable(16) %2, ptr noundef nonnull align 8 dereferenceable(16) %3)
  %4 = getelementptr inbounds i8, ptr %2, i64 8
  %5 = load i64, ptr %4, align 8, !tbaa !5
  %.not = icmp eq i64 %5, 0
  %6 = load i64, ptr %2, align 8
  %.not17 = icmp eq i64 %6, 0
  %or.cond = select i1 %.not, i1 true, i1 %.not17
  br i1 %or.cond, label %._crit_edge15, label %.preheader

.preheader:                                       ; preds = %1, %._crit_edge
  %7 = phi i64 [ %10, %._crit_edge ], [ %5, %1 ]
  %8 = phi i64 [ %11, %._crit_edge ], [ 1, %1 ]
  %.0914 = phi i64 [ %12, %._crit_edge ], [ 0, %1 ]
  %.01013 = phi double [ %.1.lcssa, %._crit_edge ], [ 0.000000e+00, %1 ]
  %.not18 = icmp eq i64 %8, 0
  br i1 %.not18, label %._crit_edge, label %.lr.ph

._crit_edge15:                                    ; preds = %._crit_edge, %1
  %.010.lcssa = phi double [ 0.000000e+00, %1 ], [ %.1.lcssa, %._crit_edge ]
  %9 = call double @llvm.fabs.f64(double %.010.lcssa)
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %2) #4
  ret double %9

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

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %.preheader
  %10 = phi i64 [ %7, %.preheader ], [ %.pre, %._crit_edge.loopexit ]
  %11 = phi i64 [ 0, %.preheader ], [ %18, %._crit_edge.loopexit ]
  %.1.lcssa = phi double [ %.01013, %.preheader ], [ %16, %._crit_edge.loopexit ]
  %12 = add nuw i64 %.0914, 1
  %13 = icmp ult i64 %12, %10
  br i1 %13, label %.preheader, label %._crit_edge15, !llvm.loop !10

.lr.ph:                                           ; preds = %.preheader, %.lr.ph
  %.012 = phi i64 [ %17, %.lr.ph ], [ 0, %.preheader ]
  %.111 = phi double [ %16, %.lr.ph ], [ %.01013, %.preheader ]
  %14 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK3vox8geometry9ArrayBaseIdLm2ENS0_5ArrayIdLm2EEEEclIJmEEERKdmDpT_(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef %.012, i64 noundef %.0914)
  %15 = load double, ptr %14, align 8, !tbaa !13
  %16 = call noundef double @_ZN3vox8geometry6absmaxIdEENSt9enable_ifIXsr3std13is_arithmeticIT_EE5valueES3_E4typeES3_S3_(double noundef %.111, double noundef %15)
  %17 = add nuw i64 %.012, 1
  %18 = load i64, ptr %2, align 8, !tbaa !15
  %19 = icmp ult i64 %17, %18
  br i1 %19, label %.lr.ph, label %._crit_edge.loopexit, !llvm.loop !16
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef double @_ZN3vox8geometry6absmaxIdEENSt9enable_ifIXsr3std13is_arithmeticIT_EE5valueES3_E4typeES3_S3_(double noundef, double noundef) local_unnamed_addr #0

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

attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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, !7, i64 8}
!6 = !{!"_ZTSN3vox8geometry6MatrixImLm2ELm1EEE", !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