aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2023-07-16 23:53:56 +0200
committerJan Hubicka <jh@suse.cz>2023-07-16 23:53:56 +0200
commit1d203d4c90adb064edfa9680768d1f83a41f17e0 (patch)
treea84977faaec69674e0a3573d3fac2df02a283ef4
parentd76d19c9bc5ef1138af65fa3546eb628b7a756c9 (diff)
downloadgcc-1d203d4c90adb064edfa9680768d1f83a41f17e0.zip
gcc-1d203d4c90adb064edfa9680768d1f83a41f17e0.tar.gz
gcc-1d203d4c90adb064edfa9680768d1f83a41f17e0.tar.bz2
Avoid double profile udpate in try_peel_loop
try_peel_loop uses gimple_duplicate_loop_body_to_header_edge which subtracts the profile from the original loop. However then it tries to scale the profile in a wrong way (it forces header count to be entry count). This eliminates to profile misupdates in the internal loop of sphinx3. gcc/ChangeLog: PR middle-end/110649 * tree-ssa-loop-ivcanon.cc (try_peel_loop): Avoid double profile update.
-rw-r--r--gcc/tree-ssa-loop-ivcanon.cc13
1 files changed, 1 insertions, 12 deletions
diff --git a/gcc/tree-ssa-loop-ivcanon.cc b/gcc/tree-ssa-loop-ivcanon.cc
index 0117dbf..bdb738a 100644
--- a/gcc/tree-ssa-loop-ivcanon.cc
+++ b/gcc/tree-ssa-loop-ivcanon.cc
@@ -1152,6 +1152,7 @@ try_peel_loop (class loop *loop,
}
if (may_be_zero)
bitmap_clear_bit (wont_exit, 1);
+
if (!gimple_duplicate_loop_body_to_header_edge (
loop, loop_preheader_edge (loop), npeel, wont_exit, exit,
&edges_to_remove, DLTHE_FLAG_UPDATE_FREQ))
@@ -1168,18 +1169,6 @@ try_peel_loop (class loop *loop,
adjust_loop_info_after_peeling (loop, npeel, true);
profile_count entry_count = profile_count::zero ();
- edge e;
- edge_iterator ei;
- FOR_EACH_EDGE (e, ei, loop->header->preds)
- if (e->src != loop->latch)
- {
- if (e->src->count.initialized_p ())
- entry_count += e->src->count;
- gcc_assert (!flow_bb_inside_loop_p (loop, e->src));
- }
- profile_probability p;
- p = entry_count.probability_in (loop->header->count);
- scale_loop_profile (loop, p, -1);
bitmap_set_bit (peeled_loops, loop->num);
return true;
}