[PATCH] D53342: [SimplifyLibCalls] Mark known arguments with nonnull

Johannes Doerfert via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 19 22:09:51 PDT 2019


jdoerfert added inline comments.


================
Comment at: lib/Transforms/Utils/SimplifyLibCalls.cpp:2381
+  else
+    removeNonNull(CI, {0});
+
----------------
xbolva00 wrote:
> jdoerfert wrote:
> > We could even use "isKnownNonZero" or other helper functions here.
> This is true but since we we need to compute ā€œNā€ anyway, I think isKnownNonZero is a overkill a bit, since it computes what we already have - ā€œNā€. - should I use it even here?
> 
> But I could use it in some places, yes,  (memcpy/memmove/memset)..
For a lot of calls a nonnull size implies other stuff, especially, noalias, deref_or_null.
I think this is worth a separate patch but doing better nonnull checks makes sense because any value (not necessarily a constant) that is not zero will allow us to infer (1) nonnull, (2) noalias, (3) deref_or_null. If we want the constant size for some other transformations we should first look for a constant and only as a fallback call `isknownnonzero`.


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

https://reviews.llvm.org/D53342





More information about the llvm-commits mailing list