Revert "Change memcpy/memset/memmove to have dest and source alignments."
[oota-llvm.git] / test / Transforms / MemCpyOpt / capturing-func.ll
1 ; RUN: opt < %s -basicaa -memcpyopt -S | FileCheck %s
2
3 target datalayout = "e"
4
5 declare void @foo(i8*)
6 declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture, i8* nocapture, i32, i32, i1) nounwind
7
8 define void @test() {
9   %ptr1 = alloca i8
10   %ptr2 = alloca i8
11   call void @foo(i8* %ptr2)
12   call void @llvm.memcpy.p0i8.p0i8.i32(i8* %ptr1, i8* %ptr2, i32 1, i32 1, i1 false)
13   call void @foo(i8* %ptr1)
14   ret void
15
16   ; Check that the transformation isn't applied if the called function can
17   ; capture the pointer argument (i.e. the nocapture attribute isn't present)
18   ; CHECK-LABEL: @test(
19   ; CHECK: call void @foo(i8* %ptr2)
20   ; CHECK-NEXT: call void @llvm.memcpy
21   ; CHECK-NEXT: call void @foo(i8* %ptr1)
22 }