tree-optimization/105368 - avoid overflow in powi_cost
The following avoids undefined signed overflow when computing the absolute of the exponent in powi_cost. 2022-04-25 Richard Biener <rguenther@suse.de> PR tree-optimization/105368 * tree-ssa-math-opts.cc (powi_cost): Use absu_hwi.
This commit is contained in:
parent
ab91c10792
commit
f0e170f72f
1 changed files with 1 additions and 1 deletions
|
@ -1462,7 +1462,7 @@ powi_cost (HOST_WIDE_INT n)
|
|||
return 0;
|
||||
|
||||
/* Ignore the reciprocal when calculating the cost. */
|
||||
val = (n < 0) ? -n : n;
|
||||
val = absu_hwi (n);
|
||||
|
||||
/* Initialize the exponent cache. */
|
||||
memset (cache, 0, POWI_TABLE_SIZE * sizeof (bool));
|
||||
|
|
Loading…
Add table
Reference in a new issue