From: Aldy Hernandez Date: Tue, 20 Oct 2020 06:53:21 +0000 (+0200) Subject: Special case shifting by zero in operator_rshift::op1_range. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f0c0f124ebe28b71abccbd7247678c9ac608b649;p=gcc.git Special case shifting by zero in operator_rshift::op1_range. gcc/ChangeLog: * range-op.cc (operator_rshift::op1_range): Special case shifting by zero. --- diff --git a/gcc/range-op.cc b/gcc/range-op.cc index 21d98de2240..ee62f103598 100644 --- a/gcc/range-op.cc +++ b/gcc/range-op.cc @@ -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.