; LLVM IR from ebirenbaum/ParticleSolver :: gpu/src/rendering/actioncamera.ll (ZN12ActionCameraC2Ev)

; 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.glm::detail::tvec4" = type { %union.anon, %union.anon.0, %union.anon.1, %union.anon.2 }
%union.anon = type { float }
%union.anon.0 = type { float }
%union.anon.1 = type { float }
%union.anon.2 = type { float }
%class.ActionCamera = type { %class.Camera.base, %"struct.glm::detail::tvec4", float, float, [4 x i8] }
%class.Camera.base = type <{ ptr, %"struct.glm::detail::tvec4", %"struct.glm::detail::tvec4", %"struct.glm::detail::tvec4", %"struct.glm::detail::tvec4", %"struct.glm::detail::tvec4", %"struct.glm::detail::tvec4", %"struct.glm::detail::tmat4x4", %"struct.glm::detail::tmat4x4", %"struct.glm::detail::tmat4x4", %"struct.glm::detail::tmat4x4", float, float, float, float, float }>
%"struct.glm::detail::tmat4x4" = type { [4 x %"struct.glm::detail::tvec4"] }

@_ZTV12ActionCamera = external dso_local unnamed_addr constant { [4 x ptr] }, align 8

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN12ActionCameraC2Ev(ptr noundef nonnull align 8 dereferenceable(404) %0) unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca %"struct.glm::detail::tvec4", align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  %6 = load ptr, ptr %2, align 8
  call void @_ZN6CameraC2Ev(ptr noundef nonnull align 8 dereferenceable(380) %6)
  store ptr getelementptr inbounds inrange(-16, 16) ({ [4 x ptr] }, ptr @_ZTV12ActionCamera, i32 0, i32 0, i32 2), ptr %6, align 8, !tbaa !9
  %7 = getelementptr inbounds %class.ActionCamera, ptr %6, i32 0, i32 1
  invoke void @_ZN3glm6detail5tvec4IfLNS_9precisionE0EEC2Ev(ptr noundef nonnull align 4 dereferenceable(16) %7)
          to label %8 unwind label %15

8:                                                ; preds = %1
  call void @llvm.lifetime.start.p0(i64 16, ptr %5) #5
  invoke void @_ZN3glm6detail5tvec4IfLNS_9precisionE0EEC2Ev(ptr noundef nonnull align 4 dereferenceable(16) %5)
          to label %9 unwind label %19

9:                                                ; preds = %8
  %10 = getelementptr inbounds %class.ActionCamera, ptr %6, i32 0, i32 1
  %11 = invoke noundef nonnull align 4 dereferenceable(16) ptr @_ZN3glm6detail5tvec4IfLNS_9precisionE0EEaSERKS3_(ptr noundef nonnull align 4 dereferenceable(16) %10, ptr noundef nonnull align 4 dereferenceable(16) %5)
          to label %12 unwind label %19

12:                                               ; preds = %9
  call void @llvm.lifetime.end.p0(i64 16, ptr %5) #5
  %13 = getelementptr inbounds %class.ActionCamera, ptr %6, i32 0, i32 2
  store float 0.000000e+00, ptr %13, align 4, !tbaa !11
  %14 = getelementptr inbounds %class.ActionCamera, ptr %6, i32 0, i32 3
  store float 0.000000e+00, ptr %14, align 8, !tbaa !17
  ret void

15:                                               ; preds = %1
  %16 = landingpad { ptr, i32 }
          cleanup
  %17 = extractvalue { ptr, i32 } %16, 0
  store ptr %17, ptr %3, align 8
  %18 = extractvalue { ptr, i32 } %16, 1
  store i32 %18, ptr %4, align 4
  br label %23

19:                                               ; preds = %9, %8
  %20 = landingpad { ptr, i32 }
          cleanup
  %21 = extractvalue { ptr, i32 } %20, 0
  store ptr %21, ptr %3, align 8
  %22 = extractvalue { ptr, i32 } %20, 1
  store i32 %22, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 16, ptr %5) #5
  br label %23

