Reid Spencer | 4ac0f21 | 2005-04-26 07:40:40 +0000 | [diff] [blame] | 1 | ; Test that the StrCatOptimizer works correctly |
Reid Spencer | 43b4003 | 2007-04-16 15:31:49 +0000 | [diff] [blame] | 2 | ; RUN: llvm-upgrade < %s | llvm-as | opt -constprop -simplify-libcalls | \ |
| 3 | ; RUN: llvm-dis | not grep {call.*llvm.memcpy.i32} |
Reid Spencer | 4ac0f21 | 2005-04-26 07:40:40 +0000 | [diff] [blame] | 4 | |
Reid Spencer | 2e7e4f2 | 2006-12-02 20:41:53 +0000 | [diff] [blame] | 5 | declare void %llvm.memcpy.i32(sbyte*,sbyte*,uint,uint) |
Reid Spencer | 4ac0f21 | 2005-04-26 07:40:40 +0000 | [diff] [blame] | 6 | %h = constant [2 x sbyte] c"h\00" |
| 7 | %hel = constant [4 x sbyte] c"hel\00" |
| 8 | %hello_u = constant [8 x sbyte] c"hello_u\00" |
| 9 | |
| 10 | implementation ; Functions: |
| 11 | |
| 12 | int %main () { |
| 13 | %h_p = getelementptr [2 x sbyte]* %h, int 0, int 0 |
| 14 | %hel_p = getelementptr [4 x sbyte]* %hel, int 0, int 0 |
| 15 | %hello_u_p = getelementptr [8 x sbyte]* %hello_u, int 0, int 0 |
| 16 | %target = alloca [1024 x sbyte] |
| 17 | %target_p = getelementptr [1024 x sbyte]* %target, int 0, int 0 |
Reid Spencer | 2e7e4f2 | 2006-12-02 20:41:53 +0000 | [diff] [blame] | 18 | call void %llvm.memcpy.i32(sbyte* %target_p, sbyte* %h_p, uint 2, uint 2) |
| 19 | call void %llvm.memcpy.i32(sbyte* %target_p, sbyte* %hel_p, uint 4, uint 4) |
| 20 | call void %llvm.memcpy.i32(sbyte* %target_p, sbyte* %hello_u_p, uint 8, uint 8) |
Reid Spencer | 4ac0f21 | 2005-04-26 07:40:40 +0000 | [diff] [blame] | 21 | ret int 0 |
| 22 | } |