aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Jambor <mjambor@suse.cz>2020-11-13 18:30:11 +0100
committerMartin Jambor <mjambor@suse.cz>2020-11-13 18:30:11 +0100
commit2e97d6443f0a862ce9b798084499635914e3b8c6 (patch)
treef396d84d040d60c107c6c0b750c25b9074f90200
parent6f1ae1ecd351348eb33b515c5e23778651bee028 (diff)
downloadgcc-2e97d6443f0a862ce9b798084499635914e3b8c6.zip
gcc-2e97d6443f0a862ce9b798084499635914e3b8c6.tar.gz
gcc-2e97d6443f0a862ce9b798084499635914e3b8c6.tar.bz2
ipa-cp: One more safe_add (PR 97816)
The new behavior of safe_add triggered an ICE because of one use where it had not been used instead of a simple addition. I'll fix it with the following obvious patch so that periodic benchmarkers can continue working because a proper fix (see below) will need a review. The testcase showed me, however, that we can propagate time and cost from one lattice to another more than once even when that was not the intent. I'll address that as a follow-up after I verify it does not affect the IPA-CP heuristics too much or change the corresponding params accordingly. Bootstrapped and tested on x86_64-linux. gcc/ChangeLog: 2020-11-13 Martin Jambor <mjambor@suse.cz> PR ipa/97816 * ipa-cp.c (value_topo_info<valtype>::propagate_effects): Use safe_add instead of a simple addition.
-rw-r--r--gcc/ipa-cp.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c
index f29f216..c3ee71e 100644
--- a/gcc/ipa-cp.c
+++ b/gcc/ipa-cp.c
@@ -3873,7 +3873,8 @@ value_topo_info<valtype>::propagate_effects ()
for (val = base; val; val = val->scc_next)
{
time = time + val->local_time_benefit + val->prop_time_benefit;
- size = safe_add (size, val->local_size_cost + val->prop_size_cost);
+ size = safe_add (size, safe_add (val->local_size_cost,
+ val->prop_size_cost));
}
for (val = base; val; val = val->scc_next)