diff options
author | Richard Biener <rguenther@suse.de> | 2024-07-25 08:58:42 +0200 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2024-07-25 12:44:57 +0200 |
commit | 3bf05516d9ffea2a39939b656f0e51052000653e (patch) | |
tree | 810f6b709518b9445fe18de5a39cdac9aba50a87 /gcc | |
parent | cfd3f06b4c65e15d4f6af8bd4862b835efd61a72 (diff) | |
download | gcc-3bf05516d9ffea2a39939b656f0e51052000653e.zip gcc-3bf05516d9ffea2a39939b656f0e51052000653e.tar.gz gcc-3bf05516d9ffea2a39939b656f0e51052000653e.tar.bz2 |
tree-optimization/116079 - store motion and clobbers
When we move a store out of an inner loop and remove a clobber in
the process, analysis of the inner loop can run into the clobber
via the meta-data and crash when accessing its basic-block. The
following avoids this by clearing the VDEF which is how it identifies
already processed stores.
PR tree-optimization/116079
* tree-ssa-loop-im.cc (hoist_memory_references): Clear
VDEF of elided clobbers.
* gcc.dg/torture/pr116079.c: New testcase.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/testsuite/gcc.dg/torture/pr116079.c | 20 | ||||
-rw-r--r-- | gcc/tree-ssa-loop-im.cc | 2 |
2 files changed, 22 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/torture/pr116079.c b/gcc/testsuite/gcc.dg/torture/pr116079.c new file mode 100644 index 0000000..e912096 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr116079.c @@ -0,0 +1,20 @@ +/* { dg-do compile } */ + +char g_132; +int g_701, g_1189, func_24___trans_tmp_15, func_24_l_2691; +long func_24___trans_tmp_9; +int *func_24_l_2684; +void func_24() { + for (; g_1189;) { + g_132 = 0; + for (; g_132 < 6; ++g_132) { + func_24___trans_tmp_9 = *func_24_l_2684 = func_24_l_2691; + g_701 = 4; + for (; g_701; g_701 -= 1) { + int l_2748[4]; + int si2 = l_2748[3]; + func_24___trans_tmp_15 = si2; + } + } + } +} diff --git a/gcc/tree-ssa-loop-im.cc b/gcc/tree-ssa-loop-im.cc index c53efbb..ccc56dc 100644 --- a/gcc/tree-ssa-loop-im.cc +++ b/gcc/tree-ssa-loop-im.cc @@ -2880,6 +2880,7 @@ hoist_memory_references (class loop *loop, bitmap mem_refs, gimple_stmt_iterator gsi = gsi_for_stmt (stmt); unlink_stmt_vdef (stmt); release_defs (stmt); + gimple_set_vdef (stmt, NULL_TREE); gsi_remove (&gsi, true); } @@ -3062,6 +3063,7 @@ hoist_memory_references (class loop *loop, bitmap mem_refs, gimple_stmt_iterator gsi = gsi_for_stmt (stmt); unlink_stmt_vdef (stmt); release_defs (stmt); + gimple_set_vdef (stmt, NULL_TREE); gsi_remove (&gsi, true); } |