diff mbox

[1/8] Take maximum spec when merging exprs

Message ID 1312385438-6273-2-git-send-email-amonakov@ispras.ru
State New
Headers show

Commit Message

Alexander Monakov Aug. 3, 2011, 3:30 p.m. UTC
From: Dmitry Melnik <dm@ispras.ru>

EXPR_SPEC is an indicator of the speculativeness of an expression (an
instruction or just an rhs), as it is incremented each time the expression is
moved up across a conditional branch.  When merging expr attributes for
similar exprs available from two destinations of a branch, sel-sched assigns
the minimum of EXPR_SPEC's to the result, effectively making the resulting
expr non-speculative if only one of those exprs was non-speculative.  However,
since we are relying on EXPR_SPEC being a correct indication of expr's
speculativeness when deciding whether it would need a bookkeeping copy, we
really want to avoid that.

The patch changes minimum to maximum, making the code match what was
originally intended.

2011-08-04  Dmitry Melnik  <dm@ispras.ru>

	* sel-sched-ir.c (merge_expr_data): Take maximum spec.

Comments

Vladimir Makarov Aug. 10, 2011, 7:46 p.m. UTC | #1
On 08/03/2011 11:30 AM, Alexander Monakov wrote:
> From: Dmitry Melnik<dm@ispras.ru>
>
> EXPR_SPEC is an indicator of the speculativeness of an expression (an
> instruction or just an rhs), as it is incremented each time the expression is
> moved up across a conditional branch.  When merging expr attributes for
> similar exprs available from two destinations of a branch, sel-sched assigns
> the minimum of EXPR_SPEC's to the result, effectively making the resulting
> expr non-speculative if only one of those exprs was non-speculative.  However,
> since we are relying on EXPR_SPEC being a correct indication of expr's
> speculativeness when deciding whether it would need a bookkeeping copy, we
> really want to avoid that.
>
> The patch changes minimum to maximum, making the code match what was
> originally intended.
>
> 2011-08-04  Dmitry Melnik<dm@ispras.ru>
>
> 	* sel-sched-ir.c (merge_expr_data): Take maximum spec.
OK, thanks.
diff mbox

Patch

diff --git a/gcc/sel-sched-ir.c b/gcc/sel-sched-ir.c
index de7629a..5a287d0 100644
--- a/gcc/sel-sched-ir.c
+++ b/gcc/sel-sched-ir.c
@@ -1810,9 +1810,9 @@  update_speculative_bits (expr_t to, expr_t from, insn_t split_point)
 void
 merge_expr_data (expr_t to, expr_t from, insn_t split_point)
 {
-  /* For now, we just set the spec of resulting expr to be minimum of the specs
-     of merged exprs.  */
-  if (EXPR_SPEC (to) > EXPR_SPEC (from))
+  /* Choose the maximum of the specs of merged exprs.  This is required
+     for correctness of bookkeeping.  */
+  if (EXPR_SPEC (to) < EXPR_SPEC (from))
     EXPR_SPEC (to) = EXPR_SPEC (from);
 
   if (split_point)