aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Basic/SourceManager.cpp
diff options
context:
space:
mode:
authorJan Ječmen <JanJecmen@users.noreply.github.com>2024-12-12 17:11:07 +0100
committerGitHub <noreply@github.com>2024-12-12 17:11:07 +0100
commit60d9e6fba884048e1047a208b61f0dfd8baabaaa (patch)
tree3173ac85fe67f2627119a664f451d9a8beeb9fab /clang/lib/Basic/SourceManager.cpp
parent9c319d5bb40785c969d2af76535ca62448dfafa7 (diff)
downloadllvm-60d9e6fba884048e1047a208b61f0dfd8baabaaa.zip
llvm-60d9e6fba884048e1047a208b61f0dfd8baabaaa.tar.gz
llvm-60d9e6fba884048e1047a208b61f0dfd8baabaaa.tar.bz2
[IRCE] Relax profitability check (#104659)
IRCE currently has two profitability checks: 1. min number of iterations (10 by default) 2. branch is highly biased (> 15/16) However, it may still be profitable to eliminate range checks even if the branch isn't as biased. Consider, for example, a loop with 100 iterations, where IRCE currently eliminates all 100 range checks. The same range checks performed over a loop with 200 iterations aren't eliminated because the branch is 50-50. This patch proposes to relax the profitability checks of IRCE. Namely, instead of the two checks currenly in place, consider IRCE profitable if the branch probability scaled by the expected number of iterations (i.e., the estimated number of eliminated checks) is over a threshold. This covers the minimum number of iterations check (there are at least as many iterations as eliminated range checks), and changes the bias check from a percent of iterations to at least a constant threshold of eliminated checks. If the number of iterations can't be estimated, the check falls back to the current 15/16 likelihood check.
Diffstat (limited to 'clang/lib/Basic/SourceManager.cpp')
0 files changed, 0 insertions, 0 deletions