[PATCH] D85894: [BuildLibCalls] Add more noundef to library functions

Juneyoung Lee via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 24 11:53:34 PDT 2020


aqjune added a comment.

In D85894#2234212 <https://reviews.llvm.org/D85894#2234212>, @eugenis wrote:

> LGTM
>
> Would it be better / easier to apply this to all functions by default, and then opt out some? Which ones would we even need to opt out? I imagine that would only be a handful of "weird" functions like open/openat (for the mode argument), maybe ioctl/fcntl.

There were a few tricky functions which could be introduced by optimizations. MergeICmps may transform icmps of loads into memcmp: since icmps of loads can yield poison, having noundef at memcmp's return value may introduce UB.
But, I agree that most of the functions will have noundef, and it should be applied by default after all noundef patches to library fns are landed. Noundefs are added one by one here for review process.

For functions that have conditionally unused arguments like open/openat - I think this is an interesting topic. If the mode argument is allowed to be undef, we can support dead argument elimination by analyzing whether it isn't creating a file. On the other hand, if the mode argument has noundef attribute, we can analyze that the value given to it is never undef.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D85894



More information about the llvm-commits mailing list