Re: [PATCH] Improve location for new statements in match-and-simplify phiopt

2021-12-18 Thread Richard Biener via Gcc-patches
On December 18, 2021 11:56:48 PM GMT+01:00, apinski--- via Gcc-patches 
 wrote:
>From: Andrew Pinski 
>
>Before match-and-simplify was used in phiot, the location of the
>new stamtents were all of that of the conditional, this adds that
>back as I did not realize gimple_simplify didn't do that for you.
>
>OK? Bootstrapped and tested on x86_64 with no regressions.

OK. 

Richard. 

>gcc/ChangeLog:
>
>   * tree-ssa-phiopt.c (gimple_simplify_phiopt): Annotate the
>   new sequence with the location of the conditional statement.
>---
> gcc/tree-ssa-phiopt.c | 4 
> 1 file changed, 4 insertions(+)
>
>diff --git a/gcc/tree-ssa-phiopt.c b/gcc/tree-ssa-phiopt.c
>index 3eac9b1ce46..714deab005a 100644
>--- a/gcc/tree-ssa-phiopt.c
>+++ b/gcc/tree-ssa-phiopt.c
>@@ -900,6 +900,8 @@ gimple_simplify_phiopt (bool early_p, tree type, gimple 
>*comp_stmt,
> result = maybe_push_res_to_seq (, );
> if (result)
>   {
>+if (loc != UNKNOWN_LOCATION)
>+  annotate_all_with_location (seq1, loc);
> gimple_seq_add_seq_without_update (seq, seq1);
> return result;
>   }
>@@ -929,6 +931,8 @@ gimple_simplify_phiopt (bool early_p, tree type, gimple 
>*comp_stmt,
> result = maybe_push_res_to_seq (, );
> if (result)
>   {
>+if (loc != UNKNOWN_LOCATION)
>+  annotate_all_with_location (seq1, loc);
> gimple_seq_add_seq_without_update (seq, seq1);
> return result;
>   }



[PATCH] Improve location for new statements in match-and-simplify phiopt

2021-12-18 Thread apinski--- via Gcc-patches
From: Andrew Pinski 

Before match-and-simplify was used in phiot, the location of the
new stamtents were all of that of the conditional, this adds that
back as I did not realize gimple_simplify didn't do that for you.

OK? Bootstrapped and tested on x86_64 with no regressions.

gcc/ChangeLog:

* tree-ssa-phiopt.c (gimple_simplify_phiopt): Annotate the
new sequence with the location of the conditional statement.
---
 gcc/tree-ssa-phiopt.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/gcc/tree-ssa-phiopt.c b/gcc/tree-ssa-phiopt.c
index 3eac9b1ce46..714deab005a 100644
--- a/gcc/tree-ssa-phiopt.c
+++ b/gcc/tree-ssa-phiopt.c
@@ -900,6 +900,8 @@ gimple_simplify_phiopt (bool early_p, tree type, gimple 
*comp_stmt,
  result = maybe_push_res_to_seq (, );
  if (result)
{
+ if (loc != UNKNOWN_LOCATION)
+   annotate_all_with_location (seq1, loc);
  gimple_seq_add_seq_without_update (seq, seq1);
  return result;
}
@@ -929,6 +931,8 @@ gimple_simplify_phiopt (bool early_p, tree type, gimple 
*comp_stmt,
  result = maybe_push_res_to_seq (, );
  if (result)
{
+ if (loc != UNKNOWN_LOCATION)
+   annotate_all_with_location (seq1, loc);
  gimple_seq_add_seq_without_update (seq, seq1);
  return result;
}
-- 
2.17.1