blob: a127fd329f0a5cc96bf86bbc643502b39f13f662 [file] [log] [blame]
Reid Spencer89011b62005-04-26 07:40:40 +00001; Test that the StrCatOptimizer works correctly
Reid Spencerd0e30dc2006-12-02 04:23:10 +00002; RUN: llvm-upgrade < %s | llvm-as | opt -constprop -simplify-libcalls -disable-output &&
3; RUN: llvm-upgrade < %s | llvm-as | opt -constprop -simplify-libcalls | llvm-dis | not grep 'call.*llvm.memcpy'
Reid Spencer89011b62005-04-26 07:40:40 +00004
5declare sbyte* %llvm.memcpy(sbyte*,sbyte*,int,int)
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
10implementation ; Functions:
11
12int %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
18 call sbyte* %llvm.memcpy(sbyte* %target_p, sbyte* %h_p, int 2, int 2)
19 call sbyte* %llvm.memcpy(sbyte* %target_p, sbyte* %hel_p, int 4, int 4)
20 call sbyte* %llvm.memcpy(sbyte* %target_p, sbyte* %hello_u_p, int 8, int 8)
21 ret int 0
22}