[llvm-commits] PATCH: replace if-chain in AsmParser's directive parsing code
Chris Lattner
clattner at apple.com
Tue Dec 18 11:15:49 PST 2012
On Dec 18, 2012, at 11:14 AM, Eli Bendersky <eliben at google.com> wrote:
>> Just MHO, but this makes the code more complex and hopefully won't provide a speedup. We generally expect that:
>>
>> StringRef X = …
>>
>> if (X == "foo")
>> return ...
>> if (x == "bar")
>> return …
>>
>> to be turned into a switch on X[0].
>>
>
> I discussed this change with some folks on IRC prior to sending the
> patch, and the general concensus was that we don't actually do this
> for strings (and neither does GCC). But it would probably be best just
> to check...
>
> /me goes write some sample code to make sure.
Last I checked (and worked on memdep :), we did. This is the basis for us getting decent code out of StringSwitch.
-Chris
More information about the llvm-commits
mailing list