mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-18 01:35:44 +00:00
Emit memcmp directly from the StringMatcherEmitter.
There should be no difference in the resulting binary, given a sufficiently smart compiler. However we already had compiler timeouts on the generated code in Intrinsics.gen, this hopefully makes the lives of slow buildbots a little easier. llvm-svn: 157161
This commit is contained in:
parent
e42f976213
commit
d8782377c7
@ -87,11 +87,11 @@ EmitStringMatcherForChar(const std::vector<const StringPair*> &Matches,
|
||||
<< Matches[0]->first[CharNo] << "')\n";
|
||||
OS << Indent << " break;\n";
|
||||
} else {
|
||||
// Do the comparison with if (Str.substr(1, 3) != "foo").
|
||||
// Do the comparison with if memcmp(Str.data()+1, "foo", 3).
|
||||
// FIXME: Need to escape general strings.
|
||||
OS << Indent << "if (" << StrVariableName << ".substr(" << CharNo << ", "
|
||||
<< NumChars << ") != \"";
|
||||
OS << Matches[0]->first.substr(CharNo, NumChars) << "\")\n";
|
||||
OS << Indent << "if (memcmp(" << StrVariableName << ".data()+" << CharNo
|
||||
<< ", \"" << Matches[0]->first.substr(CharNo, NumChars) << "\", "
|
||||
<< NumChars << "))\n";
|
||||
OS << Indent << " break;\n";
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user