[PATCH] D90529: Allow nonnull attribute to accept poison

Johannes Doerfert via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 2 08:41:16 PST 2020


jdoerfert accepted this revision.
jdoerfert added a comment.
This revision is now accepted and ready to land.

Some nits. I think the direction is right. Update the commit message though. And please wait for an OK by @efriedma .



================
Comment at: llvm/docs/LangRef.rst:1227
+    :ref:`poison value <poisonvalues>` is returned or passed instead of
+    undefined behavior.
 
----------------
Mention the combination with `noundef` please.


================
Comment at: llvm/lib/Analysis/ValueTracking.cpp:2204
           if (CB->getArgOperand(Arg.getArgNo()) == V &&
-              Arg.hasNonNullAttr() && DT->dominates(CB, CtxI))
+              Arg.hasNonNullAttr(false) && DT->dominates(CB, CtxI))
             return true;
----------------
`/* AllowUndefOrPoison */ false`


================
Comment at: llvm/lib/Transforms/IPO/FunctionAttrs.cpp:644
         for (auto &CSArg : CalledFunc->args()) {
-          if (!CSArg.hasNonNullAttr())
+          if (!CSArg.hasNonNullAttr(false))
             continue;
----------------
see  above.


================
Comment at: llvm/test/Analysis/ValueTracking/known-nonnull-at.ll:5
+declare void @bar(i8* %a, i8* nonnull noundef %b)
+declare void @bar2(i8* %a, i8* nonnull %b)
 
----------------
maybe rename to make it clear at the call site


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D90529



More information about the llvm-commits mailing list