1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -basic-aa -memcpyopt -S -verify-memoryssa | FileCheck %s
4 target datalayout = "e"
7 declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture, i8* nocapture, i32, i1) nounwind
11 ; CHECK-NEXT: [[PTR1:%.*]] = alloca i8, align 1
12 ; CHECK-NEXT: [[PTR2:%.*]] = alloca i8, align 1
13 ; CHECK-NEXT: call void @foo(i8* [[PTR2]])
14 ; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i32(i8* [[PTR1]], i8* [[PTR2]], i32 1, i1 false)
15 ; CHECK-NEXT: call void @foo(i8* [[PTR1]])
16 ; CHECK-NEXT: ret void
20 call void @foo(i8* %ptr2)
21 call void @llvm.memcpy.p0i8.p0i8.i32(i8* %ptr1, i8* %ptr2, i32 1, i1 false)
22 call void @foo(i8* %ptr1)
25 ; Check that the transformation isn't applied if the called function can
26 ; capture the pointer argument (i.e. the nocapture attribute isn't present)