https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118140

--- Comment #9 from Robin Dapp <rdapp at gcc dot gnu.org> ---
Already during ifcvt we do

  Setting value number of _46 to 1 (changed)
  Replaced _44 <= 1 with 1 in all uses of _46 = _44 <= 1;
  Value numbering stmt = _41 = _3;
  Setting value number of _41 to _3 (changed)
  Value numbering stmt = _ifc__33 = .COND_IOR (_41, d_lsm.7_11, _46,
d_lsm.7_11);
  Applying pattern match.pd:1625, gimple-match-4.cc:12876
  Match-and-simplified .COND_IOR (_41, d_lsm.7_11, _46, d_lsm.7_11) to 1

which seems fishy to me.

COND_IOR (_3, d, 1, d) should not simplify to 1 (unless _3 is true).  The
underlying simplification d | 1 -> 1 is valid but it should not result in an
unconditional constant here.

We only introduce a vec_cond_expr for gimple value results in a vector context
but here the type is scalar.

To me it looks like we need to do

       else
        {
          new_op.set_op (COND_EXPR, res_op->type,
                         res_op->cond.cond, res_op->ops[0],
                         res_op->cond.else_value);
          *res_op = new_op;
          return gimple_resimplify3 (seq, res_op, valueize);
        }

in gimple-match-exports.cc for non-vector types as well.

Reply via email to