Reid Spencer | 41571c8 | 2005-04-29 23:01:21 +0000 | [diff] [blame] | 1 | ; Test that the PutsCatOptimizer works correctly |
Reid Spencer | 43b4003 | 2007-04-16 15:31:49 +0000 | [diff] [blame^] | 2 | ; RUN: llvm-upgrade < %s | llvm-as | opt -simplify-libcalls | llvm-dis | \ |
| 3 | ; RUN: not grep {call.*fputs} |
Reid Spencer | b282521 | 2005-04-29 10:10:17 +0000 | [diff] [blame] | 4 | ; |
Reid Spencer | bb4cae7 | 2005-04-29 07:19:00 +0000 | [diff] [blame] | 5 | %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] } |
| 6 | %struct._IO_marker = type { %struct._IO_marker*, %struct._IO_FILE*, int } |
| 7 | %stdout = external global %struct._IO_FILE* ; <%struct._IO_FILE**> [#uses=1] |
| 8 | |
Reid Spencer | b282521 | 2005-04-29 10:10:17 +0000 | [diff] [blame] | 9 | declare int %fputs(sbyte*, %struct._IO_FILE*) |
Reid Spencer | bb4cae7 | 2005-04-29 07:19:00 +0000 | [diff] [blame] | 10 | |
Reid Spencer | b282521 | 2005-04-29 10:10:17 +0000 | [diff] [blame] | 11 | %empty = constant [1 x sbyte] c"\00" |
| 12 | %len1 = constant [2 x sbyte] c"A\00" |
| 13 | %long = constant [7 x sbyte] c"hello\0A\00" |
| 14 | |
| 15 | implementation ; Functions: |
Reid Spencer | bb4cae7 | 2005-04-29 07:19:00 +0000 | [diff] [blame] | 16 | |
| 17 | int %main() { |
| 18 | entry: |
Reid Spencer | b282521 | 2005-04-29 10:10:17 +0000 | [diff] [blame] | 19 | %out = load %struct._IO_FILE** %stdout |
| 20 | %s1 = getelementptr [1 x sbyte]* %empty, int 0, int 0 |
| 21 | %s2 = getelementptr [2 x sbyte]* %len1, int 0, int 0 |
| 22 | %s3 = getelementptr [7 x sbyte]* %long, int 0, int 0 |
| 23 | %a = call int %fputs( sbyte* %s1, %struct._IO_FILE* %out ) |
| 24 | %b = call int %fputs( sbyte* %s2, %struct._IO_FILE* %out ) |
| 25 | %c = call int %fputs( sbyte* %s3, %struct._IO_FILE* %out ) |
| 26 | ret int 0 |
Reid Spencer | bb4cae7 | 2005-04-29 07:19:00 +0000 | [diff] [blame] | 27 | } |