Files
2026-02-05 22:34:42 +01:00

198 lines
12 KiB
LLVM

; ModuleID = 'profileme.cpp'
source_filename = "profileme.cpp"
target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128-Fn32"
target triple = "arm64-apple-macosx15.0.0"
%struct.DynamicString = type { ptr, i32, i32 }
@.str = private unnamed_addr constant [28 x i8] c"Usage: profileme myfile.txt\00", align 1
@.str.1 = private unnamed_addr constant [2 x i8] c"r\00", align 1
@.str.2 = private unnamed_addr constant [11 x i8] c"[%03d] %s\0A\00", align 1
; Function Attrs: mustprogress noinline nounwind ssp willreturn uwtable(sync)
define void @DynamicString_destroy(ptr nocapture noundef %0) local_unnamed_addr #0 {
%2 = load ptr, ptr %0, align 8, !tbaa !6
tail call void @free(ptr noundef %2)
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %0, i8 0, i64 16, i1 false)
ret void
}
; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #1
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2
; Function Attrs: mustprogress noinline nounwind ssp willreturn uwtable(sync)
define void @DynamicString_init(ptr nocapture noundef %0, i32 noundef %1) local_unnamed_addr #0 {
tail call void @DynamicString_destroy(ptr noundef %0)
%3 = getelementptr inbounds i8, ptr %0, i64 8
store i32 %1, ptr %3, align 8, !tbaa !13
%4 = getelementptr inbounds i8, ptr %0, i64 12
store i32 0, ptr %4, align 4, !tbaa !14
%5 = add nsw i32 %1, 1
%6 = sext i32 %5 to i64
%7 = tail call ptr @malloc(i64 noundef %6) #9
store ptr %7, ptr %0, align 8, !tbaa !6
store i8 0, ptr %7, align 1, !tbaa !15
ret void
}
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #3
; Function Attrs: mustprogress noinline nounwind ssp willreturn uwtable(sync)
define void @DynamicString_append(ptr nocapture noundef %0, i8 noundef signext %1) local_unnamed_addr #0 {
%3 = getelementptr inbounds i8, ptr %0, i64 12
%4 = load i32, ptr %3, align 4, !tbaa !14
%5 = getelementptr inbounds i8, ptr %0, i64 8
%6 = load i32, ptr %5, align 8, !tbaa !13
%7 = icmp eq i32 %4, %6
%8 = load ptr, ptr %0, align 8, !tbaa !6
br i1 %7, label %9, label %15
9: ; preds = %2
%10 = shl nsw i32 %4, 1
store i32 %10, ptr %5, align 8, !tbaa !13
%11 = or disjoint i32 %10, 1
%12 = sext i32 %11 to i64
%13 = tail call ptr @realloc(ptr noundef %8, i64 noundef %12) #10
store ptr %13, ptr %0, align 8, !tbaa !6
%14 = load i32, ptr %3, align 4, !tbaa !14
br label %15
15: ; preds = %9, %2
%16 = phi i32 [ %14, %9 ], [ %4, %2 ]
%17 = phi ptr [ %13, %9 ], [ %8, %2 ]
%18 = add nsw i32 %16, 1
store i32 %18, ptr %3, align 4, !tbaa !14
%19 = sext i32 %16 to i64
%20 = getelementptr inbounds i8, ptr %17, i64 %19
store i8 %1, ptr %20, align 1, !tbaa !15
%21 = load ptr, ptr %0, align 8, !tbaa !6
%22 = load i32, ptr %3, align 4, !tbaa !14
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i8, ptr %21, i64 %23
store i8 0, ptr %24, align 1, !tbaa !15
ret void
}
; Function Attrs: mustprogress nounwind willreturn allockind("realloc") allocsize(1) memory(argmem: readwrite, inaccessiblemem: readwrite)
declare noalias noundef ptr @realloc(ptr allocptr nocapture noundef, i64 noundef) local_unnamed_addr #4
; Function Attrs: mustprogress norecurse ssp uwtable(sync)
define range(i32 0, 2) i32 @main(i32 noundef %0, ptr nocapture noundef readonly %1) local_unnamed_addr #5 {
%3 = alloca %struct.DynamicString, align 8
%4 = alloca i8, align 1
%5 = icmp slt i32 %0, 2
br i1 %5, label %6, label %8
6: ; preds = %2
%7 = tail call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str)
br label %29
8: ; preds = %2
%9 = getelementptr inbounds i8, ptr %1, i64 8
%10 = load ptr, ptr %9, align 8, !tbaa !16
%11 = tail call ptr @"\01_fopen"(ptr noundef %10, ptr noundef nonnull @.str.1)
call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %3) #11
call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %3, i8 0, i64 16, i1 false)
call void @DynamicString_init(ptr noundef nonnull %3, i32 noundef 10)
call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %4) #11
store i8 0, ptr %4, align 1, !tbaa !15
%12 = call i64 @fread(ptr noundef nonnull %4, i64 noundef 1, i64 noundef 1, ptr noundef %11)
%13 = icmp eq i64 %12, 1
br i1 %13, label %14, label %27
14: ; preds = %8, %23
%15 = phi i32 [ %24, %23 ], [ 1, %8 ]
%16 = load i8, ptr %4, align 1, !tbaa !15
%17 = icmp eq i8 %16, 10
br i1 %17, label %18, label %22
18: ; preds = %14
%19 = add nsw i32 %15, 1
%20 = load ptr, ptr %3, align 8, !tbaa !6
%21 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %15, ptr noundef %20)
call void @DynamicString_init(ptr noundef nonnull %3, i32 noundef 10)
br label %23
22: ; preds = %14
call void @DynamicString_append(ptr noundef nonnull %3, i8 noundef signext %16)
br label %23
23: ; preds = %18, %22
%24 = phi i32 [ %19, %18 ], [ %15, %22 ]
call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %4) #11
call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %4) #11
store i8 0, ptr %4, align 1, !tbaa !15
%25 = call i64 @fread(ptr noundef nonnull %4, i64 noundef 1, i64 noundef 1, ptr noundef %11)
%26 = icmp eq i64 %25, 1
br i1 %26, label %14, label %27
27: ; preds = %23, %8
call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %4) #11
%28 = tail call i32 @fclose(ptr noundef %11)
call void @DynamicString_destroy(ptr noundef nonnull %3)
call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %3) #11
br label %29
29: ; preds = %27, %6
%30 = phi i32 [ 1, %6 ], [ 0, %27 ]
ret i32 %30
}
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #6
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #7
declare ptr @"\01_fopen"(ptr noundef, ptr noundef) local_unnamed_addr #8
; Function Attrs: nofree nounwind
declare noundef i64 @fread(ptr nocapture noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #6
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #6
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #7
; Function Attrs: nofree nounwind
declare noundef i32 @fclose(ptr nocapture noundef) local_unnamed_addr #6
attributes #0 = { mustprogress noinline nounwind ssp willreturn uwtable(sync) "frame-pointer"="non-leaf" "no-trapping-math"="true" "probe-stack"="__chkstk_darwin" "stack-protector-buffer-size"="8" "target-cpu"="apple-m1" "target-features"="+aes,+altnzcv,+bti,+ccdp,+ccidx,+complxnum,+crc,+dit,+dotprod,+flagm,+fp-armv8,+fp16fml,+fptoint,+fullfp16,+jsconv,+lse,+neon,+pauth,+perfmon,+predres,+ras,+rcpc,+rdm,+sb,+sha2,+sha3,+specrestrict,+ssbs,+v8.1a,+v8.2a,+v8.3a,+v8.4a,+v8.5a,+v8a,+zcm,+zcz" }
attributes #1 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "frame-pointer"="non-leaf" "no-trapping-math"="true" "probe-stack"="__chkstk_darwin" "stack-protector-buffer-size"="8" "target-cpu"="apple-m1" "target-features"="+aes,+altnzcv,+bti,+ccdp,+ccidx,+complxnum,+crc,+dit,+dotprod,+flagm,+fp-armv8,+fp16fml,+fptoint,+fullfp16,+jsconv,+lse,+neon,+pauth,+perfmon,+predres,+ras,+rcpc,+rdm,+sb,+sha2,+sha3,+specrestrict,+ssbs,+v8.1a,+v8.2a,+v8.3a,+v8.4a,+v8.5a,+v8a,+zcm,+zcz" }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "frame-pointer"="non-leaf" "no-trapping-math"="true" "probe-stack"="__chkstk_darwin" "stack-protector-buffer-size"="8" "target-cpu"="apple-m1" "target-features"="+aes,+altnzcv,+bti,+ccdp,+ccidx,+complxnum,+crc,+dit,+dotprod,+flagm,+fp-armv8,+fp16fml,+fptoint,+fullfp16,+jsconv,+lse,+neon,+pauth,+perfmon,+predres,+ras,+rcpc,+rdm,+sb,+sha2,+sha3,+specrestrict,+ssbs,+v8.1a,+v8.2a,+v8.3a,+v8.4a,+v8.5a,+v8a,+zcm,+zcz" }
attributes #4 = { mustprogress nounwind willreturn allockind("realloc") allocsize(1) memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "frame-pointer"="non-leaf" "no-trapping-math"="true" "probe-stack"="__chkstk_darwin" "stack-protector-buffer-size"="8" "target-cpu"="apple-m1" "target-features"="+aes,+altnzcv,+bti,+ccdp,+ccidx,+complxnum,+crc,+dit,+dotprod,+flagm,+fp-armv8,+fp16fml,+fptoint,+fullfp16,+jsconv,+lse,+neon,+pauth,+perfmon,+predres,+ras,+rcpc,+rdm,+sb,+sha2,+sha3,+specrestrict,+ssbs,+v8.1a,+v8.2a,+v8.3a,+v8.4a,+v8.5a,+v8a,+zcm,+zcz" }
attributes #5 = { mustprogress norecurse ssp uwtable(sync) "frame-pointer"="non-leaf" "no-trapping-math"="true" "probe-stack"="__chkstk_darwin" "stack-protector-buffer-size"="8" "target-cpu"="apple-m1" "target-features"="+aes,+altnzcv,+bti,+ccdp,+ccidx,+complxnum,+crc,+dit,+dotprod,+flagm,+fp-armv8,+fp16fml,+fptoint,+fullfp16,+jsconv,+lse,+neon,+pauth,+perfmon,+predres,+ras,+rcpc,+rdm,+sb,+sha2,+sha3,+specrestrict,+ssbs,+v8.1a,+v8.2a,+v8.3a,+v8.4a,+v8.5a,+v8a,+zcm,+zcz" }
attributes #6 = { nofree nounwind "frame-pointer"="non-leaf" "no-trapping-math"="true" "probe-stack"="__chkstk_darwin" "stack-protector-buffer-size"="8" "target-cpu"="apple-m1" "target-features"="+aes,+altnzcv,+bti,+ccdp,+ccidx,+complxnum,+crc,+dit,+dotprod,+flagm,+fp-armv8,+fp16fml,+fptoint,+fullfp16,+jsconv,+lse,+neon,+pauth,+perfmon,+predres,+ras,+rcpc,+rdm,+sb,+sha2,+sha3,+specrestrict,+ssbs,+v8.1a,+v8.2a,+v8.3a,+v8.4a,+v8.5a,+v8a,+zcm,+zcz" }
attributes #7 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #8 = { "frame-pointer"="non-leaf" "no-trapping-math"="true" "probe-stack"="__chkstk_darwin" "stack-protector-buffer-size"="8" "target-cpu"="apple-m1" "target-features"="+aes,+altnzcv,+bti,+ccdp,+ccidx,+complxnum,+crc,+dit,+dotprod,+flagm,+fp-armv8,+fp16fml,+fptoint,+fullfp16,+jsconv,+lse,+neon,+pauth,+perfmon,+predres,+ras,+rcpc,+rdm,+sb,+sha2,+sha3,+specrestrict,+ssbs,+v8.1a,+v8.2a,+v8.3a,+v8.4a,+v8.5a,+v8a,+zcm,+zcz" }
attributes #9 = { allocsize(0) }
attributes #10 = { allocsize(1) }
attributes #11 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3, !4}
!llvm.ident = !{!5}
!0 = !{i32 2, !"SDK Version", [2 x i32] [i32 26, i32 2]}
!1 = !{i32 1, !"wchar_size", i32 4}
!2 = !{i32 8, !"PIC Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 1}
!4 = !{i32 7, !"frame-pointer", i32 1}
!5 = !{!"Apple clang version 17.0.0 (clang-1700.6.3.2)"}
!6 = !{!7, !8, i64 0}
!7 = !{!"_ZTS13DynamicString", !8, i64 0, !12, i64 8, !12, i64 12}
!8 = !{!"p1 omnipotent char", !9, i64 0}
!9 = !{!"any pointer", !10, i64 0}
!10 = !{!"omnipotent char", !11, i64 0}
!11 = !{!"Simple C++ TBAA"}
!12 = !{!"int", !10, i64 0}
!13 = !{!7, !12, i64 8}
!14 = !{!7, !12, i64 12}
!15 = !{!10, !10, i64 0}
!16 = !{!8, !8, i64 0}