[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:38:22 PST 2008
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;}
In this case, the strcmp gets turned into a 16-bit load. However, the
byte after the end of the string isn't guaranteed to be readable.
-Eli
More information about the llvm-commits
mailing list