1 ; RUN: llvm-as < %s | llvm-dis > %t1.ll
2 ; RUN: llvm-as %t1.ll -o - | llvm-dis > %t2.ll
3 ; RUN: diff %t1.ll %t2.ll
5 ; This file contains the output from the following compiled C code:
6 ; typedef struct list {
11 ; // Iterative insert fn
12 ; void InsertIntoListTail(list **L, int Data) {
15 ; *L = (list*)malloc(sizeof(list));
20 ; // Recursive list search fn
21 ; list *FindData(list *L, int Data) {
22 ; if (L == 0) return 0;
23 ; if (L->Data == Data) return L;
24 ; return FindData(L->Next, Data);
27 ; void DoListStuff() {
29 ; InsertIntoListTail(&MyList, 100);
30 ; InsertIntoListTail(&MyList, 12);
31 ; InsertIntoListTail(&MyList, 42);
32 ; InsertIntoListTail(&MyList, 1123);
33 ; InsertIntoListTail(&MyList, 1213);
35 ; if (FindData(MyList, 75)) foundIt();
36 ; if (FindData(MyList, 42)) foundIt();
37 ; if (FindData(MyList, 700)) foundIt();
40 %list = type { ptr, i32 }
42 declare ptr @malloc(i32)
44 define void @InsertIntoListTail(ptr %L, i32 %Data) {
46 %reg116 = load ptr, ptr %L ; <ptr> [#uses=1]
47 %cast1004 = inttoptr i64 0 to ptr ; <ptr> [#uses=1]
48 %cond1000 = icmp eq ptr %reg116, %cast1004 ; <i1> [#uses=1]
49 br i1 %cond1000, label %bb3, label %bb2
51 bb2: ; preds = %bb2, %bb1
52 %reg117 = phi ptr [ %reg118, %bb2 ], [ %L, %bb1 ] ; <ptr> [#uses=1]
53 %reg118 = load ptr, ptr %reg117 ; <ptr> [#uses=3]
54 %reg109 = load ptr, ptr %reg118 ; <ptr> [#uses=1]
55 %cast1005 = inttoptr i64 0 to ptr ; <ptr> [#uses=1]
56 %cond1001 = icmp ne ptr %reg109, %cast1005 ; <i1> [#uses=1]
57 br i1 %cond1001, label %bb2, label %bb3
59 bb3: ; preds = %bb2, %bb1
60 %reg119 = phi ptr [ %reg118, %bb2 ], [ %L, %bb1 ] ; <ptr> [#uses=1]
61 %reg111 = call ptr @malloc( i32 16 ) ; <ptr> [#uses=3]
62 store ptr %reg111, ptr %reg119
63 %reg111.upgrd.1 = ptrtoint ptr %reg111 to i64 ; <i64> [#uses=1]
64 %reg1002 = add i64 %reg111.upgrd.1, 8 ; <i64> [#uses=1]
65 %reg1002.upgrd.2 = inttoptr i64 %reg1002 to ptr ; <ptr> [#uses=1]
66 store i32 %Data, ptr %reg1002.upgrd.2
67 %cast1003 = inttoptr i64 0 to ptr ; <ptr> [#uses=1]
68 store ptr %cast1003, ptr %reg111
72 define ptr @FindData(ptr %L, i32 %Data) {
76 bb2: ; preds = %bb6, %bb1
77 %reg115 = phi ptr [ %reg116, %bb6 ], [ %L, %bb1 ] ; <ptr> [#uses=4]
78 %cast1014 = inttoptr i64 0 to ptr ; <ptr> [#uses=1]
79 %cond1011 = icmp ne ptr %reg115, %cast1014 ; <i1> [#uses=1]
80 br i1 %cond1011, label %bb4, label %bb3
86 %idx = getelementptr %list, ptr %reg115, i64 0, i32 1 ; <ptr> [#uses=1]
87 %reg111 = load i32, ptr %idx ; <i32> [#uses=1]
88 %cond1013 = icmp ne i32 %reg111, %Data ; <i1> [#uses=1]
89 br i1 %cond1013, label %bb6, label %bb5
95 %idx2 = getelementptr %list, ptr %reg115, i64 0, i32 0 ; <ptr> [#uses=1]
96 %reg116 = load ptr, ptr %idx2 ; <ptr> [#uses=1]