1 ; RUN: opt -S -basicaa -dse < %s | FileCheck %s
3 declare i8* @strcpy(i8* %dest, i8* %src) nounwind
4 define void @test1(i8* %src) {
7 %dest = getelementptr inbounds [16 x i8], [16 x i8]* %B, i64 0, i64 0
9 %call = call i8* @strcpy(i8* %dest, i8* %src)
14 declare i8* @strncpy(i8* %dest, i8* %src, i32 %n) nounwind
15 define void @test2(i8* %src) {
16 ; CHECK-LABEL: @test2(
18 %dest = getelementptr inbounds [16 x i8], [16 x i8]* %B, i64 0, i64 0
20 %call = call i8* @strncpy(i8* %dest, i8* %src, i32 12)
25 declare i8* @strcat(i8* %dest, i8* %src) nounwind
26 define void @test3(i8* %src) {
27 ; CHECK-LABEL: @test3(
29 %dest = getelementptr inbounds [16 x i8], [16 x i8]* %B, i64 0, i64 0
31 %call = call i8* @strcat(i8* %dest, i8* %src)
36 declare i8* @strncat(i8* %dest, i8* %src, i32 %n) nounwind
37 define void @test4(i8* %src) {
38 ; CHECK-LABEL: @test4(
40 %dest = getelementptr inbounds [16 x i8], [16 x i8]* %B, i64 0, i64 0
42 %call = call i8* @strncat(i8* %dest, i8* %src, i32 12)
47 define void @test5(i8* nocapture %src) {
48 ; CHECK-LABEL: @test5(
49 %dest = alloca [100 x i8], align 16
50 %arraydecay = getelementptr inbounds [100 x i8], [100 x i8]* %dest, i64 0, i64 0
51 %call = call i8* @strcpy(i8* %arraydecay, i8* %src)
52 ; CHECK: %call = call i8* @strcpy
53 %arrayidx = getelementptr inbounds i8, i8* %call, i64 10
54 store i8 97, i8* %arrayidx, align 1
58 declare void @user(i8* %p)
59 define void @test6(i8* %src) {
60 ; CHECK-LABEL: @test6(
62 %dest = getelementptr inbounds [16 x i8], [16 x i8]* %B, i64 0, i64 0
64 %call = call i8* @strcpy(i8* %dest, i8* %src)
66 call void @user(i8* %dest)