forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 0
/
hello.ll
90 lines (76 loc) · 3.53 KB
/
hello.ll
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
; ModuleID = 'hello.c'
source_filename = "hello.c"
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"
@.str = private unnamed_addr constant [14 x i8] c"Hello, World!\00", align 1
; Function Attrs: nounwind uwtable
define dso_local i32 @test(i32 noundef %val) #0 {
entry:
%val.addr = alloca i32, align 4
%jemp = alloca i32, align 4
%i = alloca i32, align 4
store i32 %val, ptr %val.addr, align 4, !tbaa !5
call void @llvm.lifetime.start.p0(i64 4, ptr %jemp) #3
store i32 1, ptr %jemp, align 4, !tbaa !5
call void @llvm.lifetime.start.p0(i64 4, ptr %i) #3
store i32 0, ptr %i, align 4, !tbaa !5
br label %for.cond
for.cond: ; preds = %for.inc, %entry
%0 = load i32, ptr %i, align 4, !tbaa !5
%1 = load i32, ptr %val.addr, align 4, !tbaa !5
%cmp = icmp slt i32 %0, %1
br i1 %cmp, label %for.body, label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.cond
call void @llvm.lifetime.end.p0(i64 4, ptr %i) #3
br label %for.end
for.body: ; preds = %for.cond
%2 = load i32, ptr %i, align 4, !tbaa !5
%3 = load i32, ptr %jemp, align 4, !tbaa !5
%mul = mul nsw i32 %3, %2
store i32 %mul, ptr %jemp, align 4, !tbaa !5
br label %for.inc
for.inc: ; preds = %for.body
%4 = load i32, ptr %i, align 4, !tbaa !5
%inc = add nsw i32 %4, 1
store i32 %inc, ptr %i, align 4, !tbaa !5
br label %for.cond, !llvm.loop !9
for.end: ; preds = %for.cond.cleanup
%5 = load i32, ptr %jemp, align 4, !tbaa !5
call void @llvm.lifetime.end.p0(i64 4, ptr %jemp) #3
ret i32 %5
}
; 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: nounwind uwtable
define dso_local i32 @main() #0 {
entry:
%retval = alloca i32, align 4
%k = alloca i32, align 4
store i32 0, ptr %retval, align 4
%call = call i32 (ptr, ...) @printf(ptr noundef @.str)
call void @llvm.lifetime.start.p0(i64 4, ptr %k) #3
%call1 = call i32 @test(i32 noundef 100)
store i32 %call1, ptr %k, align 4, !tbaa !5
call void @llvm.lifetime.end.p0(i64 4, ptr %k) #3
ret i32 0
}
declare i32 @printf(ptr noundef, ...) #2
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 = { "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 = { 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 18.0.0git (https://github.com/llvm/llvm-project.git 83be8a74001904a63ed0cffa0cecc43649a7bb29)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}