[PATCH] D136055: [ValueTracking] Make !range metadata imply noundef for load & call results

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 18 08:55:47 PDT 2022


nikic added a comment.

In D136055#3865454 <https://reviews.llvm.org/D136055#3865454>, @mkazantsev wrote:

> In some sense, "range implies noundef" is the same thing as "dereferenceable implies noundef". There is no conceptual difference between "integer in specified range" and "pointer in a set of valid pointers". If we do it for dereferenceable pointers, why impede this for ranges?

The relevant difference in how this metadata gets used: APIs using range metadata generally only prove facts modulo poison. If computeKnownBits() says that the top bits of the value are zero, what this really means is that either the top bits are zero or the value is poison. The same is not true for dereferenceable metadata: This metadata is used to speculate loads, and having a "dereferenceable or poison" pointer would be useless in that context.


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

https://reviews.llvm.org/D136055



More information about the llvm-commits mailing list