23:                                               ; preds = %19, %15
  call void @_ZN6CameraD2Ev(ptr noundef nonnull align 8 dereferenceable(380) %6) #5
  br label %24

24:                                               ; preds = %23
  %25 = load ptr, ptr %3, align 8
  %26 = load i32, ptr %4, align 4
  %27 = insertvalue { ptr, i32 } poison, ptr %25, 0
  %28 = insertvalue { ptr, i32 } %27, i32 %26, 1
  resume { ptr, i32 } %28
}

declare void @_ZN6CameraC2Ev(ptr noundef nonnull align 8 dereferenceable(380)) unnamed_addr #1

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

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(16) ptr @_ZN3glm6detail5tvec4IfLNS_9precisionE0EEaSERKS3_(ptr noundef nonnull align 4 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(16)) #2 align 2

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

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

attributes #0 = { 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 #1 = { "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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 = !{!"vtable pointer", !8, i64 0}
!11 = !{!12, !16, i64 396}
!12 = !{!"_ZTS12ActionCamera", !13, i64 0, !14, i64 380, !16, i64 396, !16, i64 400}
!13 = !{!"_ZTS6Camera", !14, i64 8, !14, i64 24, !14, i64 40, !14, i64 56, !14, i64 72, !14, i64 88, !15, i64 104, !15, i64 168, !15, i64 232, !15, i64 296, !16, i64 360, !16, i64 364, !16, i64 368, !16, i64 372, !16, i64 376}
!14 = !{!"_ZTSN3glm6detail5tvec4IfLNS_9precisionE0EEE", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12}
!15 = !{!"_ZTSN3glm6detail7tmat4x4IfLNS_9precisionE0EEE", !7, i64 0}
!16 = !{!"float", !7, i64 0}
!17 = !{!12, !16, i64 400}


; 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.glm::detail::tvec4" = type { %union.anon, %union.anon.0, %union.anon.1, %union.anon.2 }
%union.anon = type { float }
%union.anon.0 = type { float }
%union.anon.1 = type { float }
%union.anon.2 = type { float }

@_ZTV12ActionCamera = external dso_local unnamed_addr constant { [4 x ptr] }, align 8

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN12ActionCameraC2Ev(ptr noundef nonnull align 8 dereferenceable(404) %0) unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca %"struct.glm::detail::tvec4", align 4
  tail call void @_ZN6CameraC2Ev(ptr noundef nonnull align 8 dereferenceable(380) %0)
  store ptr getelementptr inbounds inrange(-16, 16) (i8, ptr @_ZTV12ActionCamera, i64 16), ptr %0, align 8, !tbaa !5
  %3 = getelementptr inbounds i8, ptr %0, i64 380
  tail call void @_ZN3glm6detail5tvec4IfLNS_9precisionE0EEC2Ev(ptr noundef nonnull align 4 dereferenceable(16) %3)
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %2) #4
  call void @_ZN3glm6detail5tvec4IfLNS_9precisionE0EEC2Ev(ptr noundef nonnull align 4 dereferenceable(16) %2)
  %4 = call noundef nonnull align 4 dereferenceable(16) ptr @_ZN3glm6detail5tvec4IfLNS_9precisionE0EEaSERKS3_(ptr noundef nonnull align 4 dereferenceable(16) %3, ptr noundef nonnull align 4 dereferenceable(16) %2)
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %2) #4
  %5 = getelementptr inbounds i8, ptr %0, i64 396
  store <2 x float> zeroinitializer, ptr %5, align 4, !tbaa !8
  ret void
}

declare void @_ZN6CameraC2Ev(ptr noundef nonnull align 8 dereferenceable(380)) unnamed_addr #1

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

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(16) ptr @_ZN3glm6detail5tvec4IfLNS_9precisionE0EEaSERKS3_(ptr noundef nonnull align 4 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(16)) local_unnamed_addr #2 align 2

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

attributes #0 = { 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 #1 = { "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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"float", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass