[llvm-commits] PATCH: replace if-chain in AsmParser's directive parsing code

Eli Bendersky eliben at google.com
Tue Dec 18 11:14:10 PST 2012


> 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.

Eli




More information about the llvm-commits mailing list