middle-end/103851 - ensure SSA names are released during OMP lowering

This makes sure to release moved & remapped SSA names during OMP
outlining which happens before going into SSA but with SSA names
created by gimplification around.

2022-01-03  Richard Biener  <rguenther@suse.de>

	PR middle-end/103851
	* tree-cfg.c (move_sese_region_to_fn): Always release SSA names.

	* g++.dg/gomp/pr103851.C: New testcase.
This commit is contained in:
Richard Biener 2022-01-03 12:55:45 +01:00
parent 91031bffa4
commit 4911609fbe
2 changed files with 23 additions and 12 deletions

View File

@ -0,0 +1,15 @@
// { dg-do compile }
// { dg-options "-fopenmp -ftrivial-auto-var-init=pattern" }
struct _Deque_base {
long _M_map_size;
int *_M_start;
int *_M_finish;
};
void morphologicalFilter1D()
{
#pragma omp parallel
{
struct _Deque_base vals[4];
}
}

View File

@ -7947,18 +7947,14 @@ move_sese_region_to_fn (struct function *dest_cfun, basic_block entry_bb,
if (eh_map)
delete eh_map;
if (gimple_in_ssa_p (cfun))
{
/* We need to release ssa-names in a defined order, so first find them,
and then iterate in ascending version order. */
bitmap release_names = BITMAP_ALLOC (NULL);
vars_map.traverse<void *, gather_ssa_name_hash_map_from> (release_names);
bitmap_iterator bi;
unsigned i;
EXECUTE_IF_SET_IN_BITMAP (release_names, 0, i, bi)
release_ssa_name (ssa_name (i));
BITMAP_FREE (release_names);
}
/* We need to release ssa-names in a defined order, so first find them,
and then iterate in ascending version order. */
bitmap release_names = BITMAP_ALLOC (NULL);
vars_map.traverse<void *, gather_ssa_name_hash_map_from> (release_names);
bitmap_iterator bi;
EXECUTE_IF_SET_IN_BITMAP (release_names, 0, i, bi)
release_ssa_name (ssa_name (i));
BITMAP_FREE (release_names);
/* Rewire the entry and exit blocks. The successor to the entry
block turns into the successor of DEST_FN's ENTRY_BLOCK_PTR in