[PATCH] D64859: [InstCombine] strncmp(x,y,strlen(x|y)+1) -> strcmp(x,y)

Dávid Bolvanský via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 30 14:26:28 PDT 2019


xbolva00 accepted this revision.
xbolva00 marked an inline comment as done.
xbolva00 added inline comments.
This revision is now accepted and ready to land.


================
Comment at: lib/Transforms/Utils/SimplifyLibCalls.cpp:405
+      if (!TLI->getLibFunc(*InnerCallee, Func) || !TLI->has(Func) ||
+          Func != LibFunc_strlen)
+        return nullptr;
----------------
efriedma wrote:
> It's not enough to check that the Strlen is a call to strlen; you also have to prove the memory isn't modified between the strlen call and the strncmp call.
Ah yes! I forget about it. :(

I believe such analysis is not worth to do for this pattern.

Closing..


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

https://reviews.llvm.org/D64859





More information about the llvm-commits mailing list