[all-commits] [llvm/llvm-project] 84a5d9: [LangRef] Make !range, !nonnull and !align return ...

Nikita Popov via All-commits all-commits at lists.llvm.org
Thu Jan 12 01:01:11 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 84a5d93f43cd92b489d3ee6327f88764364fdb26
      https://github.com/llvm/llvm-project/commit/84a5d93f43cd92b489d3ee6327f88764364fdb26
  Author: Nikita Popov <npopov at redhat.com>
  Date:   2023-01-12 (Thu, 12 Jan 2023)

  Changed paths:
    M llvm/docs/LangRef.rst

  Log Message:
  -----------
  [LangRef] Make !range, !nonnull and !align return poison instead of IUB

Make violation of !range, !nonnull and !align metadata return poison
instead of causing immediate undefined behavior. This makes the
behavior match that of the nonnull and align parameter and return
value attributes. The previous behavior can be restored by additionally
specifying the !noundef metadata, same as with parameters.

Some benefits of this change are:

 * This is needed to fix https://github.com/llvm/llvm-project/issues/59888.
   Under current semantics, it is illegal to add !range annotations
   based on known bits. Unless we want to drop that optimization
   entirely, we need to change the !range semantics.
 * This allows preserving range/nonnull/align metadata on
   speculated loads. !noundef metadata needs to be dropped, but
   the poison-generating metadata can be retained.

I don't think there are really disadvantages to the change (apart
from the need to review and adjust optimizations for the new
semantics), as the old behavior is still available via !noundef,
so it should be strictly more flexible.

Differential Revision: https://reviews.llvm.org/D141386




More information about the All-commits mailing list