[PATCH] D65402: [Attributor][MustExec] Deduce dereferenceable and nonnull attribute using MustBeExecutedContextExplorer

Hideto Ueno via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 29 10:15:57 PDT 2019


uenoku added a comment.

In D65402#1604695 <https://reviews.llvm.org/D65402#1604695>, @xbolva00 wrote:

> What about
>
> memcmp(a,b,16) ? Do we infer that a,b are nonnull and deref(16)?
>
> Same for many libc functions..


It can't be inferred in current attributes set.

To infer this, I think we need to introduce a new attribute similar to `allocsize` something like:
`dereferenceable_arg(argno)`: dereferenceable size depends on argno-th argument value
ex)

  declare i32 @memcmp(i8* dereferenceable_arg(2), i8* dereferenceable_arg(2), i64) 

If we add this attribute and annotate libc function, I think the deduction is not so hard.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D65402/new/

https://reviews.llvm.org/D65402





More information about the llvm-commits mailing list