fold_const::expr_not_equal_to queries for a current range, but still uses
the old value_range class. This is causing it to miss opportunities when
ranger can provide something better.
PR tree-optimization/83072
PR tree-optimization/83073
PR tree-optimization/97909
gcc/
* fold-const.c (expr_not_equal_to): Use a multi-range class.
gcc/testsuite/
* gcc.dg/pr83072-2.c: New.
* gcc.dg/pr83073.c: New.
bool
expr_not_equal_to (tree t, const wide_int &w)
{
- value_range vr;
+ int_range_max vr;
switch (TREE_CODE (t))
{
case INTEGER_CST:
--- /dev/null
+/* { dg-do compile} */
+/* { dg-options "-O2 -fdump-tree-evrp-details" } */
+
+int f1(int a, int b, int c){
+ if(c==0)__builtin_unreachable();
+ a *= c;
+ b *= c;
+ return a == b;
+}
+
+int f2(int a, int b, int c){
+ c |= 1;
+ a *= c;
+ b *= c;
+ return a == b;
+}
+
+/* { dg-final { scan-tree-dump-times "gimple_simplified to" 2 "evrp" } } */
--- /dev/null
+/* { dg-do compile} */
+/* { dg-options "-O2 -fdump-tree-evrp-details -fno-tree-fre -fno-tree-ccp -fno-tree-forwprop" } */
+
+int f(int x)
+{
+ x = x|1;
+ return x & 1;
+}
+
+/* { dg-final { scan-tree-dump "gimple_simplified to.* = 1" "evrp" } } */