aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-if-conv.cc
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2024-09-26 11:43:21 +0200
committerRichard Biener <rguenth@gcc.gnu.org>2024-10-02 12:55:57 +0200
commit4ba4165d66b18d7c5b8af02ecdf38bfa0690c106 (patch)
tree508faef723bab6bc927259bc6c35e6b551466677 /gcc/tree-if-conv.cc
parentc534e37faccf481afa9bc28f0605ca0ec3846c89 (diff)
downloadgcc-4ba4165d66b18d7c5b8af02ecdf38bfa0690c106.zip
gcc-4ba4165d66b18d7c5b8af02ecdf38bfa0690c106.tar.gz
gcc-4ba4165d66b18d7c5b8af02ecdf38bfa0690c106.tar.bz2
tree-optimiztation/114855 - profile prediction slowness
The testcase in PR114855 shows profile prediction to evaluate the same SSA def via expr_expected_value for each condition or switch in a function. The following patch caches the expected value (and probability/predictor) for each visited SSA def, also protecting against recursion and thus obsoleting the visited bitmap. This reduces the time spent in branch prediction from 1.2s to 0.3s, though callgrind which was how I noticed this seems to be comparatively very much happier about the change than this number suggests. PR tree-optimization/114855 * predict.cc (ssa_expected_value): New global. (expr_expected_value): Do not take bitmap. (expr_expected_value_1): Likewise. Use ssa_expected_value to cache results for a SSA def. (tree_predict_by_opcode): Adjust. (tree_estimate_probability): Manage ssa_expected_value. (tree_guess_outgoing_edge_probabilities): Likewise.
Diffstat (limited to 'gcc/tree-if-conv.cc')
0 files changed, 0 insertions, 0 deletions