if (lh.undefined_p ())
return false;
unsigned prec = TYPE_PRECISION (type);
- wide_int nz = lh.get_nonzero_bits ();
- wide_int pop = wi::shwi (wi::popcount (nz), prec);
+ irange_bitmask bm = lh.get_bitmask ();
+ wide_int nz = bm.get_nonzero_bits ();
+ wide_int high = wi::shwi (wi::popcount (nz), prec);
// Calculating the popcount of a singleton is trivial.
if (lh.singleton_p ())
{
- r.set (type, pop, pop);
+ r.set (type, high, high);
return true;
}
if (cfn_ffs::fold_range (r, type, lh, rh, rel))
{
- int_range<2> tmp (type, wi::zero (prec), pop);
+ wide_int known_ones = ~bm.mask () & bm.value ();
+ wide_int low = wi::shwi (wi::popcount (known_ones), prec);
+ int_range<2> tmp (type, low, high);
r.intersect (tmp);
return true;
}
--- /dev/null
+// { dg-do compile }
+// { dg-options "-O2 -fdump-tree-evrp" }
+
+void link_failure();
+void f(int a)
+{
+ a |= 0x300;
+ int b = __builtin_popcount(a);
+ if (b < 2)
+ link_failure();
+}
+
+// { dg-final { scan-tree-dump-not "link_failure" "evrp" } }