public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r14-4630] Do not add partial equivalences with no uses.
@ 2023-10-13 13:23 Andrew Macleod
0 siblings, 0 replies; only message in thread
From: Andrew Macleod @ 2023-10-13 13:23 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:8be20f3b0bded7f9b690b27cbee58b283dbe827b
commit r14-4630-g8be20f3b0bded7f9b690b27cbee58b283dbe827b
Author: Andrew MacLeod <amacleod@redhat.com>
Date: Thu Oct 12 17:06:36 2023 -0400
Do not add partial equivalences with no uses.
PR tree-optimization/111622
* value-relation.cc (equiv_oracle::add_partial_equiv): Do not
register a partial equivalence if an operand has no uses.
Diff:
---
gcc/value-relation.cc | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/gcc/value-relation.cc b/gcc/value-relation.cc
index 0326fe7cde6..c0f513a0eb1 100644
--- a/gcc/value-relation.cc
+++ b/gcc/value-relation.cc
@@ -392,6 +392,9 @@ equiv_oracle::add_partial_equiv (relation_kind r, tree op1, tree op2)
// In either case, if PE2 has an entry, we simply do nothing.
if (pe2.members)
return;
+ // If there are no uses of op2, do not register.
+ if (has_zero_uses (op2))
+ return;
// PE1 is the LHS and already has members, so everything in the set
// should be a slice of PE2 rather than PE1.
pe2.code = pe_min (r, pe1.code);
@@ -409,6 +412,9 @@ equiv_oracle::add_partial_equiv (relation_kind r, tree op1, tree op2)
}
if (pe2.members)
{
+ // If there are no uses of op1, do not register.
+ if (has_zero_uses (op1))
+ return;
pe1.ssa_base = pe2.ssa_base;
// If pe2 is a 16 bit value, but only an 8 bit copy, we can't be any
// more than an 8 bit equivalence here, so choose MIN value.
@@ -418,6 +424,9 @@ equiv_oracle::add_partial_equiv (relation_kind r, tree op1, tree op2)
}
else
{
+ // If there are no uses of either operand, do not register.
+ if (has_zero_uses (op1) || has_zero_uses (op2))
+ return;
// Neither name has an entry, simply create op1 as slice of op2.
pe2.code = bits_to_pe (TYPE_PRECISION (TREE_TYPE (op2)));
if (pe2.code == VREL_VARYING)
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-10-13 13:23 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-13 13:23 [gcc r14-4630] Do not add partial equivalences with no uses Andrew Macleod
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).