aboutsummaryrefslogtreecommitdiff
path: root/gcc/rtl-ssa
diff options
context:
space:
mode:
authorRichard Sandiford <richard.sandiford@arm.com>2023-10-24 11:30:53 +0100
committerRichard Sandiford <richard.sandiford@arm.com>2023-10-24 11:30:53 +0100
commit3e901615ff16547aaf376e7762d417b0b4d98619 (patch)
treefae2864c8c191aa50536b5bd4c296e46a3eefbdf /gcc/rtl-ssa
parentd0eb4aceaa93eabd6153853b22e0e8c843de4184 (diff)
downloadgcc-3e901615ff16547aaf376e7762d417b0b4d98619.zip
gcc-3e901615ff16547aaf376e7762d417b0b4d98619.tar.gz
gcc-3e901615ff16547aaf376e7762d417b0b4d98619.tar.bz2
rtl-ssa: Avoid creating duplicated phis
If make_uses_available was called twice for the same use, we could end up trying to create duplicate definitions for the same extended live range. gcc/ * rtl-ssa/blocks.cc (function_info::create_degenerate_phi): Check whether the requested phi already exists.
Diffstat (limited to 'gcc/rtl-ssa')
-rw-r--r--gcc/rtl-ssa/blocks.cc5
1 files changed, 5 insertions, 0 deletions
diff --git a/gcc/rtl-ssa/blocks.cc b/gcc/rtl-ssa/blocks.cc
index d46cbf1..ecce7a6 100644
--- a/gcc/rtl-ssa/blocks.cc
+++ b/gcc/rtl-ssa/blocks.cc
@@ -525,6 +525,11 @@ function_info::create_phi (ebb_info *ebb, resource_info resource,
phi_info *
function_info::create_degenerate_phi (ebb_info *ebb, set_info *def)
{
+ // Allow the function to be called twice in succession for the same def.
+ def_lookup dl = find_def (def->resource (), ebb->phi_insn ());
+ if (set_info *set = dl.matching_set ())
+ return as_a<phi_info *> (set);
+
access_info *input = def;
phi_info *phi = create_phi (ebb, def->resource (), &input, 1);
if (def->is_reg ())