summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Hello
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-04-17 18:36:24 +0000
committerChris Lattner <sabre@nondot.org>2004-04-17 18:36:24 +0000
commit4021d1af5a1108f36456969b6d9aa2199514bc2d (patch)
treeb02d767c7ac526c82c0102eaac04dbda4119382d /llvm/lib/Transforms/Hello
parent1e9ac1a45e7a84fec8ebad9aeebdbea21ebdbc06 (diff)
downloadbcm5719-llvm-4021d1af5a1108f36456969b6d9aa2199514bc2d.tar.gz
bcm5719-llvm-4021d1af5a1108f36456969b6d9aa2199514bc2d.zip
Add the ability to compute trip counts that are only controlled by constants
even if the loop is using expressions that we can't compute as a closed-form. This allows us to calculate that this function always returns 55: int test() { double X; int Count = 0; for (X = 100; X > 1; X = sqrt(X), ++Count) /*empty*/; return Count; } And allows us to compute trip counts for loops like: int h = 1; do h = 3 * h + 1; while (h <= 256); (which occurs in bzip2), and for this function, which occurs after inlining and other optimizations: int popcount() { int x = 666; int result = 0; while (x != 0) { result = result + (x & 0x1); x = x >> 1; } return result; } We still cannot compute the exit values of result or h in the two loops above, which means we cannot delete the loop, but we are getting closer. Being able to compute a constant trip count for these two loops will allow us to unroll them completely though. llvm-svn: 13017
Diffstat (limited to 'llvm/lib/Transforms/Hello')
0 files changed, 0 insertions, 0 deletions
OpenPOWER on IntegriCloud