[PATCH] Switch lowering: extract jump tables and bit tests before building binary tree (PR22262)
Hans Wennborg
hans at chromium.org
Thu Apr 23 10:57:24 PDT 2015
Anton asked me at Euro-LLVM if it was possible to construct a switch that exhibits the worst-case properties of the old switch lowering. I believe the attached file does that: F476439: bad.c.gz <http://reviews.llvm.org/F476439>. It's 10k-case switch where the distance between cases increases linearly.
(I used perf stat -r5 for the timings except for slow run which I only ran once.)
Without my patch:
clang -O0: 3.26 s ( +- 2.34% )
clang -O3: 7.43 s ( +- 3.49% )
./a.out: ~40 s
With my patch:
clang -O0: 0.76 s ( +- 3.04% )
clang -O3: 6.24 s ( +- 3.33% )
./a.out: 0.32 s ( +- 0.23% )
REPOSITORY
rL LLVM
http://reviews.llvm.org/D8649
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
More information about the llvm-commits
mailing list