public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Fix the build of record_edge_info()
@ 2022-10-01  0:57 Palmer Dabbelt
  2022-10-01  1:01 ` Jeff Law
  0 siblings, 1 reply; 3+ messages in thread
From: Palmer Dabbelt @ 2022-10-01  0:57 UTC (permalink / raw)
  To: jeffreyalaw, gcc-patches; +Cc: Palmer Dabbelt

As of 1214196da79 ("More gimple const/copy propagation opportunities"),
I'm getting some build failures during bootstrap

    ../../gcc/tree-ssa-dom.cc: In function ‘void record_edge_info(basic_block)’:
    ../../gcc/tree-ssa-dom.cc:689:27: error: ‘dst’ was not declared in this scope; did you mean ‘dse’?
      689 |                       if (dst == PHI_ARG_DEF (phi, !alternative))
          |                           ^~~
          |                           dse
    In file included from ../../gcc/gimple-ssa.h:24,
                     from ../../gcc/ssa.h:27,
                     from ../../gcc/tree-ssa-dom.cc:28:
    ../../gcc/tree-ssa-dom.cc:689:47: error: ‘phi’ was not declared in this scope; did you mean ‘gphi’?
      689 |                       if (dst == PHI_ARG_DEF (phi, !alternative))
          |                                               ^~~
    ../../gcc/tree-ssa-operands.h:82:54: note: in definition of macro ‘PHI_ARG_DEF’
       82 | #define PHI_ARG_DEF(PHI, I)     gimple_phi_arg_def ((PHI), (I))
          |

I've never looked at this stuff before so I've sort of just pattern
matched this, it at least fixes the build.  Happy to go try and
understand what's going on here, but I'm in the middle of a few things
so I figured it'd be better to just send it along in case anyone else is
running into the same issue -- it's more of a bug report than a fix,
though.

gcc/ChangeLog

	* tree-ssa-dom.c (record_edge_info): Move the alternative check
	below the phi definition.
---
 gcc/tree-ssa-dom.cc | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/gcc/tree-ssa-dom.cc b/gcc/tree-ssa-dom.cc
index 8d8312ca350..e6b8dace5e9 100644
--- a/gcc/tree-ssa-dom.cc
+++ b/gcc/tree-ssa-dom.cc
@@ -684,11 +684,6 @@ record_edge_info (basic_block bb)
 		       !gsi_end_p (gsi);
 		       gsi_next (&gsi))
 		    {
-		      /* If the other alternative is the same as the result,
-			 then this is a degenerate and can be ignored.  */
-		      if (dst == PHI_ARG_DEF (phi, !alternative))
-			continue;
-
 		      /* Now get the EDGE_INFO class so we can append
 			 it to our list.  We want the successor edge
 			 where the destination is not the source of
@@ -697,6 +692,11 @@ record_edge_info (basic_block bb)
 		      tree src = PHI_ARG_DEF (phi, alternative);
 		      tree dst = PHI_RESULT (phi);
 
+		      /* If the other alternative is the same as the result,
+			 then this is a degenerate and can be ignored.  */
+		      if (dst == PHI_ARG_DEF (phi, !alternative))
+			continue;
+
 		      if (EDGE_SUCC (bb, 0)->dest
 			  != EDGE_PRED (bb, !alternative)->src)
 			edge_info = (class edge_info *)EDGE_SUCC (bb, 0)->aux;
-- 
2.34.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Fix the build of record_edge_info()
  2022-10-01  0:57 [PATCH] Fix the build of record_edge_info() Palmer Dabbelt
@ 2022-10-01  1:01 ` Jeff Law
  2022-10-01  1:27   ` Palmer Dabbelt
  0 siblings, 1 reply; 3+ messages in thread
From: Jeff Law @ 2022-10-01  1:01 UTC (permalink / raw)
  To: Palmer Dabbelt, gcc-patches


On 9/30/22 18:57, Palmer Dabbelt wrote:
> As of 1214196da79 ("More gimple const/copy propagation opportunities"),
> I'm getting some build failures during bootstrap
>
>      ../../gcc/tree-ssa-dom.cc: In function ‘void record_edge_info(basic_block)’:
>      ../../gcc/tree-ssa-dom.cc:689:27: error: ‘dst’ was not declared in this scope; did you mean ‘dse’?
>        689 |                       if (dst == PHI_ARG_DEF (phi, !alternative))
>            |                           ^~~
>            |                           dse
>      In file included from ../../gcc/gimple-ssa.h:24,
>                       from ../../gcc/ssa.h:27,
>                       from ../../gcc/tree-ssa-dom.cc:28:
>      ../../gcc/tree-ssa-dom.cc:689:47: error: ‘phi’ was not declared in this scope; did you mean ‘gphi’?
>        689 |                       if (dst == PHI_ARG_DEF (phi, !alternative))
>            |                                               ^~~
>      ../../gcc/tree-ssa-operands.h:82:54: note: in definition of macro ‘PHI_ARG_DEF’
>         82 | #define PHI_ARG_DEF(PHI, I)     gimple_phi_arg_def ((PHI), (I))
>            |
>
> I've never looked at this stuff before so I've sort of just pattern
> matched this, it at least fixes the build.  Happy to go try and
> understand what's going on here, but I'm in the middle of a few things
> so I figured it'd be better to just send it along in case anyone else is
> running into the same issue -- it's more of a bug report than a fix,
> though.
>
> gcc/ChangeLog
>
> 	* tree-ssa-dom.c (record_edge_info): Move the alternative check
> 	below the phi definition.
> ---

You got it right, but it's already fixed on the trunk (I pushed the 
wrong version of the patch).


jeff



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Fix the build of record_edge_info()
  2022-10-01  1:01 ` Jeff Law
