https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124383

--- Comment #4 from H.J. Lu <hjl.tools at gmail dot com> ---
This


diff --git a/gcc/predict.cc b/gcc/predict.cc
index 2859f64964b..a0ebd0872f7 100644
--- a/gcc/predict.cc
+++ b/gcc/predict.cc
@@ -235,7 +235,11 @@ probably_never_executed (struct function *fun,
profile_count count)
 bool
 probably_never_executed_bb_p (struct function *fun, const_basic_block bb)
 {
-  return probably_never_executed (fun, bb->count);
+   /* A basic block may be executed if it only has one predecessor which
+      may be executed.  */
+  return (probably_never_executed (fun, bb->count)
+    && (!single_pred_p (bb)
+        || probably_never_executed_bb_p (fun, single_pred (bb))));
 }

 /* Return true if edge E is unlikely executed for obvious reasons.  */

may be better.

Reply via email to