diff options
author | Michael Zolotukhin <mzolotukhin@apple.com> | 2016-12-20 23:03:42 +0000 |
---|---|---|
committer | Michael Zolotukhin <mzolotukhin@apple.com> | 2016-12-20 23:03:42 +0000 |
commit | e909a6ed355e50bf558d920176a9a81ae07b779b (patch) | |
tree | 656fafc539929743edb5863e8c951b37f19925d4 /llvm/lib/Support | |
parent | 4f392d3fa3867a053ce0ac4282e456d7c4392697 (diff) | |
download | bcm5719-llvm-e909a6ed355e50bf558d920176a9a81ae07b779b.tar.gz bcm5719-llvm-e909a6ed355e50bf558d920176a9a81ae07b779b.zip |
[SCEV] Be less conservative when extending bitwidths for computing ranges.
Summary:
In getRangeForAffineAR we compute ranges for affine exprs E = A + B*C,
where ranges for A, B, and C are known. To avoid overflow, we need to
operate on a bigger bitwidth, and originally we chose 2*x+1 for this
(x being the original bitwidth). However, it is safe to use just 2*x:
A+B*C <= (2^x - 1) + (2^x - 1)*(2^x - 1) =
= 2^x - 1 + 2^2x - 2^x - 2^x + 1 =
= 2^2x - 2^x <= 2^2x - 1
Unnecessary extending of bitwidths results in noticeable slowdowns: ranges
perform arithmetic operations using APInt, which are much slower when bitwidths
are bigger than 64.
Reviewers: sanjoy, majnemer, chandlerc
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D27795
llvm-svn: 290211
Diffstat (limited to 'llvm/lib/Support')
0 files changed, 0 insertions, 0 deletions