@ 2022-10-01  1:27   ` Palmer Dabbelt
  0 siblings, 0 replies; 3+ messages in thread
From: Palmer Dabbelt @ 2022-10-01  1:27 UTC (permalink / raw)
  To: jeffreyalaw; +Cc: gcc-patches

On Fri, 30 Sep 2022 18:01:00 PDT (-0700), jeffreyalaw@gmail.com wrote:
>
> On 9/30/22 18:57, Palmer Dabbelt wrote:
>> As of 1214196da79 ("More gimple const/copy propagation opportunities"),
>> I'm getting some build failures during bootstrap
>>
>>      ../../gcc/tree-ssa-dom.cc: In function ‘void record_edge_info(basic_block)’:
>>      ../../gcc/tree-ssa-dom.cc:689:27: error: ‘dst’ was not declared in this scope; did you mean ‘dse’?
>>        689 |                       if (dst == PHI_ARG_DEF (phi, !alternative))
>>            |                           ^~~
>>            |                           dse
>>      In file included from ../../gcc/gimple-ssa.h:24,
>>                       from ../../gcc/ssa.h:27,
>>                       from ../../gcc/tree-ssa-dom.cc:28:
>>      ../../gcc/tree-ssa-dom.cc:689:47: error: ‘phi’ was not declared in this scope; did you mean ‘gphi’?
>>        689 |                       if (dst == PHI_ARG_DEF (phi, !alternative))
>>            |                                               ^~~
>>      ../../gcc/tree-ssa-operands.h:82:54: note: in definition of macro ‘PHI_ARG_DEF’
>>         82 | #define PHI_ARG_DEF(PHI, I)     gimple_phi_arg_def ((PHI), (I))
>>            |
>>
>> I've never looked at this stuff before so I've sort of just pattern
>> matched this, it at least fixes the build.  Happy to go try and
>> understand what's going on here, but I'm in the middle of a few things
>> so I figured it'd be better to just send it along in case anyone else is
>> running into the same issue -- it's more of a bug report than a fix,
>> though.
>>
>> gcc/ChangeLog
>>
>> 	* tree-ssa-dom.c (record_edge_info): Move the alternative check
>> 	below the phi definition.
>> ---
>
> You got it right, but it's already fixed on the trunk (I pushed the
> wrong version of the patch).

Thanks, I must have just had some unlucky timing ;)

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-10-01  1:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-01  0:57 [PATCH] Fix the build of record_edge_info() Palmer Dabbelt
2022-10-01  1:01 ` Jeff Law
2022-10-01  1:27   ` Palmer Dabbelt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).