diff --git a/gcc/testsuite/gcc.target/i386/pr122104.c b/gcc/testsuite/gcc.target/i386/pr122104.c new file mode 100644 index 000000000000..be88933e3ec6 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr122104.c @@ -0,0 +1,12 @@ +/* PR tree-optimization/122104 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-widening_mul-alias" } */ +/* { dg-final { scan-tree-dump "\\.MUL_OVERFLOW" "widening_mul" } } */ +/* { dg-final { scan-tree-dump-not "# RANGE \\\[irange\\\] unsigned int \\\[1, " "widening_mul" } } */ + +int +foo (int x) +{ + int r = (unsigned) x * 35; + return x && ((unsigned) r / x) != 35U; +} diff --git a/gcc/tree-ssa-math-opts.cc b/gcc/tree-ssa-math-opts.cc index 1954c287c0ac..c3b2ac28e46e 100644 --- a/gcc/tree-ssa-math-opts.cc +++ b/gcc/tree-ssa-math-opts.cc @@ -3802,6 +3802,7 @@ maybe_optimize_guarding_check (vec &mul_stmts, gimple *cond_stmt, else gimple_cond_make_false (zero_cond); update_stmt (zero_cond); + reset_flow_sensitive_info_in_bb (bb); *cfg_changed = true; }