Special case shifting by zero in operator_rshift::op1_range.

gcc/ChangeLog:

	* range-op.cc (operator_rshift::op1_range): Special case
	shifting by zero.
This commit is contained in:
Aldy Hernandez 2020-10-20 08:53:21 +02:00
parent 8f70460005
commit f0c0f124eb

View File

@ -1642,6 +1642,11 @@ operator_rshift::op1_range (irange &r,
wi::uhwi (prec, TYPE_PRECISION (TREE_TYPE (shift))),
UNSIGNED))
return false;
if (wi::to_wide (shift) == 0)
{
r = lhs;
return true;
}
// Folding the original operation may discard some impossible
// ranges from the LHS.