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

Dávid Bolvanský via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 22 01:48:03 PST 2018


xbolva00 added inline comments.


================
Comment at: lib/Transforms/Utils/SimplifyLibCalls.cpp:196
+  if (CI->getArgOperand(ArgNo)->getType()->getPointerAddressSpace())
+    return false;
+
----------------
jdoerfert wrote:
> I don't get this check. Can you explain it to me (potentially in a comment)?
In some AS, dereferencing null ptr may be fine. See discussion: https://reviews.llvm.org/D53666

Maybe this is not a proper check, well, suggestions welcome


================
Comment at: lib/Transforms/Utils/SimplifyLibCalls.cpp:416
+    dropNonNullParam(CI, 0);
+    dropNonNullParam(CI, 1);
     return nullptr;
----------------
jdoerfert wrote:
> It seems fragile to drop the non-null conditionally only. Shouldn't we always drop it and add it back if possible?
Ideally it should be on Clang side. They had tried but the solutions were reverted after miscompiles.


https://reviews.llvm.org/D53342





More information about the llvm-commits mailing list