blob: ce7873fdd744f55739e887da49ccfa652cd27d32 [file] [log] [blame]
Reid Spencerbb4cae72005-04-29 07:19:00 +00001; Test that the StrCatOptimizer works correctly
Reid Spencerb2825212005-04-29 10:10:17 +00002; RUN: llvm-as < %s | opt -simplify-libcalls | llvm-dis | not grep 'call.*fputs'
3;
Reid Spencerbb4cae72005-04-29 07:19:00 +00004%struct._IO_FILE = type { int, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, %struct._IO_marker*, %struct._IO_FILE*, int, int, int, ushort, sbyte, [1 x sbyte], sbyte*, long, sbyte*, sbyte*, int, [52 x sbyte] }
5%struct._IO_marker = type { %struct._IO_marker*, %struct._IO_FILE*, int }
6%stdout = external global %struct._IO_FILE* ; <%struct._IO_FILE**> [#uses=1]
7
Reid Spencerb2825212005-04-29 10:10:17 +00008declare int %fputs(sbyte*, %struct._IO_FILE*)
Reid Spencerbb4cae72005-04-29 07:19:00 +00009
Reid Spencerb2825212005-04-29 10:10:17 +000010%empty = constant [1 x sbyte] c"\00"
11%len1 = constant [2 x sbyte] c"A\00"
12%long = constant [7 x sbyte] c"hello\0A\00"
13
14implementation ; Functions:
Reid Spencerbb4cae72005-04-29 07:19:00 +000015
16int %main() {
17entry:
Reid Spencerb2825212005-04-29 10:10:17 +000018 %out = load %struct._IO_FILE** %stdout
19 %s1 = getelementptr [1 x sbyte]* %empty, int 0, int 0
20 %s2 = getelementptr [2 x sbyte]* %len1, int 0, int 0
21 %s3 = getelementptr [7 x sbyte]* %long, int 0, int 0
22 %a = call int %fputs( sbyte* %s1, %struct._IO_FILE* %out )
23 %b = call int %fputs( sbyte* %s2, %struct._IO_FILE* %out )
24 %c = call int %fputs( sbyte* %s3, %struct._IO_FILE* %out )
25 ret int 0
Reid Spencerbb4cae72005-04-29 07:19:00 +000026}