[cfe-commits] [PATCH] Optimize NumericLiteralParser::GetIntegerValue()

Jordan Rose jordan_rose at apple.com
Tue Sep 25 11:47:50 PDT 2012


Seems like a good idea. The llvm_unreachable should probably be in a default case, though, to pacify -Wswitch-whatever. Radices are not enums. :-)

Jordan


On Sep 25, 2012, at 11:28 , Dmitri Gribenko <gribozavr at gmail.com> wrote:

> Hello,
> 
> NumericLiteralParser::GetIntegerValue() does a conservative estimate
> on the size of numbers that can fit into uint64_t.  This bound can be
> improved.  See the attached patch.
> 
> I see a 0.240s -> 0.160s reduction on -fsyntax-only time in a Release
> clang build on a source file generated by the following python script:
> 
> for i in xrange(0, 2000):
>    print "void func{0}() {{".format(i)
>    for j in xrange(0, 100):
>      print "123456789012345678;"
>    print "}"
> 
> Please review.  I know that this patch sort-of falls into the
> "obvious" bucket, but I wanted to make sure that this patch is
> appropriate.
> 
> Dmitri
> 
> -- 
> main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
> (j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/
> <optimize-NumericLiteralParser-GetIntegerValue-v1.patch>_______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits




More information about the cfe-commits mailing list