1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2; RUN: opt -instcombine  -S < %s | FileCheck %s
3
4declare i32 @memcmp(i8 addrspace(1)* nocapture, i8* nocapture, i64)
5
6define i32 @memcmp_const_size_update_deref(i8 addrspace(1)* nocapture readonly %d, i8* nocapture readonly %s) {
7; CHECK-LABEL: @memcmp_const_size_update_deref(
8; CHECK-NEXT:    [[CALL:%.*]] = tail call i32 @memcmp(i8 addrspace(1)* dereferenceable(16) dereferenceable_or_null(40) [[D:%.*]], i8* nonnull dereferenceable(16) [[S:%.*]], i64 16)
9; CHECK-NEXT:    ret i32 [[CALL]]
10;
11  %call = tail call i32 @memcmp(i8 addrspace(1)* dereferenceable_or_null(40) %d, i8* %s, i64 16)
12  ret i32 %call
13}
14
15define i32 @memcmp_nonconst_size_nonnnull(i8 addrspace(1)* nocapture readonly %d, i8* nocapture readonly %s, i64 %n) {
16; CHECK-LABEL: @memcmp_nonconst_size_nonnnull(
17; CHECK-NEXT:    [[CALL:%.*]] = tail call i32 @memcmp(i8 addrspace(1)* nonnull dereferenceable_or_null(40) [[D:%.*]], i8* nonnull [[S:%.*]], i64 [[N:%.*]])
18; CHECK-NEXT:    ret i32 [[CALL]]
19;
20  %call = tail call i32 @memcmp(i8 addrspace(1)* nonnull dereferenceable_or_null(40) %d, i8* nonnull %s, i64 %n)
21  ret i32 %call
22}
23