[PATCH] D146629: [SimplifyCFG][LICM] Preserve nonnull, range and align metadata when speculating

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 22 06:46:13 PDT 2023


nikic created this revision.
nikic added reviewers: nlopes, jdoerfert, efriedma, StephenFan.
Herald added subscribers: asbirlea, hiraditya.
Herald added a project: All.
nikic requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

After D141386 <https://reviews.llvm.org/D141386>, violation of nonnull, range and align metadata results in poison rather than immediate undefined behavior, which means that these are now safe to retain when speculating. We only need to remove UB-implying metadata like noundef.

This is done by adding a `dropUBImplyingAttrsAndMetadata()` helper, which lists the metadata which is known safe to retain on speculation.


https://reviews.llvm.org/D146629

Files:
  llvm/include/llvm/IR/Instruction.h
  llvm/lib/IR/Instruction.cpp
  llvm/lib/Transforms/Scalar/LICM.cpp
  llvm/lib/Transforms/Utils/Local.cpp
  llvm/lib/Transforms/Utils/SimplifyCFG.cpp
  llvm/test/Transforms/LICM/hoist-metadata.ll
  llvm/test/Transforms/SimplifyCFG/hoist-with-metadata.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D146629.507344.patch
Type: text/x-patch
Size: 8496 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230322/a2231d30/attachment.bin>


More information about the llvm-commits mailing list