[llvm-commits] [llvm] r61297 - in /llvm/trunk: lib/Transforms/Scalar/SimplifyLibCalls.cpp test/Transforms/SimplifyLibCalls/2008-12-20-StrcmpMemcmp.ll

Eli Friedman eli.friedman at gmail.com
Sat Dec 20 16:39:23 PST 2008


On Sat, Dec 20, 2008 at 4:38 PM, Eli Friedman <eli.friedman at gmail.com> wrote:
> On Sat, Dec 20, 2008 at 4:19 PM, Nick Lewycky <nicholas at mxc.ca> wrote:
>> Author: nicholas
>> Date: Sat Dec 20 18:19:21 2008
>> New Revision: 61297
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=61297&view=rev
>> Log:
>> Turn strcmp into memcmp, such as strcmp(P, "x") --> memcmp(P, "x", 2).
>
> I'm pretty sure this isn't safe; take the following testcase:
>
> int foo(char* x) {return strcmp(x, "x", 2) == 0;}

Oops, messed that up slightly; try the following:
int foo(char* x) {return strcmp(x, "x") == 0;}

-Eli



More information about the llvm-commits mailing list