67 lines · plain
1; Test that the strcpy library call simplifier works correctly for ARM procedure calls2; RUN: opt < %s -passes=instcombine -S | FileCheck %s3;4; This transformation requires the pointer size, as it assumes that size_t is5; the size of a pointer.6target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"7 8@hello = constant [6 x i8] c"hello\00"9@a = common global [32 x i8] zeroinitializer, align 110@b = common global [32 x i8] zeroinitializer, align 111 12declare ptr @strcpy(ptr, ptr)13 14define arm_aapcscc void @test_simplify1() {15; CHECK-LABEL: @test_simplify1(16 17 18 call arm_aapcscc ptr @strcpy(ptr @a, ptr @hello)19; CHECK: @llvm.memcpy.p0.p0.i3220 ret void21}22 23define arm_aapcscc ptr @test_simplify2() {24; CHECK-LABEL: @test_simplify2(25 26 27 %ret = call arm_aapcscc ptr @strcpy(ptr @a, ptr @a)28; CHECK: ret ptr @a29 ret ptr %ret30}31 32define arm_aapcscc ptr @test_no_simplify1() {33; CHECK-LABEL: @test_no_simplify1(34 35 36 %ret = call arm_aapcscc ptr @strcpy(ptr @a, ptr @b)37; CHECK: call arm_aapcscc ptr @strcpy38 ret ptr %ret39}40 41define arm_aapcs_vfpcc void @test_simplify1_vfp() {42; CHECK-LABEL: @test_simplify1_vfp(43 44 45 call arm_aapcs_vfpcc ptr @strcpy(ptr @a, ptr @hello)46; CHECK: @llvm.memcpy.p0.p0.i3247 ret void48}49 50define arm_aapcs_vfpcc ptr @test_simplify2_vfp() {51; CHECK-LABEL: @test_simplify2_vfp(52 53 54 %ret = call arm_aapcs_vfpcc ptr @strcpy(ptr @a, ptr @a)55; CHECK: ret ptr @a56 ret ptr %ret57}58 59define arm_aapcs_vfpcc ptr @test_no_simplify1_vfp() {60; CHECK-LABEL: @test_no_simplify1_vfp(61 62 63 %ret = call arm_aapcs_vfpcc ptr @strcpy(ptr @a, ptr @b)64; CHECK: call arm_aapcs_vfpcc ptr @strcpy65 ret ptr %ret66}67