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

Johannes Doerfert via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 13 21:34:41 PDT 2019


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

Some minor nits, two questions that you could clarify or resolve, other than that I think this is fine.



================
Comment at: lib/Transforms/Utils/SimplifyLibCalls.cpp:638
+  AttrBuilder ArgAttrs(CI->getAttributes().getParamAttributes(0));
+  NewCI->getAttributes().addParamAttributes(CI->getContext(), 0, ArgAttrs);
   return Dst;
----------------
Somewhere above and somewhere below you copy all attributes, here only the param 0 attributes, is there a reason why?


================
Comment at: lib/Transforms/Utils/SimplifyLibCalls.cpp:1084
+    return Res;
+  annotateDereferenceableBytes(CI, {0, 1}, LenC->getZExtValue());
   return nullptr;
----------------
Leftover call.


================
Comment at: lib/Transforms/Utils/SimplifyLibCalls.cpp:2693
 
+  annotateNonNullBasedOnAccess(CI, 0);
   return nullptr;
----------------
Move to the beginning of the function, puts has often no users (IMHO).


================
Comment at: lib/Transforms/Utils/SimplifyLibCalls.cpp:3111
+        CI->getArgOperand(0), 1, CI->getArgOperand(1), 1, CI->getArgOperand(2));
+    NewCI->setAttributes(CI->getAttributes());
     return CI->getArgOperand(0);
----------------
Is there a reason this is not happening for the two functions below?


================
Comment at: test/Transforms/InstCombine/strstr-1.ll:91
+}
\ No newline at end of file

----------------
Add a newline at the end.


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

https://reviews.llvm.org/D53342





More information about the llvm-commits mailing list