• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: lli -jit-kind=orc-lazy %s a b c | FileCheck %s
2
3; CHECK: argc = 4
4; CHECK-NEXT: argv = ["{{.*}}printargv.ll", "a", "b", "c"]
5; CHECK-NEXT; argv[4] = null
6
7@.str = private unnamed_addr constant [11 x i8] c"argc = %i\0A\00", align 1
8@.str.1 = private unnamed_addr constant [9 x i8] c"argv = [\00", align 1
9@.str.3 = private unnamed_addr constant [5 x i8] c"\22%s\22\00", align 1
10@.str.4 = private unnamed_addr constant [5 x i8] c"null\00", align 1
11@.str.5 = private unnamed_addr constant [7 x i8] c", \22%s\22\00", align 1
12@.str.6 = private unnamed_addr constant [15 x i8] c"argv[%i] = %s\0A\00", align 1
13@.str.7 = private unnamed_addr constant [5 x i8] c"junk\00", align 1
14@str.8 = private unnamed_addr constant [2 x i8] c"]\00", align 1
15
16define i32 @main(i32 %argc, i8** nocapture readonly %argv)  {
17entry:
18  %call = tail call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %argc)
19  %call1 = tail call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
20  %cmp = icmp eq i32 %argc, 0
21  br i1 %cmp, label %if.then, label %if.end
22
23if.then:
24  %puts36 = tail call i32 @puts(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @str.8, i64 0, i64 0))
25  br label %if.end
26
27if.end:
28  %0 = load i8*, i8** %argv, align 8
29  %tobool = icmp eq i8* %0, null
30  br i1 %tobool, label %if.else, label %if.then3
31
32if.then3:
33  %call5 = tail call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* %0)
34  br label %if.end7
35
36if.else:
37  %call6 = tail call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
38  br label %if.end7
39
40if.end7:
41  %cmp837 = icmp eq i32 %argc, 1
42  br i1 %cmp837, label %for.cond.cleanup, label %for.body.preheader
43
44for.body.preheader:
45  %1 = zext i32 %argc to i64
46  br label %for.body
47
48for.cond.cleanup:
49  %puts = tail call i32 @puts(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @str.8, i64 0, i64 0))
50  %idxprom19 = sext i32 %argc to i64
51  %arrayidx20 = getelementptr inbounds i8*, i8** %argv, i64 %idxprom19
52  %2 = load i8*, i8** %arrayidx20, align 8
53  %tobool21 = icmp eq i8* %2, null
54  %cond = select i1 %tobool21, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0)
55  %call22 = tail call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.6, i64 0, i64 0), i32 %argc, i8* %cond)
56  ret i32 0
57
58for.body:
59  %indvars.iv = phi i64 [ 1, %for.body.preheader ], [ %indvars.iv.next, %for.inc ]
60  %arrayidx9 = getelementptr inbounds i8*, i8** %argv, i64 %indvars.iv
61  %3 = load i8*, i8** %arrayidx9, align 8
62  %tobool10 = icmp eq i8* %3, null
63  br i1 %tobool10, label %if.else15, label %if.then11
64
65if.then11:
66  %call14 = tail call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i8* %3)
67  br label %for.inc
68
69if.else15:
70  %call16 = tail call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
71  br label %for.inc
72
73for.inc:
74  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
75  %cmp8 = icmp eq i64 %indvars.iv.next, %1
76  br i1 %cmp8, label %for.cond.cleanup, label %for.body
77}
78
79declare i32 @printf(i8* nocapture readonly, ...)
80
81declare i32 @puts(i8* nocapture readonly)
82