; LLVM IR from ROCm/aomp :: test/smoke/clang-373823 (clang-373823)

; 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"

; Function Attrs: nounwind uwtable
define dso_local void @computeFoo(ptr noundef %0) #0 {
  %2 = alloca ptr, align 8
  %3 = alloca [100 x i32], align 16
  %4 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 400, ptr %3) #2
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #2
  store i32 0, ptr %4, align 4, !tbaa !9
  br label %5

5:                                                ; preds = %20, %1
  %6 = load i32, ptr %4, align 4, !tbaa !9
  %7 = icmp slt i32 %6, 100
  br i1 %7, label %9, label %8

8:                                                ; preds = %5
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #2
  br label %23

9:                                                ; preds = %5
  %10 = load i32, ptr %4, align 4, !tbaa !9
  %11 = load i32, ptr %4, align 4, !tbaa !9
  %12 = sext i32 %11 to i64
  %13 = getelementptr inbounds [100 x i32], ptr %3, i64 0, i64 %12
  store i32 %10, ptr %13, align 4, !tbaa !9
  %14 = load ptr, ptr %2, align 8, !tbaa !5
  %15 = load i32, ptr %4, align 4, !tbaa !9
  %16 = sext i32 %15 to i64
  %17 = getelementptr inbounds double, ptr %14, i64 %16
  %18 = load double, ptr %17, align 8, !tbaa !11
  %19 = fadd double %18, 1.000000e+00
  store double %19, ptr %17, align 8, !tbaa !11
  br label %20

20:                                               ; preds = %9
  %21 = load i32, ptr %4, align 4, !tbaa !9
  %22 = add nsw i32 %21, 1
  store i32 %22, ptr %4, align 4, !tbaa !9
  br label %5, !llvm.loop !13

23:                                               ; preds = %8
  %24 = getelementptr inbounds [100 x i32], ptr %3, i64 0, i64 99
  %25 = load i32, ptr %24, align 4, !tbaa !9
  %26 = sitofp i32 %25 to double
  %27 = fadd double %26, 1.000000e+00
  %28 = load ptr, ptr %2, align 8, !tbaa !5
  %29 = getelementptr inbounds double, ptr %28, i64 0
  store double %27, ptr %29, align 8, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 400, ptr %3) #2
  ret void
}

; 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

attributes #0 = { 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 = { 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/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}


; 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"

; Function Attrs: nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable
define dso_local void @computeFoo(ptr nocapture noundef %0) local_unnamed_addr #0 {
vector.ph:
  %1 = alloca [100 x i32], align 16
  call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %1) #2
  br label %vector.body

vector.body:                                      ; preds = %vector.body.1, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next.1, %vector.body.1 ]
  %vec.ind = phi <2 x i32> [ <i32 0, i32 1>, %vector.ph ], [ %vec.ind.next.1, %vector.body.1 ]
  %step.add = add <2 x i32> %vec.ind, <i32 2, i32 2>
  %2 = getelementptr inbounds [100 x i32], ptr %1, i64 0, i64 %index
  %3 = getelementptr inbounds i8, ptr %2, i64 8
  store <2 x i32> %vec.ind, ptr %2, align 16, !tbaa !5
  store <2 x i32> %step.add, ptr %3, align 8, !tbaa !5
  %4 = getelementptr inbounds double, ptr %0, i64 %index
  %5 = getelementptr inbounds i8, ptr %4, i64 16
  %wide.load = load <2 x double>, ptr %4, align 8, !tbaa !9
  %wide.load9 = load <2 x double>, ptr %5, align 8, !tbaa !9
  %6 = fadd <2 x double> %wide.load, <double 1.000000e+00, double 1.000000e+00>
  %7 = fadd <2 x double> %wide.load9, <double 1.000000e+00, double 1.000000e+00>
  store <2 x double> %6, ptr %4, align 8, !tbaa !9
  store <2 x double> %7, ptr %5, align 8, !tbaa !9
  %8 = icmp eq i64 %index, 96
  br i1 %8, label %middle.block, label %vector.body.1, !llvm.loop !11

vector.body.1:                                    ; preds = %vector.body
  %index.next = or disjoint i64 %index, 4
  %vec.ind.next = add <2 x i32> %vec.ind, <i32 4, i32 4>
  %step.add.1 = add <2 x i32> %vec.ind, <i32 6, i32 6>
  %9 = getelementptr inbounds [100 x i32], ptr %1, i64 0, i64 %index.next
  %10 = getelementptr inbounds i8, ptr %9, i64 8
  store <2 x i32> %vec.ind.next, ptr %9, align 16, !tbaa !5
  store <2 x i32> %step.add.1, ptr %10, align 8, !tbaa !5
  %11 = getelementptr inbounds double, ptr %0, i64 %index.next
  %12 = getelementptr inbounds i8, ptr %11, i64 16
  %wide.load.1 = load <2 x double>, ptr %11, align 8, !tbaa !9
  %wide.load9.1 = load <2 x double>, ptr %12, align 8, !tbaa !9
  %13 = fadd <2 x double> %wide.load.1, <double 1.000000e+00, double 1.000000e+00>
  %14 = fadd <2 x double> %wide.load9.1, <double 1.000000e+00, double 1.000000e+00>
  store <2 x double> %13, ptr %11, align 8, !tbaa !9
  store <2 x double> %14, ptr %12, align 8, !tbaa !9
  %index.next.1 = add nuw nsw i64 %index, 8
  %vec.ind.next.1 = add <2 x i32> %vec.ind, <i32 8, i32 8>
  br label %vector.body

middle.block:                                     ; preds = %vector.body
  %15 = getelementptr inbounds i8, ptr %1, i64 396
  %16 = load i32, ptr %15, align 4, !tbaa !5
  %17 = sitofp i32 %16 to double
  %18 = fadd double %17, 1.000000e+00
  store double %18, ptr %0, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %1) #2
  ret void
}

; 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

attributes #0 = { nofree norecurse nosync nounwind memory(argmem: readwrite) 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 = { 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"double", !7, i64 0}
!11 = distinct !{!11, !12, !13, !14}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!"llvm.loop.isvectorized", i32 1}
!14 = !{!"llvm.loop.unroll.runtime.disable"}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,LoopLoadEliminationPass,LoopRotatePass,LoopUnrollPass,LoopVectorizePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass