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

--- Comment #13 from Robin Dapp <rdapp at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #11)
> I see sometimes we check the return value of maybe_resimplify_conditional_op
> and sometimes does not.
> 
> E.g. in try_conditional_simplification we don't check the return value there
> and that might be the issue.
> 
> We do check it gimple_resimplify[123] for the non-constant case though (the
> constant case maybe should assert it returns true).

I think for the case here maybe_resimplify_conditional_op returns true either
way because we did a successful simplification.  The re-simplification is done
"optionally" after a previous simplification was applied so whether it does
something or not shouldn't affect correctness.

It does affect correctness, at least in the scalar case, though, because of

  /* If the "then" value is a gimple value and the "else" value matters,
     create a VEC_COND_EXPR between them, then see if it can be further
     simplified.  */

so the conditional would just be optimized away if we didn't do this particular
re-conditionalization.  Thanks for the aarch64 testcase,  I can add it to the
patch.  The #if 0 shouldn't be necessary, right?

Reply via email to