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

Max Kazantsev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Oct 16 22:55:12 PDT 2022


mkazantsev created this revision.
mkazantsev added reviewers: aeubanks, nikic, lebedev.ri, spatel.
Herald added subscribers: okura, kuter, hiraditya.
Herald added a project: All.
mkazantsev requested review of this revision.
Herald added a reviewer: jdoerfert.
Herald added a reviewer: sstefan1.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

According to LangRef:

  If the loaded or returned value is not in the specified range, the behavior is undefined. 
  ...
  The range should not represent the full or empty set. That is, a!=b.

These statements together mean that the result of load which contains !range metadata
is immediate of UB if undef is loaded, because undef may take the value missing in the
range. It automatically implies it's not poison either.


https://reviews.llvm.org/D136055

Files:
  llvm/lib/Analysis/ValueTracking.cpp
  llvm/test/Transforms/Attributor/dereferenceable-1.ll
  llvm/test/Transforms/Attributor/range.ll
  llvm/test/Transforms/InstCombine/freeze.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D136055.468122.patch
Type: text/x-patch
Size: 12562 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221017/4054b837/attachment.bin>


More information about the llvm-commits mailing list