Drop meaningless overflow that may creep into the IL.
gcc/ChangeLog:
PR tree-optimization/103207
* value-range.cc (irange::set): Drop overflow.
gcc/testsuite/ChangeLog:
* gcc.dg/pr103207.c: New test.
--- /dev/null
+// { dg-do compile }
+// { dg-options "-O2 --param case-values-threshold=1 -w" }
+
+int f (int i)
+{
+ switch (i) {
+ case 2147483647:
+ return 1;
+ case 9223372036854775807L:
+ return 2;
+ case (2147483647*4)%4:
+ return 4;
+ }
+ return 0;
+}
void
irange::set (tree min, tree max, value_range_kind kind)
{
+ if (kind != VR_UNDEFINED)
+ {
+ if (TREE_OVERFLOW_P (min))
+ min = drop_tree_overflow (min);
+ if (TREE_OVERFLOW_P (max))
+ max = drop_tree_overflow (max);
+ }
+
if (!legacy_mode_p ())
{
if (kind == VR_RANGE)