Re: We need to remove the Sphinx HTML docs

2025-04-26 Thread Sam James via Gcc
Gerald Pfeifer  writes:

> On Tue, 4 Feb 2025, Jonathan Wakely wrote:
> :
>>> ./gnat_ugn/_static/
>>> ./libgccjit/_static/
>>> ./libgdiagnostics/_static/
>>> ./libgomp/_static/
> :
>> N.B. there's ./jit/_static which should stay, because jit still uses
>> sphinx for its docs.
>

I found 
https://gcc.gnu.org/onlinedocs/gccint/link-time-optimization/lto-file-sections.html
just now as well.


Re: We need to remove the Sphinx HTML docs

2025-04-26 Thread Jonathan Wakely via Gcc
On Sat, 26 Apr 2025 at 13:55, Sam James  wrote:
>
> Gerald Pfeifer  writes:
>
> > On Tue, 4 Feb 2025, Jonathan Wakely wrote:
> > :
> >>> ./gnat_ugn/_static/
> >>> ./libgccjit/_static/
> >>> ./libgdiagnostics/_static/
> >>> ./libgomp/_static/
> > :
> >> N.B. there's ./jit/_static which should stay, because jit still uses
> >> sphinx for its docs.
> >
>
> I found 
> https://gcc.gnu.org/onlinedocs/gccint/link-time-optimization/lto-file-sections.html
> just now as well.

Ugh, there are literally hundreds of pages still there:

$ grep -R  'generator.*Docutils' gccint | wc -l
245
$ grep -R  'generator.*Docutils' gfortran | wc -l
323


Re: We need to remove the Sphinx HTML docs

2025-04-26 Thread Jonathan Wakely via Gcc
On Sat, 26 Apr 2025 at 19:24, Jonathan Wakely  wrote:
>
> On Sat, 26 Apr 2025 at 13:55, Sam James  wrote:
> >
> > Gerald Pfeifer  writes:
> >
> > > On Tue, 4 Feb 2025, Jonathan Wakely wrote:
> > > :
> > >>> ./gnat_ugn/_static/
> > >>> ./libgccjit/_static/
> > >>> ./libgdiagnostics/_static/
> > >>> ./libgomp/_static/
> > > :
> > >> N.B. there's ./jit/_static which should stay, because jit still uses
> > >> sphinx for its docs.
> > >
> >
> > I found 
> > https://gcc.gnu.org/onlinedocs/gccint/link-time-optimization/lto-file-sections.html
> > just now as well.
>
> Ugh, there are literally hundreds of pages still there:
>
> $ grep -R  'generator.*Docutils' gccint | wc -l
> 245
> $ grep -R  'generator.*Docutils' gfortran | wc -l
> 323

$ grep -R  'generator.*Docutils' libgomp | wc -l
136
$ grep -R  'generator.*Docutils' libitm | wc -l
8
$ grep -R  'generator.*Docutils' gdc | wc -l
7
$ grep -R  'generator.*Docutils' gfc-internals | wc -l
4


[PATCH] gcc: do not apply store motion on loop with no exits. The temporary variable will not be wrote back to memory as there is no exit of inifinite loop, so we prohibit applying store motion on loo

2025-04-26 Thread Xin Wang via Gcc
Signed-off-by: Xin Wang 

---
 gcc/tree-ssa-loop-im.cc | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/gcc/tree-ssa-loop-im.cc b/gcc/tree-ssa-loop-im.cc
