aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2023-02-23 11:05:47 +0100
committerRichard Biener <rguenther@suse.de>2023-02-23 13:51:57 +0100
commitaf46073dbe83d88e2d93d967da447346b22c70bb (patch)
treec50d735b1951dc9c7ac3a1d03297a1c90f15ff4b
parent31cc5821223a096ef61743bff520f4a0dbba5872 (diff)
downloadgcc-af46073dbe83d88e2d93d967da447346b22c70bb.zip
gcc-af46073dbe83d88e2d93d967da447346b22c70bb.tar.gz
gcc-af46073dbe83d88e2d93d967da447346b22c70bb.tar.bz2
Fix memory leak in if-conversion
The following fixes if-conversion failing to release data-references and the data-reference vector. * tree-if-conv.cc (tree_if_conversion): Properly manage memory of refs and the contained data references.
-rw-r--r--gcc/tree-if-conv.cc9
1 files changed, 5 insertions, 4 deletions
diff --git a/gcc/tree-if-conv.cc b/gcc/tree-if-conv.cc
index 0e384e3..f133102 100644
--- a/gcc/tree-if-conv.cc
+++ b/gcc/tree-if-conv.cc
@@ -3534,7 +3534,7 @@ tree_if_conversion (class loop *loop, vec<gimple *> *preds)
auto_vec <gassign *, 4> writes_to_lower;
bitmap exit_bbs;
edge pe;
- vec<data_reference_p> refs;
+ auto_vec<data_reference_p, 10> refs;
again:
rloop = NULL;
@@ -3544,7 +3544,6 @@ tree_if_conversion (class loop *loop, vec<gimple *> *preds)
need_to_predicate = false;
need_to_rewrite_undefined = false;
any_complicated_phi = false;
- refs.create (5);
/* Apply more aggressive if-conversion when loop or its outer loop were
marked with simd pragma. When that's the case, we try to if-convert
@@ -3701,8 +3700,10 @@ tree_if_conversion (class loop *loop, vec<gimple *> *preds)
data_reference_p dr;
unsigned int i;
for (i = 0; refs.iterate (i, &dr); i++)
- free (dr->aux);
-
+ {
+ free (dr->aux);
+ free_data_ref (dr);
+ }
refs.truncate (0);
if (ifc_bbs)