mirror of
https://github.com/RPCS3/llvm.git
synced 2026-07-21 03:05:26 -04:00
[SLC] Improve dereferenceable bytes annotation
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@368715 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -188,8 +188,12 @@ static bool canTransformToMemCmp(CallInst *CI, Value *Str, uint64_t Len,
|
||||
|
||||
static void annotateDereferenceableBytes(CallInst *CI,
|
||||
ArrayRef<unsigned> ArgNos,
|
||||
uint64_t DerefBytes) {
|
||||
uint64_t DereferenceableBytes) {
|
||||
for (unsigned ArgNo : ArgNos) {
|
||||
uint64_t DerefBytes = std::max(
|
||||
CI->getDereferenceableOrNullBytes(ArgNo + AttributeList::FirstArgIndex),
|
||||
DereferenceableBytes);
|
||||
|
||||
if (CI->getDereferenceableBytes(ArgNo + AttributeList::FirstArgIndex) <
|
||||
DerefBytes) {
|
||||
CI->removeParamAttr(ArgNo, Attribute::Dereferenceable);
|
||||
|
||||
@@ -48,7 +48,7 @@ define i32 @memcmp_const_size_no_update_deref(i8* nocapture readonly %d, i8* noc
|
||||
|
||||
define i32 @memcmp_const_size_no_update_deref2(i8* nocapture readonly %d, i8* nocapture readonly %s) {
|
||||
; CHECK-LABEL: @memcmp_const_size_no_update_deref2(
|
||||
; CHECK-NEXT: [[CALL:%.*]] = tail call i32 @memcmp(i8* dereferenceable(16) [[D:%.*]], i8* dereferenceable(16) [[S:%.*]], i64 16)
|
||||
; CHECK-NEXT: [[CALL:%.*]] = tail call i32 @memcmp(i8* dereferenceable(40) [[D:%.*]], i8* dereferenceable(16) [[S:%.*]], i64 16)
|
||||
; CHECK-NEXT: ret i32 [[CALL]]
|
||||
;
|
||||
%call = tail call i32 @memcmp(i8* dereferenceable_or_null(40) %d, i8* %s, i64 16)
|
||||
|
||||
Reference in New Issue
Block a user