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