[PATCH] D144319: [SimplifyCFG] Check if the return instruction causes undefined behavior

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Feb 18 06:10:56 PST 2023


nikic added inline comments.


================
Comment at: llvm/lib/Transforms/Utils/SimplifyCFG.cpp:7137
+      if (C->isNullValue() &&
+          Ret->getFunction()->hasRetAttribute(Attribute::NonNull)) {
+        return true;
----------------
DianQK wrote:
> nikic wrote:
> > This requires both nonnull and noundef.
> Thanks for the review. According to the LangRef manual, is it a convention to pair nonnull with noundef?
nonnull by itself only converts the return value to poison. noundef converts poison into IUB. Frontends will generally place both attributes.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D144319



More information about the llvm-commits mailing list