[PATCH] D50019: [InstCombine] Expand strcmp(s, "x") to memcmp

Dávid Bolvanský via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 30 15:45:56 PDT 2018


xbolva00 abandoned this revision.
xbolva00 added a comment.

In https://reviews.llvm.org/D50019#1181301, @efriedma wrote:

> Oh, okay, that makes more sense.
>
> Unfortunately, this transform is still illegal: if the unknown operand is the empty string, memcmp can read past the end of the string, which is undefined behavior (and may crash in practice).


Ah yes :/ I wanted to do similar transformation as GCC does. But with memcmp this is not possible.


https://reviews.llvm.org/D50019





More information about the llvm-commits mailing list