• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt < %s -instcombine -S | FileCheck %s
2
3declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture, i8* nocapture, i32, i1) nounwind
4declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture, i64, i1) nounwind
5
6; Same src/dest.
7
8define void @test1(i8* %a) {
9; CHECK-LABEL: @test1(
10; CHECK-NEXT:    ret void
11;
12  tail call void @llvm.memcpy.p0i8.p0i8.i32(i8* %a, i8* %a, i32 100, i1 false)
13  ret void
14}
15
16; PR8267 - same src/dest, but volatile.
17
18define void @test2(i8* %a) {
19; CHECK-LABEL: @test2(
20; CHECK-NEXT:    tail call void @llvm.memcpy.p0i8.p0i8.i32(i8* %a, i8* %a, i32 100, i1 true)
21; CHECK-NEXT:    ret void
22;
23  tail call void @llvm.memcpy.p0i8.p0i8.i32(i8* %a, i8* %a, i32 100, i1 true)
24  ret void
25}
26
27; 17179869184 == 0x400000000 - make sure that doesn't get truncated to 32-bit.
28
29define void @test3(i8* %d, i8* %s) {
30; CHECK-LABEL: @test3(
31; CHECK-NEXT:    tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 4 %d, i8* align 4 %s, i64 17179869184, i1 false)
32; CHECK-NEXT:    ret void
33;
34  tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 4 %d, i8* align 4 %s, i64 17179869184, i1 false)
35  ret void
36}
37
38