index 225964c6215..de0450f5192 100644
--- a/gcc/tree-ssa-loop-im.cc
+++ b/gcc/tree-ssa-loop-im.cc
@@ -3355,6 +3355,9 @@ loop_suitable_for_sm (class loop *loop ATTRIBUTE_UNUSED,
   unsigned i;
   edge ex;
 
+  if (exits.is_empty())
+return false;
+
   FOR_EACH_VEC_ELT (exits, i, ex)
 if (ex->flags & (EDGE_ABNORMAL | EDGE_EH))
   return false;
-- 
2.25.1



[PATCH] Do not apply store motion on loop with no exits.

2025-04-26 Thread Xin Wang via Gcc
---
 gcc/tree-ssa-loop-im.cc | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/gcc/tree-ssa-loop-im.cc b/gcc/tree-ssa-loop-im.cc
index 225964c6215..de0450f5192 100644
--- a/gcc/tree-ssa-loop-im.cc
+++ b/gcc/tree-ssa-loop-im.cc
@@ -3355,6 +3355,9 @@ loop_suitable_for_sm (class loop *loop ATTRIBUTE_UNUSED,
   unsigned i;
   edge ex;
 
+  if (exits.is_empty())
+return false;
+
   FOR_EACH_VEC_ELT (exits, i, ex)
 if (ex->flags & (EDGE_ABNORMAL | EDGE_EH))
   return false;
-- 
2.25.1



Re: [PATCH v2] gcc: do not apply store motion on loop with no exits.

2025-04-26 Thread ywgrit via Gcc
I encountered one problem with loop-im pass.
I compiled the program dhry2reg which belongs to unixbench(
https://github.com/kdlucas/byte-unixbench).

The gcc used
gcc (GCC) 12.3.0

The commands executed as following
make
./Run -c -i 1 dhry2reg

The results are shown below.
Dhrystone 2 using register variables  0.1 lps   (10.0 s, 1
samples)

System Benchmarks Partial Index  BASELINE   RESULTINDEX
Dhrystone 2 using register variables 116700.0  0.1  0.0
   
System Benchmarks Index Score (Partial Only)   10.0

Obviously, the "INDEX" is abnormal.
I wrote a demo named dhry.c based on the dhry2reg logic.

// dhry.c
#include 
#include 
#include 
#include 
#include 
int run_index;


typedef struct record {
struct record *next_rec;
int i;
} record, *pointer;

pointer global_pointer, next_global_pointer;


void report() {
printf("report:%d\n", run_index);
exit(0);
}
int main() {
printf("%d\n", run_index);

global_pointer = (pointer )malloc(sizeof(struct record));
next_global_pointer = (pointer )malloc(sizeof(struct record));
global_pointer->next_rec = next_global_pointer;


signal(SIGALRM, report);
/* get the clock running */
alarm(1);
char i[4];
// no exit
for(run_index=0;;++run_index){
  *global_pointer->next_rec = *global_pointer;
}
}


gcc -O3 -fdump-tree-all -fdump-tree-all-graph dhry.c -o dhry
./dhry
0
report:0

gcc -O3 -fdump-tree-all -fdump-tree-all-graph dhry.c -o dhry
-fno-tree-loop-im
./dhry
0
report:1367490190

The generated gimple are shown below.
dhry.c.140t.laddress:
   [local count: 10631108]:
  run_index.1_1 = run_index;
  printf ("%d\n", run_index.1_1);
  _2 = malloc (16);
  global_pointer = _2;
  _3 = malloc (16);
  next_global_pointer = _3;
  MEM[(struct record *)_2].next_rec = _3;
  signal (14, report);
  alarm (1);
  run_index = 0;

   [local count: 1073741824]:
  global_pointer.4_4 = global_pointer;
  _5 = global_pointer.4_4->next_rec;
  *_5 = *global_pointer.4_4;
  run_index.6_6 = run_index;
  _7 = run_index.6_6 + 1;
  run_index = _7;
  goto ; [100.00%]

dhry.c.142t.lim2:
   [local count: 10631108]:
  run_index.1_1 = run_index;
  printf ("%d\n", run_index.1_1);
  _2 = malloc (16);
  global_pointer = _2;
  _3 = malloc (16);
  next_global_pointer = _3;
  MEM[(struct record *)_2].next_rec = _3;
  signal (14, report);
  alarm (1);
  run_index = 0;
  global_pointer.4_4 = global_pointer;
  run_index_lsm.13_22 = run_index;

   [local count: 1073741824]:
  # run_index_lsm.13_21 = PHI 
  _5 = global_pointer.4_4->next_rec;
  *_5 = *global_pointer.4_4;
  run_index.6_6 = run_index_lsm.13_21;
  _7 = run_index.6_6 + 1;
  run_index_lsm.13_23 = _7;




In loop-im pass, store-motion insert run_index_lsm = run_index before loop
and replace all references of run_index with run_index_lsm. And the
following
code writes run_index_lsm back to run_index.
  /* Materialize ordered store sequences on exits.  */
  FOR_EACH_VEC_ELT (exits, i, e)
{
  edge append_cond_position = NULL;
  edge last_cond_fallthru = NULL;
  if (i < sms.length ())
{
 gcc_assert (sms[i].first == e);
 execute_sm_exit (loop, e, sms[i].second, aux_map, sm_ord,
  append_cond_position, last_cond_fallthru);
 sms[i].second.release ();
}
  if (!unord_refs.is_empty ())
execute_sm_exit (loop, e, unord_refs, aux_map, sm_unord,
append_cond_position, last_cond_fallthru);
  /* Commit edge inserts here to preserve the order of stores
when an exit exits multiple loops.  */
  gsi_commit_one_edge_insert (e, NULL);
}

But run_index_lsm is not wrote back to run_index as there is no exit in
this loop.
so run_index will be zero after store motion is executed.

Is inifinite loop a undefined behavior, so it is permitted if run_index ==
0?
If not, I think we should not apply store motion on loop with no exit.

Xin Wang  于2025年4月27日周日 11:29写道:

> The temporary variable will not be wrote back to memory as there
> is no exit of inifinite loop, so we prohibit applying store motion
> on loops with no exits.
>
> Signed-off-by: Xin Wang 
>
> ---
>  gcc/tree-ssa-loop-im.cc | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/gcc/tree-ssa-loop-im.cc b/gcc/tree-ssa-loop-im.cc
> index 225964c6215..de0450f5192 100644
> --- a/gcc/tree-ssa-loop-im.cc
> +++ b/gcc/tree-ssa-loop-im.cc
> @@ -3355,6 +3355,9 @@ loop_suitable_for_sm (class loop *loop
> ATTRIBUTE_UNUSED,
>unsigned i;
>edge ex;
>
> +  if (exits.is_empty())
> +return false;
> +
>FOR_EACH_VEC_ELT (exits, i, ex)
>  if (ex->flags & (EDGE_ABNORMAL | EDGE_EH))
>return false;
> --
> 2.25.1
>
>


gcc-15-20250426 is now available

2025-04-26 Thread GCC Administrator via Gcc
Snapshot gcc-15-20250426 is now available on
  https://gcc.gnu.org/pub/gcc/snapshots/15-20250426/
and on various mirrors, see https://gcc.gnu.org/mirrors.html for details.

This snapshot has been generated from the GCC 15 git branch
with the following options: git://gcc.gnu.org/git/gcc.git branch 
releases/gcc-15 revision 4b0d25e72624b9ae0b6c3f9b4e52070114ba6d1e

You'll find:

 gcc-15-20250426.tar.xz   Complete GCC

  SHA256=5da29d2cff64251a61fbcc62bf6245710f05d2ccf8f49c8138142da700b699e7
  SHA1=4d01ad7c317fead6f15501d1279547fa3e47d14c

Diffs from 15-20250420 are available in the diffs/ subdirectory.

When a particular snapshot is ready for public consumption the LATEST-15
link is updated and a message is sent to the gcc list.  Please do not use
a snapshot before it has been announced that way.


Re: We need to remove the Sphinx HTML docs

2025-04-26 Thread Jonathan Wakely via Gcc
On Tue, 4 Feb 2025 at 15:16, Jonathan Wakely  wrote:
>
> On Fri, 15 Nov 2024 at 12:43, Gerald Pfeifer  wrote:
> >
> > On Fri, 15 Nov 2024, Jonathan Wakely wrote:
> > > All these directories should have been removed two years ago:
> >
> > Agreed. Thank you for digging into this and raising it, Jonathan!
> >
> > > $ ls -1 -d htdocs/onlinedocs/gcc/*/
> > > htdocs/onlinedocs/gcc/c-implementation-defined-behavior/
> > > htdocs/onlinedocs/gcc/extensions-to-the-c++-language/
> > > htdocs/onlinedocs/gcc/extensions-to-the-c-language-family/
> > > htdocs/onlinedocs/gcc/gcc-command-options/
> > > htdocs/onlinedocs/gcc/gcov/
> > > htdocs/onlinedocs/gcc/gnu-objective-c-features/
> > > htdocs/onlinedocs/gcc/known-causes-of-trouble-with-gcc/
> > > htdocs/onlinedocs/gcc/language-standards-supported-by-gcc/
> > > htdocs/onlinedocs/gcc/_sources/
> > > htdocs/onlinedocs/gcc/_static/
> >
> > These, plus
> >
> >   -rw-r--r--. 1 gccadmin shared   59124 14. Nov 2022  objects.inv
> >   -rw-r--r--. 1 gccadmin shared 1459709 14. Nov 2022  searchindex.js
> >
> > are now gone.
>
> I think we want to remove these too:
>
> ./gccgo/_static/
> ./gccint/_static/
> ./gdc/_static/
> ./gfc-internals/_static/
> ./gfortran/_static/
> ./gnat_rm/_static/
> ./gnat-style/_static/
> ./gnat_ugn/_static/
> ./libgccjit/_static/
> ./libgdiagnostics/_static/
> ./libgomp/_static/
> ./libiberty/_static/
> ./libitm/_static/
> ./libquadmath/_static/
>
> I think those were all created by sphinx.

I found (and removed) some more sphinx leftovers under /onlinedocs/cpp/

$ ls -l header-files/ macros/
header-files/:
total 200
-rw-r--r--. 1 gccadmin shared 23370 Nov 14  2022
alternatives-to-wrapper-ifndef.html
-rw-r--r--. 1 gccadmin shared 25844 Nov 14  2022 computed-includes.html
-rw-r--r--. 1 gccadmin shared 24426 Nov 14  2022 include-operation.html
-rw-r--r--. 1 gccadmin shared 23714 Nov 14  2022 include-syntax.html
-rw-r--r--. 1 gccadmin shared 22915 Nov 14  2022 once-only-headers.html
-rw-r--r--. 1 gccadmin shared 25569 Nov 14  2022 search-path.html
-rw-r--r--. 1 gccadmin shared 22803 Nov 14  2022 system-headers.html
-rw-r--r--. 1 gccadmin shared 24330 Nov 14  2022 wrapper-headers.html

macros/:
total 400
-rw-r--r--. 1 gccadmin shared  27143 Nov 14  2022 concatenation.html
-rw-r--r--. 1 gccadmin shared  21884 Nov 14  2022
directives-within-macro-arguments.html
-rw-r--r--. 1 gccadmin shared  22378 Nov 14  2022 function-like-macros.html
-rw-r--r--. 1 gccadmin shared  29024 Nov 14  2022 macro-arguments.html
-rw-r--r--. 1 gccadmin shared  51631 Nov 14  2022 macro-pitfalls.html
-rw-r--r--. 1 gccadmin shared  27922 Nov 14  2022 object-like-macros.html
-rw-r--r--. 1 gccadmin shared 14 Nov 14  2022 predefined-macros.html
-rw-r--r--. 1 gccadmin shared  25600 Nov 14  2022 stringizing.html
-rw-r--r--. 1 gccadmin shared  23336 Nov 14  2022
undefining-and-redefining-macros.html
-rw-r--r--. 1 gccadmin shared  28084 Nov 14  2022 variadic-macros.html


[PATCH] Do not apply store motion on loop with no exits.

2025-04-26 Thread Xin Wang via Gcc
---
 gcc/tree-ssa-loop-im.cc | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/gcc/tree-ssa-loop-im.cc b/gcc/tree-ssa-loop-im.cc
index 225964c6215..de0450f5192 100644
--- a/gcc/tree-ssa-loop-im.cc
+++ b/gcc/tree-ssa-loop-im.cc
@@ -3355,6 +3355,9 @@ loop_suitable_for_sm (class loop *loop ATTRIBUTE_UNUSED,
   unsigned i;
   edge ex;
 
+  if (exits.is_empty())
+return false;
+
   FOR_EACH_VEC_ELT (exits, i, ex)
 if (ex->flags & (EDGE_ABNORMAL | EDGE_EH))
   return false;
-- 
2.25.1



[PATCH v2] gcc: do not apply store motion on loop with no exits.

2025-04-26 Thread Xin Wang via Gcc
The temporary variable will not be wrote back to memory as there
is no exit of inifinite loop, so we prohibit applying store motion
on loops with no exits.

Signed-off-by: Xin Wang 

---
 gcc/tree-ssa-loop-im.cc | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/gcc/tree-ssa-loop-im.cc b/gcc/tree-ssa-loop-im.cc
index 225964c6215..de0450f5192 100644
--- a/gcc/tree-ssa-loop-im.cc
+++ b/gcc/tree-ssa-loop-im.cc
@@ -3355,6 +3355,9 @@ loop_suitable_for_sm (class loop *loop ATTRIBUTE_UNUSED,
   unsigned i;
   edge ex;
 
+  if (exits.is_empty())
+return false;
+
   FOR_EACH_VEC_ELT (exits, i, ex)
 if (ex->flags & (EDGE_ABNORMAL | EDGE_EH))
   return false;
-- 
2.25.1