1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -instcombine -S | FileCheck %s
4 declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture, i8* nocapture, i32, i1) nounwind
5 declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture, i64, i1) nounwind
9 define void @test1(i8* %a) {
10 ; CHECK-LABEL: @test1(
11 ; CHECK-NEXT: ret void
13 tail call void @llvm.memcpy.p0i8.p0i8.i32(i8* %a, i8* %a, i32 100, i1 false)
17 ; PR8267 - same src/dest, but volatile.
19 define void @test2(i8* %a) {
20 ; CHECK-LABEL: @test2(
21 ; CHECK-NEXT: tail call void @llvm.memcpy.p0i8.p0i8.i32(i8* [[A:%.*]], i8* [[A]], i32 100, i1 true)
22 ; CHECK-NEXT: ret void
24 tail call void @llvm.memcpy.p0i8.p0i8.i32(i8* %a, i8* %a, i32 100, i1 true)
28 ; 17179869184 == 0x400000000 - make sure that doesn't get truncated to 32-bit.
30 define void @test3(i8* %d, i8* %s) {
31 ; CHECK-LABEL: @test3(
32 ; CHECK-NEXT: tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* nonnull align 4 dereferenceable(17179869184) [[D:%.*]], i8* nonnull align 4 dereferenceable(17179869184) [[S:%.*]], i64 17179869184, i1 false)
33 ; CHECK-NEXT: ret void
35 tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 4 %d, i8* align 4 %s, i64 17179869184, i1 false)
39 @UnknownConstant = external constant i128
41 define void @memcpy_to_constant(i8* %src) {
42 ; CHECK-LABEL: @memcpy_to_constant(
43 ; CHECK-NEXT: ret void
45 %dest = bitcast i128* @UnknownConstant to i8*
46 call void @llvm.memcpy.p0i8.p0i8.i32(i8* %dest, i8* %src, i32 16, i1 false)